SCRMaps
/
Sign in

Death counters are your variables

StarCraft has no variables. Death counters are what you use instead.

4 min read

Classic triggers have no variables. What they do have is a slot per player per unit type recording how many of that unit died - and triggers can read and write that slot freely. So map makers use it as a variable.

SetDeaths(CurrentPlayer, SetTo, 0, "Level");
SetDeaths(CurrentPlayer, Add, 1, "Level");

Deaths(CurrentPlayer, AtLeast, 100, "Level");
Setting, adding, and reading it back in a condition.

“Level” here is a unit type name. In ScmDraft you rename a unit type you never use to Level and place none of them on the map. That slot then belongs entirely to you.

When you run out of unused unit types - and on a large map you will - you can go past the 228 real ones. The death table runs from 0x58A364 at 48 bytes per unit id (12 players x 4), and immediately after it, from 0x58F44A, sit 29,604 bytes that eud_book lists as Literally Unused. Work the arithmetic through and unit ids 432 to 1047 fall entirely inside that block: 616 spare counters per player.

These ids have no name, so they only work where a number can be written instead of a unit name - TrigEditPlus and EPScript both can. And other maps use the same space for the same reason; that matters only when merging somebody else's payload into yours.

If a unit you are using as a counter actually dies during play, the value climbs on its own and your variable is corrupt. That is why it must be a unit type the map never spawns.

A computer player's death counters make good globals. Per-player values go on CurrentPlayer; values the whole map shares go on P8.

Sign in to track your progress