Variable EditorTriggersA Trigger is a set of related events, actions, and conditions. All maps start with a simple trigger called Initialization that create a Melee Map. This trigger may be modified or removed, but doing so will make it a Custom Map. Triggers may be enabled or disabled. Disabled triggers will not invoke events, check conditions, or execute actions. Triggers may only be enabled or disabled at design time. Similarly, a trigger may be turned on/off, which may change during the game, but has the same effects as disabling or enabling a trigger. When creating any of these elements a dialog is shown that contains resolved and unresolved elements. Unresolved elements will be red, while resolved elements will be blue. An element cannot be saved if it has any unresolved parts. For example, when creating an action that will send text to all players in the game, you must resolve the text that is to be sent. EventsTriggers are invoked by Events, or things that happen, such as when a unit enters a region, a player leaves the game, or other things that occur. If multiple events are specified, any events that occur will invoke the trigger into checking conditions and executing actions. The example event shown in the screenshot has the unresolved element Unit, and if resolved would be invoked whenever that unit dies.
ConditionsAfter an event occurs and a trigger would be invoked, it's conditions are first checked. If all the conditions are met, usually when the all evaluate true, the trigger is then invoked. If the conditions are not met, the trigger is not invoked and nothing happens. There are many types of conditions, such as simple integer or real number comparisons, comparing abilities, unit types, game states, and more.
ActionsThe last part of a trigger is to perform some action, such as killing a unit, printing some text, displaying dialogues, and more. Things that happen are done by actions.
VariablesTriggers use values and expressions, such as how many hit points a unit has, it's position, or distance to another unit. These values can be saved or loaded into variables. Each variable has a:
|