A screenshot of the Trigger Editor creating an Action
The Trigger Editor is a module of the World Editor that allows the user to graphically create scripts that allow maps to perform actions in response to events. While the editor is graphical, it also generates JASS scripting code that may be modified. Most users use the graphical editor to create triggers, often not using hand-written scripting code, because of the low barrier of entry.

Contents

Variable Editor

Triggers

A 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.

Events

A simple unfinished event being created
Triggers 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.


Conditions

A simple condition that checks if a casted ability is Sleep
After 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.


Actions

An unfinshed action to send text to all players
The 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.


Variables

A real variable called z
Dialog in the Trigger Editor for managing variables
Triggers 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:
Name
A unique identifier in this map. It must begin with a letter and may contain letters, numbers, and the underscore ("_"). The actual name of the symbol in the generated script code is ugd_Name.
Type
The type of value the variable holds,(i.e: integer, real number, unit)
Default
Inital value of the variable. It may still be changed, but this will be it's value if unchanged. If no initial value is given it will have the default value for it's type, such as zero for numbers, an empty string, or No Unit