Conditions
A condition is a test a trigger makes on every pass, unless the trigger is part way through its actions. These are all of them:
| Condition | True when |
|---|---|
| Accumulate | a player has a given amount of ore or gas |
| Always | always |
| Bring | a player has a given number of units in a location |
| Command | a player has a given number of units anywhere |
| Command the Least | the player has the fewest of a unit type |
| Command the Least At | the player has the fewest of a unit type in a location |
| Command the Most | the player has the most of a unit type |
| Command the Most At | the player has the most of a unit type in a location |
| Countdown Timer | the countdown timer shows a given time |
| Deaths | a player's death count for a unit type is a given number |
| Elapsed Time | a given time has passed since the game started |
| Highest Score | the player has the highest score of a kind |
| Kill | a player has killed a given number of a unit type |
| Least Kills | the player has killed the fewest of a unit type |
| Least Resources | the player has the least ore or gas |
| Lowest Score | the player has the lowest score of a kind |
| Mission Briefing | used by briefings only |
| Most Kills | the player has killed the most of a unit type |
| Most Resources | the player has the most ore or gas |
| Never | never |
| Opponents | a player has a given number of opponents left |
| Score | a player's score of a kind is a given number |
| Switch | a switch is set, or clear |
Conditions that compare a number take a comparison: At least, At most or Exactly. All of a trigger's conditions must hold for it to run.
Accumulate#
True when the player has at least, at most or exactly the amount of ore, gas, or ore and gas.
Condition 4 · Accumulate(Player, Comparison, Amount, Resource);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Player | a player or group | bytes 4–7 |
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
| Resource | ore, gas, or ore and gas | byte 16 |
Accumulate("Current Player", At least, 500, ore);
Always#
Always true. A trigger that should run as soon as the game starts, or on every cycle with Preserve Trigger, has this as its condition. A trigger with no conditions at all behaves the same.
Condition 22 · Always();
It takes no arguments.
Always();
Bring#
True when the player has at least, at most or exactly the number of units of the type inside the location. A location's elevation settings (which of low, middle and high ground and air it covers) decide which units it counts.
A unit counts when its box touches the location. With At least or Exactly, Bring counts finished units and the units aboard a transport in the location; with At most, it counts every unit there, finished or not, but nothing aboard. See Counting units.
A location stored inverted, its right edge left of its left edge or its bottom above its top, holds nothing for Bring: the condition finds no units in it, so At least 1 is never true. (Run in 1.16.1 and found playing Remastered.) Create Unit uses only a location's middle, which is the same point for an inverted location.
Condition 3 · Bring(Player, Unit, Location, Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Player | a player or group | bytes 4–7 |
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
| Location | a location (Anywhere is location 64) | bytes 0–3 |
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Bring("Current Player", "Terran Marine", "Beacon", At least, 1);
Command#
True when the player has at least, at most or exactly the number of units of the type anywhere on the map. With At least or Exactly it counts finished units; with At most, every unit, including buildings still going up and eggs. The counts are taken once in each pass, so a unit created later in the pass is not seen until the next one. See Counting units.
The example is the standard melee defeat rule, which every melee game runs: a player who commands no buildings loses.
Condition 2 · Command(Player, Unit, Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Player | a player or group | bytes 4–7 |
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Command("Current Player", "Buildings", At most, 0);
Command the Least#
True when the player the trigger runs for has fewer units of the type than any other player. It counts finished units.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 16 · Command the Least(Unit);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
Command the Least("Buildings");
Command the Least At#
As Command the Least, counting only the units inside the location.
Condition 17 · Command the Least At(Unit, Location);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
| Location | a location (Anywhere is location 64) | bytes 0–3 |
Command the Least At("Men", "Arena");
Command the Most#
True when the player the trigger runs for has more units of the type than any other player. It counts finished units.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 6 · Command the Most(Unit);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
Command the Most("Buildings");
Command the Most At#
As Command the Most, counting only the units inside the location. A king-of-the-hill map checks who holds the hill with it.
Condition 7 · Command the Most At(Unit, Location);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
| Location | a location (Anywhere is location 64) | bytes 0–3 |
Command the Most At("Men", "Hill");
Countdown Timer#
True when the countdown timer shows at least, at most or exactly the number of seconds. The timer is started and changed with Set Countdown Timer.
Condition 1 · Countdown Timer(Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Countdown Timer(At most, 0);
Deaths#
True when the number of units of the type the player has lost is at least, at most or exactly the amount. Only units that die in the game count: Kill Unit and Remove Unit add nothing. For Men, Buildings, Factories and Any unit it reads the game's own counts of units lost, not the sum of the types (see Deaths and kills).
Every player has a death count for every unit type, whether or not that unit is ever on the map, and Set Deaths can change it. That makes the death counts of unit types a map does not use the usual place to keep numbers: a counter, a timer, a state. Each is a whole number from 0 to 4,294,967,295.
Condition 15 · Deaths(Player, Unit, Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Player | a player or group | bytes 4–7 |
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Deaths("Current Player", "Cave (Unused)", Exactly, 3);
Elapsed Time#
True when at least, at most or exactly the number of game seconds have passed since the game started. A game second is 16 frames at every game speed, and the clock stops while the game is paused, by a menu or by Pause Game.
Condition 12 · Elapsed Time(Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Elapsed Time(At least, 600);
Highest Score#
True when the player the trigger runs for has the highest score of the kind.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 9 · Highest Score(Score);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Score | a score type | byte 16 |
Highest Score(Kills);
Kill#
True when the player has killed at least, at most or exactly the number of units of the type. A player's own units never count as kills; an ally's do. Units killed by triggers are nobody's kills.
Condition 5 · Kill(Player, Unit, Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Player | a player or group | bytes 4–7 |
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Kill("Current Player", "Zerg Zergling", At least, 20);
Least Kills#
True when the player the trigger runs for has killed fewer units of the type than any other player.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 18 · Least Kills(Unit);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
Least Kills("Men");
Least Resources#
True when the player the trigger runs for has less of the resource than any other player.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 20 · Least Resources(Resource);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Resource | ore, gas, or ore and gas | byte 16 |
Least Resources(ore);
Lowest Score#
True when the player the trigger runs for has the lowest score of the kind.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 19 · Lowest Score(Score);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Score | a score type | byte 16 |
Lowest Score(Total);
Mission Briefing#
The condition of every trigger in a mission briefing. In a map's own triggers it is the same as Never. See Mission briefing actions.
Condition 13 · Mission Briefing();
It takes no arguments.
Most Kills#
True when the player the trigger runs for has killed more units of the type than any other player.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 8 · Most Kills(Unit);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Unit | a unit type, or one of the unit classes | bytes 12–13 |
Most Kills("Men");
Most Resources#
True when the player the trigger runs for has more of the resource than any other player.
A tie counts: when every player has 0, the condition is true for all of them. The game compares the player with every player in the game, rescuable and neutral slots included.
Condition 10 · Most Resources(Resource);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Resource | ore, gas, or ore and gas | byte 16 |
Most Resources(ore and gas);
Never#
Never true. A trigger with it never runs; the actions are kept, which is a way to keep a trigger in the list switched off.
Condition 23 · Never();
It takes no arguments.
Never();
Opponents#
True when the player has at least, at most or exactly the number of opponents still in the game. The player's side is the player and every player allied for victory with it both ways; an opponent is a player in the game who is not allied for victory, both ways, with everyone on that side. Rescuable and neutral slots are nobody's opponents, and a defeated player is no longer one.
The game's own melee rules use it: a player with no opponents left wins, as in the example below. Blizzard's melee maps carry the same rule in another form, Command(Non Allied Victory Players, Buildings, At most, 0), which runs only when such a map is played as Use Map Settings.
Condition 14 · Opponents(Player, Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Player | a player or group | bytes 4–7 |
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Opponents("Current Player", At most, 0);
Score#
True when the player's score of the kind is at least, at most or exactly the amount.
Condition 21 · Score(Player, Score, Comparison, Amount);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Player | a player or group | bytes 4–7 |
| Score | a score type | byte 16 |
| Comparison | At least, At most or Exactly | byte 14 |
| Amount | a whole number, 0 to 4,294,967,295 | bytes 8–11 |
Score("Current Player", Custom, At least, 100);
Switch#
True when the switch is set, or when it is clear.
Condition 11 · Switch(Switch, State);
| Argument | Takes | Stored in the condition |
|---|---|---|
| Switch | one of the 256 switches | byte 16 |
| State | set or not set | byte 14 |
Switch("Switch 1", set);