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 second
Description: this textbox is used for displaying objectives in the
Objectivespanel of the scenario. See the setting below:
Display as objective: When this checkbox is selected, the text in the
Descriptionfield is shown in the
Objectivespanel of the scenario. The
Objectivespanel 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 ID
Short 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 the
Short Descriptionfield 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
F4key (or the score button) a few times.
Make Header: When this checkbox is selected and
Display on Screenis also selected, that particular
Short Descriptionis 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 the
5. 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
Objectivespanel and checked when displayed on screen. Disabling the trigger related to that objective will remove the objective from screen or the
A trigger with no conditions will immediately execute its effects on activation.
There is a theoretical limit of
4294967295triggers in a scenario. Roll The Dice in older versions of the game is known to use about
16000triggers. There is a theoretical limit of
2147483647conditions inside one trigger. Perk Pandemonium is known to use up to
250effects 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.