SCRMaps
/
Sign in

When a computer unit casts

Mobs owned by a computer cast for free. After that it is a control problem, and controlling it means knowing the rules.

Explained in: Making one unit attack exactly that

The structure matters more than any individual entry. These four explain most of “why will it not cast that”.

The four rules
It is a priority chainAlmost every entry reads “only when X cannot be used”. Dark Swarm only when Plague cannot, Ensnare only when Parasite and Broodling cannot, Irradiate only when EMP and Defensive Matrix cannot, Hallucination only when Storm cannot, Recall only when Stasis cannot.
Mana cost is not priorityThe widely repeated trick of lowering a spell's mana cost to make the AI prefer it does not work. Making one cheaper only makes the higher-priority spell affordable more often.
There are two rangesThere is a wide search while idle and a 9x9 one once the unit has been attacked. A mob that casts freely on patrol and barely casts in a fight is behaving correctly.
The 250 and double rulePlague, Ensnare, Stasis and Psionic Storm, when not under attack, need enemy HP+shields in the area over 250 and more than twice the friendly total. Mobs that never storm are usually failing this.
Exclusions that always apply
Invincible unitsNo spell ever targets one.
Cloaked unitsNot a target unless detected.
Hero unitsA hero uses no special ability except cloak and infestation - which makes “make it a hero” the bluntest way to switch a mob's casting off.
Interceptor · Spider Mine · Scarab · a worker in gasExcluded as targets almost everywhere.
Three the editor cannot switch off
ConsumeNo AI uses it at all - there is nothing to switch off.
InfestationFires automatically near a damaged Command Center, and marking the ability disabled in the editor does not stop it.
Siege ModeThe same: place a sieged tank with the ability disabled and it still un-sieges when its conditions are met.
The thresholds behind “it will not cast”
Defensive MatrixTarget needs max HP of 100 or more and current HP of 75 or less, must not already have it, and allies are eligible.
EMPShields or energy totalling over 200.
Yamato GunA target between 200 and 450 HP+shields, heroes excluded.
Optical FlareOver 80 HP+shields, and only on a full mana bar.
RestorationOver 60 HP+shields, and an actual status effect other than Stasis.
Stim PackWhen attacking an enemy at 100 current HP or more.
Nuclear StrikeFive or more units at the target point.
HealOnly on its own units - never on an allied player's.

Treat the range figures with care. The original is Heinermann and SEN's analysis of the StarCraft beta's debug build, and as its translator points out it expressed ranges in box pixels and assumed the AI's notion of an “area” as context. The “9x9 tiles” in circulation is somebody's conversion. Use them as relative sizes - wide when idle, small when attacked - and not as measurements.

And the AI itself breaks. Computer units cast well early and stop later, the classic symptom being a tank that sieges and never un-sieges for the rest of the game. That is a known failure of the unit AI rather than of your conditions - and it is the argument for driving mob behaviour from the struct instead.