Difference between revisions of "Death Counters"

From Staredit Network Wiki
Jump to: navigation, search
(Added binary countoffs)
 
Line 205: Line 205:
 
A more specific use for death counters is to create a binary countoff. This is useful when trying to copy, convert, or count a very large number quickly without the use of EUDs. It's actually quite simple to setup and use, it will count up to the sum of all of it's triggers.  
 
A more specific use for death counters is to create a binary countoff. This is useful when trying to copy, convert, or count a very large number quickly without the use of EUDs. It's actually quite simple to setup and use, it will count up to the sum of all of it's triggers.  
  
For example, the following series of triggers can count off a number up to 127 in a single trigger cycle. The order here matters, as we always want the largest values at the top as those will occur first.
+
For example, the following series of triggers can count off a number up to 31 in a single trigger cycle. The order here matters, as we always want the largest values at the top as those will occur first.
  
 
<div class="trigger-sc1" style="width:625px;margin-bottom:1em;border:1px solid #000;background:#CCC">
 
<div class="trigger-sc1" style="width:625px;margin-bottom:1em;border:1px solid #000;background:#CCC">
Line 217: Line 217:
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
{{{conditions|{{{2|*Current Player has suffered at least 64 deaths of Unit.}}}}}}
+
{{{conditions|{{{2|*Current Player has suffered at least 16 deaths of Unit.}}}}}}
 
</div>
 
</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
{{{actions|{{{3|*Preserve trigger.
 
{{{actions|{{{3|*Preserve trigger.
*Modify death counts for Current Player: Subtract 64 for Unit1.
+
*Modify death counts for Current Player: Subtract 16 for Unit1.
*Modify death counts for Current Player: Add 64 for Unit2.}}}}}}
+
*Modify death counts for Current Player: Add 16 for Unit2.}}}}}}
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
  
Line 236: Line 236:
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
{{{conditions|{{{2|*Current Player has suffered at least 32 deaths of Unit.}}}}}}
+
{{{conditions|{{{2|*Current Player has suffered at least 8 deaths of Unit.}}}}}}
 
</div>
 
</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
{{{actions|{{{3|*Preserve trigger.
 
{{{actions|{{{3|*Preserve trigger.
*Modify death counts for Current Player: Subtract 32 for Unit1.
+
*Modify death counts for Current Player: Subtract 8 for Unit1.
*Modify death counts for Current Player: Add 32 for Unit2.}}}}}}
+
*Modify death counts for Current Player: Add 8 for Unit2.}}}}}}
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
  
Line 255: Line 255:
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
{{{conditions|{{{2|*Current Player has suffered at least 16 deaths of Unit.}}}}}}
+
{{{conditions|{{{2|*Current Player has suffered at least 4 deaths of Unit.}}}}}}
 
</div>
 
</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
{{{actions|{{{3|*Preserve trigger.
 
{{{actions|{{{3|*Preserve trigger.
*Modify death counts for Current Player: Subtract 16 for Unit1.
+
*Modify death counts for Current Player: Subtract 4 for Unit1.
*Modify death counts for Current Player: Add 16 for Unit2.}}}}}}
+
*Modify death counts for Current Player: Add 4 for Unit2.}}}}}}
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
  
Line 274: Line 274:
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
{{{conditions|{{{2|*Current Player has suffered at least 8 deaths of Unit.}}}}}}
+
{{{conditions|{{{2|*Current Player has suffered at least 2 deaths of Unit.}}}}}}
 
</div>
 
</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
{{{actions|{{{3|*Preserve trigger.
 
{{{actions|{{{3|*Preserve trigger.
*Modify death counts for Current Player: Subtract 8 for Unit1.
+
*Modify death counts for Current Player: Subtract 2 for Unit1.
*Modify death counts for Current Player: Add 8 for Unit2.}}}}}}
+
*Modify death counts for Current Player: Add 2 for Unit2.}}}}}}
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
  
Line 293: Line 293:
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
{{{conditions|{{{2|*Current Player has suffered at least 4 deaths of Unit.}}}}}}
+
{{{conditions|{{{2|*Current Player has suffered at least 1 deaths of Unit.}}}}}}
 
</div>
 
</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
{{{actions|{{{3|*Preserve trigger.
 
{{{actions|{{{3|*Preserve trigger.
*Modify death counts for Current Player: Subtract 4 for Unit1.
+
*Modify death counts for Current Player: Subtract 1 for Unit1.
*Modify death counts for Current Player: Add 4 for Unit2.}}}}}}
+
*Modify death counts for Current Player: Add 1 for Unit2.}}}}}}
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 +
 +
If we wanted to greatly increase the number to count up higher we need to expand the range. We would add an additional two triggers with 32 and 64, but make sure you place them above the earlier countoff or there will be a delay.
  
 
<div class="trigger-sc1" style="width:625px;margin-bottom:1em;border:1px solid #000;background:#CCC">
 
<div class="trigger-sc1" style="width:625px;margin-bottom:1em;border:1px solid #000;background:#CCC">
Line 312: Line 314:
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
{{{conditions|{{{2|*Current Player has suffered at least 2 deaths of Unit.}}}}}}
+
{{{conditions|{{{2|*Current Player has suffered at least 64 deaths of Unit.}}}}}}
 
</div>
 
</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
{{{actions|{{{3|*Preserve trigger.
 
{{{actions|{{{3|*Preserve trigger.
*Modify death counts for Current Player: Subtract 2 for Unit1.
+
*Modify death counts for Current Player: Subtract 64 for Unit1.
*Modify death counts for Current Player: Add 2 for Unit2.}}}}}}
+
*Modify death counts for Current Player: Add 64 for Unit2.}}}}}}
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
  
Line 331: Line 333:
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-field trigger-sc1-conditions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Conditions:</div>
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
 
<div class="trigger-sc1-value trigger-sc1-conditions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF">
{{{conditions|{{{2|*Current Player has suffered at least 1 deaths of Unit.}}}}}}
+
{{{conditions|{{{2|*Current Player has suffered at least 32 deaths of Unit.}}}}}}
 
</div>
 
</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-field trigger-sc1-actions" style="float:left;clear:left;width:75px;padding:6px 4px 5px 4px;border-top:1px solid #888;background:#CCC;font-weight:bold;vertical-align:middle">Actions:</div>
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
<div class="trigger-sc1-value trigger-sc1-actions" style="padding:1px 4px 5px 3px;margin-left:83px;border-top:1px solid #AAA;background:#FFF;max-height:203px;overflow-y:auto">
 
{{{actions|{{{3|*Preserve trigger.
 
{{{actions|{{{3|*Preserve trigger.
*Modify death counts for Current Player: Subtract 1 for Unit1.
+
*Modify death counts for Current Player: Subtract 32 for Unit1.
*Modify death counts for Current Player: Add 1 for Unit2.}}}}}}
+
*Modify death counts for Current Player: Add 32 for Unit2.}}}}}}
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
 
</div><br style="clear:both;font-size:0;line-height:0"/></div>
  
If we wanted to greatly increase the number to count up higher we need to expand the range. We would add an additional two triggers with 128 and 256, which allows it to count up to the newest highest total; Which just so happens to always be double the highest higher minus one. So it would now be 511.
+
And this now allows it to count up to the newest highest total. And with Binary Countoffs this happens to always be double the highest higher minus one, which is 123.
  
 
==EUD==
 
==EUD==

Latest revision as of 14:16, 4 December 2023

Death counts are unsigned 4-byte values that keep track of how many times a given unit had been killed for each player. When a unit is killed (by another unit, not by a kill trigger), 1 is added to the death count of that unit for whatever player owned it. All death counts for all players start at zero.

The Deaths condition can be used to detect how many deaths a player has for a unit. The Set Deaths action can be used to modify the death counts. Map makers can use these counters for a variety of things other than just detecting when units get killed. They can be used to store game variables, such as the level in a defense map, or character HP in a RPG map.

They can also be used as a timer. Death counter timers are a commonly used alternative to wait actions. Used in conjunction with Hyper Triggers, Death counter timers are far more useful and flexible than wait actions. The number of death counts available to map makers is very high; one for each unit for each player 1-8.

Counter control

Unless you are using a death counter to actually detect when a unit is killed, your triggers should have absolute control over the value of the death counter. To do this, make sure that the unit can't actually be killed in your map.

The following units can never be killed, the only way their death count will change from zero is if you use the Set Deaths action. Many of these units can't be used in a map at all.

Goliath Turret
Tank Turret(Tank Mode)
Nuclear Missile
Alan Schezar Turret
Edmund Duke Turret
Edmund Duke Turret
Tank Turret (Siege Mode)
Scanner Sweep
Unused - Cargo Ship
Unused - Mercenary Gunship
Map Revealer
Disruption Web
Unused1
Unused2
Uraj Crystal
Khalis Crystal
Unused Zerg Building1
Unused Zerg Building2
Unused Protoss Building1
Unused Protoss Building2
Khaydarin Crystal Formation
Mineral Field (Type 1)
Mineral Field (Type 2)
Mineral Field (Type 3)
Cave
Cave-in
Cantina
Mining Platform
Independant Command Center
Independant Starport
Independant Jump Gate
Ruins
Kyadarin Crystal Formation
Vespene Geyser
Zerg Marker
Terran Marker
Protoss Marker
Zerg Beacon
Terran Beacon
Protoss Beacon
Zerg Flag Beacon
Terran Flag Beacon
Protoss Flag Beacon
Dark Swarm
Floor Hatch
Left Upper Level Door
Right Upper Level Door
Left Pit Door
Right Pit Door
Start Location
Flag
Psi Emitter
Data Disc
Khaydarin Crystal

All of these units are either always invincible, or they crash when you place them on the map, or crash when killed, so they are good units to use for death counters. In the case of the Start Location, they can be placed on the map as units, and can be attacked and killed, adding one to the death count, but anyone who views this event will crash.

Timer

Any type of counter can be used as a timer, but using a death counter is the most common method, because there are many available for use. To use a counter as a timer, you must first determine how long you want it to wait. This type of counter is based on how often the triggers execute. If you are using hyper triggers on fastest, the counter will change 12 times per real-time second (the exact number is 1 trigger loop every 84 milliseconds, or approx 11.9 times per second). If you want to be compatible with the countdown timer, then the counter will change 8 times per game second. If you are not using hyper triggers, the counter will change once every two game seconds.

First, set the counter to the desired amount, and we'll make it repeatable.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at most 0 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Set to 120 for Unit.
  • Display text for current player: "You'll see this every ten seconds!"

So next, we need to make a trigger that always subtracts 1 from the same unit's deaths. This way the two triggers will act like a countdown timer when used together.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 1 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 1 for Unit.

You can also use deathcounts to produce a series of repeatable events.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered exactly 60 deaths of Unit.
Actions:
  • Preserve trigger.
  • Display text for current player: "Five seconds has just past!"

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered exactly 24 deaths of Unit.
Actions:
  • Preserve trigger.
  • Display text for current player: "There are two seconds left!"

Using this, you can make various events from one death count. From this, one should realize that death counts can be used for almost all repeated but timed triggers without the need of setting more conditions. This is great for triggering things like pre/post spell effects.

Switch

You can use death counters like switches. For example, use:


StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Always.
Actions:
  • Modify death counts for Player: Set to X for Unit.

in place of:


StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • ALways.
Actions:
  • Set 'Switch 1'

With this action, you can have conditions that respond accordingly. Player will be the player number, quantity is at least, exactly, or at most a certain number, and Unit is the unit that you used to set the deaths. This gives you a huge range of switches. Even more than 255, because there is a counter for every unit for each player.

This also allows you to have player-specific switches. So, for example, you could set a death counter to 1 for All Players, and have each of the players' triggers respond to this counter individually. Without using a counter this would require multiple actions and multiple switches (set switch 1, set switch 2, set switch 3, etc.)

Binary Countoffs

A more specific use for death counters is to create a binary countoff. This is useful when trying to copy, convert, or count a very large number quickly without the use of EUDs. It's actually quite simple to setup and use, it will count up to the sum of all of it's triggers.

For example, the following series of triggers can count off a number up to 31 in a single trigger cycle. The order here matters, as we always want the largest values at the top as those will occur first.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 16 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 16 for Unit1.
  • Modify death counts for Current Player: Add 16 for Unit2.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 8 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 8 for Unit1.
  • Modify death counts for Current Player: Add 8 for Unit2.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 4 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 4 for Unit1.
  • Modify death counts for Current Player: Add 4 for Unit2.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 2 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 2 for Unit1.
  • Modify death counts for Current Player: Add 2 for Unit2.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 1 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 1 for Unit1.
  • Modify death counts for Current Player: Add 1 for Unit2.

If we wanted to greatly increase the number to count up higher we need to expand the range. We would add an additional two triggers with 32 and 64, but make sure you place them above the earlier countoff or there will be a delay.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 64 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 64 for Unit1.
  • Modify death counts for Current Player: Add 64 for Unit2.

StarCraft Trigger [template]
Players:
  • Desired non-neutral player
Conditions:
  • Current Player has suffered at least 32 deaths of Unit.
Actions:
  • Preserve trigger.
  • Modify death counts for Current Player: Subtract 32 for Unit1.
  • Modify death counts for Current Player: Add 32 for Unit2.

And this now allows it to count up to the newest highest total. And with Binary Countoffs this happens to always be double the highest higher minus one, which is 123.

EUD

For more information, see EUDs.

Attempting to use "Extended Unit" or "Extended Player" death counts has an entirely different effect. For a brief period "EUD" triggers, and other "extended" triggers, were possible. Extended Unit Death triggers, a method of using the Deaths and Set Deaths conditions and actions with large values, allowed for map makers to read from or write to much of Starcraft's memory directly by means of buffer overflows.

Many "mod-like" things were possible, such as giving Terran or Zerg units Protoss shields, changing what type of weapon a unit used, changing a unit's portrait and voice quotes, editing/detecting unit HP/energy, etc. Not only were these things possible, but they could also be activated in-game, and changed later during the game, which is beyond the power of a normal mod.

These actions were later disabled by patch 1.13. They are currently non-functional, you can no longer set the death counts for extended units or players. You can, however, still read from memory using EUD conditions.

Problems with EUD conditions are numerous. Mainly, most of them aren't particularly useful, especially without their EUD action counterparts. They also need to be updated if StarCraft is ever patched, because the memory locations change - although no longer an issue nowadays given the last patch was over 5 years ago. Some EUD Conditions will even drop players when actions are used as the values are not shared over Battle.net.

Death counters over switches

Death Counters provide many advantages over normal switches, however both have their place. Here's a list of times when one should choose either a switch or a death counter:

Death Counters

  • Player-specific switches
  • Switches with more than two states

Normal Switches

  • Global Switches
  • Two state switches
  • Randomization