10. Trigger Tutorial (Intermediate)

Creating & Using Triggers

Triggers may have more than just one event or action associated with them. If a trigger has multiple events all of them must be true simultaneously in order for the trigger to fire. An example of this is a complex win trigger using many different events.


Step 1: Add A New Variable

Trigger: Create a win trigger requiring both destruction of the enemy and evacuation to a dust off point

Under the Edit menu, select "Local Variables". Add a new variable "0" with the description "Enemy Destroyed" and set its initial value to "0".


Step 2: Set Up The Trigger

Set up a trigger with the following parameters:

a. Name: "Enemy player killed"
b. Event: "11 House completely destroyed", parameter the enemy house
c. Actions:
- "11 Display text message", parameter "1 Objective 1 completed!"
- "56 Set Local", parameter "0 Enemies Destroyed,0"


Step 3: Set Up Win Trigger

Set up the win trigger with the following parameters:

a. Name: "American Win"
b. Events:
- "36 Local is set", parameter "0 Enemies Destroyed,0"
- "1 Celltag entered", parameter "0 American"
c. Actions:
- "11 Display text message", parameter "2 Objective 2 completed!"
- "1 Win game", parameter "0 Americans"


Step 4: Create Celltags

Create one or more celltags with the property "01000008 American Win 1" where the evacuation point will be. The "Americans" will now "win [the] game" when any "celltag [is] entered" and the enemy "house [has been] completely destroyed".
To create the celltags, you can also use the "Place trigger" button in the trigger editor and place the celltags by clicking on the map

Now you've set up a multi-part trigger!



Original tutorial writer: Thalassicus