Scenario Editor Trigger Tutorial

Article written by Aro
Originally published on 01-31-2004 ; updated on 08-17-2014
Tags: Beginners, Reference, Triggers

What's a Trigger?

A Trigger is what you might expect - something that activates and executes a command, and in this case, this will take place within the scenario itself (such as if you get a certain unit to an area, you will win the scenario). The Age of Kings editor has evolved a lot since the original Age of Empires (which was reliant on AI because it contained no trigger capabilities at all) and has enabled designers to create two new genres - RPG and RPS. The Triggers give the editor almost unlimited possibilities when designing.

Trigger Interface

The trigger interface is very simple to understand. Delete removes the trigger from the list, New creates a new trigger, and Info displays the trigger options, which can be read about below. The ^ and v allow you to move your trigger up and down the list. There's a down side to this though; when a Condition or Effect lets you choose a trigger from a list to enact a certain option, it will show up in the order they were created in (i.e. Trigger 0, Trigger 1, Trigger 2, etc).

The default trigger color is red, meaning the trigger doesn't work correctly. You must have the trigger green, which can be done by having all of the conditions and effects inside of the trigger the color green. The reasons a trigger could be red:
  1. A condition or effect isn't set to any options.
  2. It's an "Activate/Deactivate" effect, and the specified trigger was deleted.
The trigger contains 6 options on the trigger itself to affect the way it works:
Name - This is for organization purposes. You can rename the trigger to something more descriptive than the default "Trigger 0" or "Trigger 1" so it will be easier to find when you have to navigate the trigger list later.

Description - All text typed in this box shows up on the Objectives list when the Objective option of the trigger is turned on and the trigger is activated.

Description Order - This changes where the trigger's Description text is located on the Objectives list. The higher the number you type is, the higher it will appear on the list.

Objective On/Off - Turn this "On" if you want the Description text to show up on the Objectives list when playing the game. Note that the Objective will only appear on the list if the Trigger is currently activated, and if you have a Condition set that the player must complete.

Trigger On/Off - If you want the trigger to be activated immediately when you start the scenario, turn this "On". Turning it "Off" will deactivate it until you use a trigger to activate it. Note that two triggers - Deactivate Trigger and Activate Trigger - will enable you to change this during gameplay.

Looping On/Off - Turning this "On" will keep the Effects of the trigger repeating until the trigger is deactivated. This will not loop the Conditions, and the Effects will not be looped until the condition is accomplished.

Conditions and Effects - The Cause and Effect System of the Editor

One of the two main parts within a trigger is that the trigger can contain a Condition that has to be accomplished before the trigger can be activated. These are also linked to the Objective option of the trigger. If you turn the Objective option "On", the Objective will be marked as complete as soon as the Condition is accomplished.

Last but not least, the second main part within a Trigger is the Effect that the Trigger enacts. These can be used in many different ways, and are what most trigger tricks are made of.

Condition/Effect Options

The condition and effects have their own options that allow you to select a unit, location, area, etc.

The Age of Kings editor presents it's triggers in a way that makes it designer-friendly, yet many of the triggers can confuse new designers. This guide will explain each type of Condition and Effect contained inside of the editor.

(Note: These all are assuming you have played the game enough to know the basic commands, and I listed down the Effects assuming that the trigger you're reading about is activated in the actual editor.)

Conditions

Bring Object to Area - Requires you to select an Object (moving object, such as a soldier) that has already been placed on the map editor and select an area for that unit to arrive at.

Bring Object to Object - Requires you to bring an Object (again, an object able to move) to another Object.

Own Objects - Requires you to own a certain amount of Objects, such as 4 Barracks buildings or 6 Longbowmen.

Own Fewer Objects - This Condition requires you to own a lower number of units than the number you select.

Objects in Area - Requires you to bring (or have) a certain amount of objects in a location you select. This location can be as large or small as you wish.

Destroy Object - Requires the selected object to be killed or destroyed by either the player, enemy, or triggers.

Capture Object - Requires you to own the selected unit.

Accumulate Attribute - Requires that the selected player will have the selected amount of resources, kills, relics, etc.

Research Technology - Requires the selected technology to be researched.

Timer - After the selected amount of time, this trigger will be activated.

Object Selected - Requires you to click on an Object that you selected while in the editor.

AI Signal - Detects a "signal" from within your AI script.

Player Defeated - Requires the player you select to be defeated.

Object Has Target - When an Object targets another object to attack them, this condition will be activated.

Object Visible - Requires the selected Object to be in the players view.

Object Not Visible - Requires the selected Object to not be in the players view.

Researching Tech - Requires the player to be in the process of researching the selected technology.

Units Garrisoned - This is activated when a certain number of units are garrisoned inside of a building.

Difficulty Level - This condition will only activated on the selected difficulty level.

Effects

Change Diplomacy - Changes a player's diplomatic stance toward another to Ally, Enemy, or Neutral.

Research Technology - Researches a technology in the game.

Send Chat - Sends a chat message to another player. This chat message will only last around 6-7 seconds no matter how long it is.

Play Sound - Plays a sound located in the Age of Empires II\Sound\scenario\ folder.

Tribute - Tributes resources to another player.

Unlock Gate - Unlocks the selected gate.

Lock Gate - Locks the selected gate.

Activate Trigger - This activates any trigger that you've already created and have deactivated.

Deactivate Trigger - This deactivates any trigger you've already created.

AI Script Goal - This lets you activate a goal from within an AI script.

Create Object - This creates any unit or building from the list except for certain Gaia units.

Task Object - This trigger allows you to command any unit you have or haven't placed to move to somewhere else on the map. If Villagers are tasked to a Resource as the location

Declare Victory - This will make whichever player you choose win the game. This is usually used as an objective trigger where if you accomplish the objective, you win the game.

Kill Object - This kills any Object you select. Because of a bug that enables buildings to have 0 HP until targeted by an enemy unit, you cannot destroy buildings with this trigger - you must use Damage Object.

Remove Object - Removes the selected objects from the area you specify.

Change View - Scrolls the screen quickly to another area of the map.

Unload - Ungarrisons units from a Ram or building.

Change Ownership - Changes the ownership of the unit's player to another player's team.

Patrol - This patrols the unit to an area, and back to their original positions (like the command).

Display Instructions - Unlike the Send Chat command, this displays on the top of the screen and for whatever amount of time you set it to. To move the text box down the screen, type in 1 or 2 (2 being the lowest, but because of the editor's limits, it can only reach the center of the screen). In the Expansion Pack, you are able to change the color of the text to whatever player color that's available in the Game. For more about text colors and the Display Instructions effect in general, visit the Display Instructions article.

Clear Instructions - This removes the Display Instructions text. Like before, you can remove text 0, 1 or 2 depending which is currently on the screen.

Freeze Unit - This sets the selected object on the Advanced Command "No Attack", making it unable to attack another object unless you command it to with the Task Object effect or you command it to attack during gameplay. Note that this object must be able to attack in order for this effect to work.

Use Advanced Buttons - This (supposedly) turns on the Advanced Commands buttons during Game Play.

Damage Object (x-pack) - This damages the units however much you type into the text box.

Place Foundation (x-pack) - Places a Building's foundation, such as when you

Change Object Name (x-pack) - Changes an Objects name.

Change Object HP (x-pack) - Changes the Object's Hit Points. You can also lower the units HP by typing in 65536 and subtract however much HP you want the unit to lose from that.

Change Object Attack (x-pack) - Changes the Object's attack if the Object is able to attack.

Stop Unit (x-pack) - This is a trigger substitute for the Stop Unit command during gameplay, and has the exact effect it promises - it will stop the unit. But this trigger doesn't always do the job if the unit that you had stopped has a reason to go, such as a King trying to garrison inside of a building, a villager that wants to build, a monk that wants a relic, or a soldier that wants to attack.
Though triggers aren't a must in a scenario, they can definitely improve it. Any questions or add-ons you have about this tutorial can be e-mailed to Aro (aro [at] heavengames [dot] com).