When a map crashes the moment it loads, the instinct is to suspect triggers - but it is more often that something was placed which must not be placed. The Remastered patches made most beta-era dummy units safe, but a list that still crashes on placement remains.
- A unit or building sticking out past the map boundary. This is the most common cause.
- The turret subunits - Allan Turret, Duke Turret 1 and 2, Goliath Turret, Tank Turret 1 and 2 - crash whether placed as units or as unit sprites.
- Wall Flame Trap 01/02 and Wall Missile Trap 01/02 under Doodads, Installation.
- Spell-effect sprites - Psionic Storm, Lockdown + EMP Shockwave Missile, Optical Flare Grenade, Yamato Gun, Broodling Parasite, Consume and Plague Cloud.
- Almost every sprite under Effects, Weapons crashes - only a short list is safe, so pick from that rather than browsing.
That the turret subunits are on the list matters especially for EUD authors: a Goliath's air attack is its turret subunit's weapon, so you sometimes need to edit that weapon. Reading and writing its data is a different thing from placing it on the map - just do not place it.
If the crash came from EUD the message is different: an EUD ERROR dialog shows a hex value, and that value is not the address. Subtract it from 0xFFFFFFFF for the real offset, then look that offset up - and you know what you touched rather than guessing.
One of them takes the editor rather than the game. Setting a sieged Siege Tank or a Goliath Unit Sprite to Active hangs ScmDraft, and saving in that state leaves a map file that will never open again. Losing the work file hurts more than losing the game.
The crash lists that circulate carry some entries that are no longer true and some whose symptom names the culprit outright. Four worth separating out.
| Build time 0 | Does not crash on Remastered, for units or buildings. The author of the original list corrected it himself. |
|---|---|
| Building hit points 0 | This one still does, at the moment the building is constructed. |
| Error code 0xFFFFFEEF | Means sprites piling up: a unit whose script has no death motion leaves one behind every time it goes. It is not a bad address, it is something not cleaning up. |
| An empty button string | On 32-bit it crashes only while the button is enabled and showing the string; on 64-bit it crashes on hover even when disabled. "It works on my machine" is genuinely possible here. |
One more: a projectile option on a unit that fires no projectile crashes. The reported case is a Hydralisk given "turn on target", which is a projectile setting - and a Hydralisk's attack spawns none. Check that the unit actually fires something before setting an option that assumes it does.
Finally, three crashes that look unrelated turn out to be one cause: a divide by zero in the movement code.
Flingy ids 141 to 171 and 201 to 206 are treated as weapon flingies. When something uses one and its movement is controlled by Flingy.dat or Weapon rather than by iscript, then while it is turning rather than going straight its turn rate at 0x22 increments by one every frame - apparently so a projectile homes harder the longer it turns. And when it decelerates, with the destination inside 32 pixels and the movement and acceleration directions differing, that turn rate is the denominator of the speed calculation.
| A unit given a weapon's flingy crashes a while after firing, and faces oddly in flight | The turn rate wraps 255 to 0 once every 256 frames, about 10.7 seconds, and if that lands on a deceleration frame it divides by zero. |
|---|---|
| A unit with turn rate 0 crashes within 32 pixels of its destination, or at the map edge | The same division with the denominator zero from the start - this is why bullet-hell maps crash. |
| A bullet chasing a fleeing target crashes occasionally | The same cause, and rarer to see than on a unit. |
There are three fixes. First, give the unit a flingy outside those ranges. If you must use one, pin CUnit.turnSpeed to 127 every frame - 128 and above reads as a negative turn speed and the unit spins the wrong way. Or change the sprite or image the flingy uses instead of changing the flingy, which avoids the path entirely.
One list item that only says "check it yourself" is worth settling. Item 24 - a shield on a unit with no shield script crashes when it is attacked - says it happens only when that image's iscript has just the two entries Init and Death, which reads as though you have to open the script every time. The set is actually fixed.
Measured across all 398 scripts, "just two entries" is exactly iscript types 0 and 1, and not one longer type has all its later slots empty - the two phrasings name the same set. Only 26 units use one: Scanner Sweep, Map Revealer, Dark Swarm, Disruption Field, the six beacons, every powerup, and Start Location. Nothing anybody gives a shield to.
