Skip to content

Basics of Triggers

Written by: Alian713 & KSneijders


Common Terminology

Feel free to skip this if you are already familiar with these terms.

  • Bug: Anything in the map that is not working as intended is a bug. Historically, the term "bug" comes from physical bugs getting stuck in computers and causing them to malfunction back in the day when computers used to be the size of entire rooms. In today's context, a bug in anything just means that it's malfunctioning and not working as intended.
  • Debugging: Attempting to find out the cause of the malfunction, and removing/fixing that cause is known as debugging.
  • Execution: Executing a trigger means that we carry out its effects.

What are Triggers

Usually a regular AoE2 game proceeds without anything about the gameplay changing in the middle of the game. Using triggers allows us to essentially introduce data mods (and much more) into the game, WHILE the game is running! This means that, for example, you could have a scenario where at the 30 minute mark, all players must pay a certain amount of resources or face some consequences. Another example is one where certain actions taken by the player can cause different events.

If you have ever played CBA (or sighed at people who play CBA) or played any of the campaigns in the game, all of them are made possible using triggers in a scenario. Another good example of just what triggers can do is this game mode Perk Pandemonium.

Triggers introduce dynamics into a game and allow us to make interesting game modes as described above. Learning how to use triggers is simple and every map maker should be familiar with them to be able to make the best use of a scenario!

Every trigger is built from two basic elements: Effects and Conditions. A condition is something that must be fulfilled, and an effect is the action the trigger takes once its conditions are met. The next two sections introduce each of them in turn.

What are Effects

Effects are the actions a trigger performs. They are essentially "cheats" in some sense, letting you change information about the game while the game is being played. Every technology in the game relies on effects to do what it is meant to do, usually combining several of them to achieve its purpose. Some basic effects available in the scenario editor are Create Unit, Send Chat, and Display Instructions.

A detailed explanation of each effect and its customization options can be found here.

What are Conditions

Conditions are the checks that decide whether a trigger is allowed to fire: a trigger only executes its effects once all of its conditions are met. They let you react to the state of the game, such as whether a player owns a certain unit, whether a timer has elapsed, or whether a variable holds a particular value.

A detailed explanation of each condition and its customization options can be found here.

Getting Started with Triggers: The UI

To work with triggers in your scenario, you need to go to the Triggers tab in the editor. Here, you will see two boxes to the left. The box at the top lists all the existing triggers in a scenario. When a trigger is selected, the box at the bottom displays the list of conditions and effects for that trigger.

What do the buttons under the boxes do?

  1. Under the 1st box:

    1. New: creates a new trigger.
    2. Copy: After selecting a trigger, clicking this will create a new trigger that has the exact same settings, conditions and effects as the selected trigger.
    3. Delete: delete the selected trigger. This cannot be undone!
    4. Info: show settings of the selected trigger
  2. Under the 2nd box:

    1. New Effect: creates a new effect under the selected trigger.
    2. New Condition: creates a new condition under the selected trigger.
    3. Delete: delete the selected condition or effect. This cannot be undone!
    4. Copy: copy the selected condition or effect.

Effects and Conditions are covered in more detail in the Effects and Conditions sections of the guide.

Trigger Settings

When a trigger is selected, the settings related to it are displayed. The following is a description of all the settings and what they do:

  1. Enabled: this property controls if the trigger is active from the beginning of the game. An active trigger is one which can execute its effects immediately if its conditions are fulfilled. If a trigger is not active, then its effects will not be executed even if its conditions are fulfilled.
  2. Looping: this property controls if the trigger deactivates itself after running once or if it repeatedly executes its effects when its conditions are fulfilled. Triggers loop once every second
  3. Description: this textbox is used for displaying objectives in the Objectives panel of the scenario. See the setting below:
  4. Display as objective: When this checkbox is selected, the text in the Description field is shown in the Objectives panel of the scenario. The Objectives panel is the one that is opened when you click the button next to the tech tree at the top of the screen ingame. This panel is visible to ALL players in the game.
  5. Description String Table ID: This field is the same as the 5.8. Name String ID
  6. Short Description: This textbox is used for displaying objectives on screen ingame. See the setting below:
  7. Display on Screen: When this checkbox is selected, the text in the Short Description field is shown to the right side of the screen of ALL players in the game. If it does not show up for you when you enable this, try pressing the F4 key (or the score button) a few times.
  8. Make Header: When this checkbox is selected and Display on Screen is also selected, that particular Short Description is displayed with a bigger font size.
  9. Mute Objectives: When this checkbox is selected, completing an objective will not trigger a sound.
  10. Display Order: The objectives are displayed in descending order of priority.
  11. Short Description String Table ID: This field is the same as the 5. Description String Table ID.

General Information About Triggers

  1. When the conditions inside a trigger which is displayed as an objective are fulfilled, then the objective is marked as completed. A completed objective is strikethrough-ed in the Objectives panel and checked when displayed on screen. Disabling the trigger related to that objective will remove the objective from screen or the Objectives panel completely.

  2. A trigger with no conditions will immediately execute its effects on activation.

  3. There is a theoretical limit of 4294967295 triggers in a scenario. Roll The Dice in older versions of the game is known to use about 16000 triggers. There is a theoretical limit of 2147483647 effects and 2147483647 conditions inside one trigger. Perk Pandemonium is known to use up to 250 effects inside one trigger.

  4. The order in which triggers and effects are executed depends on the Options > Run triggers and effects in display order setting, which is enabled by default. When this option is enabled, triggers and effects are executed in the order of their appearance from top to bottom (their display order). When it is disabled, triggers and effects are executed in the order that they were created in, which is not necessarily the same as their appearance from top to bottom. The conditions inside a trigger are always checked according to the order that they were created in.

  5. For the effects of a trigger to execute, all the conditions of the trigger must be fulfilled except in one case (when an OR condition is used). A trigger will give up on checking the rest of its conditions as soon as a condition that is false is encountered except in one case (when an OR condition is used). These rules are discussed in greater detail in the Conditions section of the guide.