SCRMaps
/
Sign in

Summons

The easiest skill to build and the easiest to leave broken. There are four places it leaks.

7 min read

A summon has no target, so the shape is simple: charge for it, take the lock, create a few units, set them patrolling the cast point. The hard part is not the making, it is the cleaning up.

  1. 1One variable per summon. Capture the about-to-be-created unit into its own variable immediately before each create - four summons, four variables. Pack them into one and you only keep the last.
  2. 2Release the cast lock on every exit, including the one everybody forgets: the hero dying mid-skill. Ship a separate trigger for hero dead plus lock set, which kills the summons and clears the lock.
  3. 3Give the summons a death. A duration that removes them is part of the skill, not a nicety - without it they accumulate.
  4. 4Check a stored unit is still there before using it.

That last one is a crash. Referencing the structure offset of a unit that is already gone kills the map, and a summon is by definition a unit that dies - so a stored address has to be liveness-checked every time. The simple test is a Bring or Command count; the precise one is reading that unit's order id.

To know whether a summon landed a hit - for lifesteal, say - look at its weapon cooldown. A nonzero ground cooldown means it attacked this cycle, and at a Zergling's attack speed that is fast enough without keeping the previous value around.

When you heal, check the maximum first and only then add. Terran and Protoss units do not correct an overshoot: they sit at something like 1270/40 forever. Zerg regeneration hides the bug, which is why it is usually found late.

Building a skill
Sign in to track your progress