Basics of Triggers¶
Written by: Alian713
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!
1. Getting Started: 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?
-
Under the 1st box:
New
: creates a new trigger.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.Delete
: delete the selected trigger. This cannot be undone!Info
: show settings of the selected trigger
-
Under the 2nd box:
New Effect
: creates a new effect under the selected trigger.New Condition
: creates a new condition under the selected trigger.Delete
: delete the selected condition or effect. This cannot be undone!Copy
: copy the selected condition or effect.
But wait, what are effects and conditions? Effects and Conditions are the basic elements of triggers that allow us to take certain actions, make decisions and do a lot more cool stuff. They are covered in more detail in the Effects and Conditions sections of the guide
For now, simply put, an effect is the action that the trigger has to take and a condition is literally the thing which must be fulfilled before the action is allowed to be taken.
2. 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:
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.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 secondDescription
: this textbox is used for displaying objectives in theObjectives
panel of the scenario. See the setting below:Display as objective
: When this checkbox is selected, the text in theDescription
field is shown in theObjectives
panel of the scenario. TheObjectives
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.Description String Table ID
: This field is the same as the 5.8. Name String IDShort Description
: This textbox is used for displaying objectives on screen ingame. See the setting below:Display on Screen
: When this checkbox is selected, the text in theShort 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 theF4
key (or the score button) a few times.Make Header
: When this checkbox is selected andDisplay on Screen
is also selected, that particularShort Description
is displayed with a bigger font size.Mute Objectives
: When this checkbox is selected, completing an objective will not trigger a sound.Display Order
: The objectives are displayed in descending order of priority.Short Description String Table ID
: This field is the same as the5. Description String Table ID
.
3. General Information About Triggers¶
-
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 theObjectives
panel completely. -
A trigger with no conditions will immediately execute its effects on activation.
-
There is a theoretical limit of
4294967295
triggers in a scenario. Roll The Dice in older versions of the game is known to use about16000
triggers. There is a theoretical limit of2147483647
effects and2147483647
conditions inside one trigger. Perk Pandemonium is known to use up to250
effects inside one trigger. -
Triggers are executed in the order that they were created in, and not the order of their appearence from top to bottom. The effects inside one trigger are also executed in the order that they were created in, and not the order of their appearence from top to bottom. The conditions inside a trigger are checked according to the order that they were created in as well.
-
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.