Triggers

Triggers allow you to add extra functionality to your map by defining how it should respond to certain events when they occur. A trigger is said to listen to events and when they occur, it is triggered. Once triggered, the trigger will perform a number of actions (eg. Kill units, end the game, etc.) on the map. This makes your map more interactive and unique.

It is important to remember that Triggers are not an alternative to Data and, preferably, things which can be done with both the Trigger Editor and the Data Editor should be done using the Data Editor. Nevertheless, the best maps always have a good Trigger System and, as such, mastery of triggers is always a bonus for creating memorable maps.

Trigger Structure
A trigger is composed of four sections. You can see these if you create a new, empty trigger in the Trigger Editor. These are:
 * Events - A trigger listens to a number of events. If one of the listed events occur, the trigger will perform its actions (provided the conditions are fulfilled).
 * Local Variables - A list of variables that the trigger will use.
 * Conditions - A list of conditions for the trigger to meet. When triggered, the game will check these conditions and if all of them are true, it continues to executing the actions.
 * Actions - These define what the trigger does once triggered.

Trigger States
There are two properties for each trigger. These are whether the trigger is disabled or enabled and whether the trigger is on or off. Disabling a trigger is useful for debugging where you do not want a trigger to work during your map. You cannot enable/disable a trigger in-game. Switching a trigger on/off, on the other, can be done during the game and is useful, for example, if you want to switch on triggers while the game progresses.

You can set whether a trigger is Enabled or Initially On by right-clicking on the trigger in the Trigger Editor and selecting the appropriate item.