scmJS docs

How triggers run

A trigger is a list of up to 16 conditions and up to 64 actions, and the players it runs for. When every condition holds, the game carries out the actions in order. A trigger that should run straight away has Always as its condition.

Who a trigger runs for#

A trigger is owned by one or more of the players and groups: a player, a force, or All Players. A trigger owned by a group runs separately for each player in it, as if each had a copy of their own. Its conditions are checked and its actions carried out once per player, and inside it Current Player means whichever player that copy is running for.

The trigger cycle#

The game does not check triggers continuously. On a map of ordinary triggers it goes through them about every two seconds of game time: each player's triggers, top to bottom in the order of the list. A map with hyper triggers — preserved triggers made of many Wait actions of 0 milliseconds — makes the game go through the list every frame instead, which is how maps react quickly. The editor's Check Map recognises them.

Once, or every time#

A trigger runs once for each player it runs for and is then finished, unless it carries Preserve Trigger, in which case it runs every cycle its conditions hold. A preserved trigger whose conditions stay true keeps firing: one that adds a mineral adds one each cycle.

Waits#

A Wait or a Transmission holds the rest of its trigger's actions until its time has passed. A player's waits do not run side by side: while one of that player's triggers is waiting, a wait in another of their triggers is held up behind it. On a map with hyper triggers this means a Wait in any other preserved trigger stalls that player's whole trigger list, which Check Map points out.

Disabled conditions and actions#

A condition or action can be disabled without deleting it (a flag in its record). The game skips it: a disabled condition does not count, and a disabled action is not carried out. In text, a disabled line starts with ;.

scmJS 0.6.2 + main@dd79a77 · Generated from the repository. The source is under the MIT license, which does not cover what ATTRIBUTION.md lists. StarCraft and Brood War are trademarks of Blizzard Entertainment; this project ships none of their data.