As my 1000th post, I've decided to write a general guide to Triggers. (Mainly for multiplayer but many of these concepts will also apply to Single-Player. I will note it if it does not apply to single player.)
A side note: I have Reyk's Editor Mod and I highly recommend it. If you choose not to download and install it, my pictures of menus may look slightly different than your results.
Triggers are the brain of a scenario. The map and design make your map look nice, but trigger make it run.
Without triggers, you have a map and perhaps a few handfuls of units. There is no way to actually win or be defeated without triggers.
Let's start off by learning the basics of a trigger. The first thing we must do is find the trigger menu.
The main trigger menu will be under Triggers -> Triggers as show in the picture. We'll get to groups and armies later.
This is the main trigger UI:
Now that's a lot of buttons! Here's a list of what the ones in the Trigger Editor area do:
Insert Inserts a new trigger.
Del Deletes the selected trigger.
Copy Copies the selected trigger.
Conditions View and edit conditions of the selected trigger.
Effects View and edit effects of the selected trigger.
Alle Trigger kopieren Copy all triggers [Reyk's Editor Only.]
Alle Trigger laden Paste all triggers (Warning: This will OVERWRITE all triggers currently in the scenario.) [Reyk's Editor Only.]
The area beside it is the area in which you will actually edit a trigger. Let's insert a trigger, and then learn this next area.
This is what I like to call the Trigger Overview panel.
It shows a general overview of the trigger and lets you change a few things -- the name, its priority, and its rules (Active, Loop, and/or Run Immediately). It also shows a list of all the conditions and effects.
As you can see, when you insert a trigger is is called 'Trigger_x' (with x being a number). Its default rules are active, its priority normal, and it has the Always Condition and the SetIdleProcessing Effect.
Let's have a list of what the buttons, boxes, and entry fields here do.
Name Change the trigger's name
Active Set a trigger to active, so it will run. Inactive triggers will not run unless active.
Loop A looped trigger will run repeatedly.
Run Immediatelty A trigger set to Run Immediatly will run as soon as the game starts (when also active) -- without this, it will take a few seconds to run.
Priority Set the triggers priority. Triggers with the highest priorty will run before triggers that have lower priority.
Conditions are what causes the trigger to execute its effects. While an active trigger starts at the beginning of the game, its effects will not be executed until its conditions are fufilled.
Conditions are checked in the order they are placed. If an always is placed before a timer, it will check always to make sure it is true before checking the timer. Otherwise, it would check the timer before checking Always. (Note: Always will... always be true and there is no reason to have it paired with other conditions.
The Conditions panel has a few buttons:
Insert Inserts a new condition.
Delete Deletes the selected condition.
Copy Copies the selected condition.
Or Makes it so only one of many conditions must be fufilled for the effects to be executed. By default ALL conditions must be fufilled.
Not Not. Makes it so when conditions are not fufilled the effects are executed. Not also inverts the Or button, so when or is not checked if only one condition is NOT true, then it will run. When or is checked, all conditions must be not true.
The dropdown menu that says 'Always' will allow you to select different conditions.
Also, when you have a condition other than Always selected, there may be parameters that you can fill out to make the condition more customizable.
Here are some parameters:
I'll talk more about parameters in the Effects section.
Effects are the meat of a trigger - they make it actually do something. The effects are run when the conditions are fufilled. Effects of a trigger will only run once unless it is looped or fired. (I'll discuss firing later.)
Effects, like conditions, run in the order that they are placed. The effects menu will look just like the Conditions Menu.
We're going to learn about these by just using some, so, let's finally make our first trigger.
Because I'm also a programmer, we're going to start out with the classic -- Hello World. What we want to do is make a trigger that makes one of the Players send a chat containing the words "Hello World!".
First, we'll insert a trigger (if you haven't already). You can rename the trigger to Hello_World, if you like. Since, for now, we want this trigger ot run instantly, we'll leave the condition as Always. Moving on to your effects, the one you want is "Send Chat".
We just have two parameters for Send Chat. One is titled 'From Player', while the other is titled 'Message'. We can leave 'From Player' as 1 (so it looks like Player 1 is saying the contents of the 'Message' box) for now, but we'll change the message from 'default' to 'Hello World!' (without the quotes).
Your Effect should look like this:
And the Trigger Overview should look like this:
(Note: The trigger name can be anything you want, as long as it isn't the same as another trigger and doesn't contain anything other than letters, numbers, and underscores ( _ ). The name has no effect on how the trigger runs.)
Now let's Playtest and see the magic!
And here it is:
Quest Vars [Section Added March 8, 2011]
QVs (Quest Vars) are a way to save numbers in your scenario. QVs can be set, randomized, and modified. They can be used to keep track of Player Stats, Unit Stats, or really anything that is a number. They are saved from trigger to trigger, and are often used in randomization -- a thing that cannot otherwise be achieved in a scenario.
QVs can be constructed in a way to create complex formulas and do other math.
The default triggers that come with the game to deal with QVs are 'Quest Var Set', 'Quest Var Modify', 'Quest Var Modify 2', 'Quest Var Copy', 'Quest Var Randomize', and 'Quest Var Check'.
QV Conditions and Effects
Quest Var Set: Sets a QV. It overwrites anything that was already in the QV of that name.
Quest Var Modify: Modifies a QV. It adds to, subtracts from, multiplies, or divides a QV. Keep in mind that the symbol for multiplication is an asterisk ( * ) and the symbol for division is a forward slash ( / ).
Quest Var Modify 2: Modifies a QV by another QV. It lets you add/subtract/multiply/divide two QVs together. It's good to know that this only affects the first QV though, the QV that you are modifying it by is not changed.
Quest Var Randomize: Randomizes a QV. It overwrites anything previously in that QV. This is a very useful trigger. When paired with Quest Var Check, it can be very useful in making random events.
Quest Var Check: [Condition] Checks a QV based on the given parameters. Can be Greater Than ( > ), Less Than ( < ), Greater Than or Equal To ( >= ), Less Than or Equal To ( <= ), or Equal To ( == ).
Quest Var Copy: Copies one QV to another. The original is not affected.
There are countless custom QV triggers that have many uses. I'll add descriptions of some of the most important in later editions of this tutorial.
This tutorial is obviously not finished, but now that you know the very basics, you can screw around with different effects and conditions to see what you can do!
Future additions will list and explain important conditions and effects, illustrate triggers that are necessary to have in all scenarios, explain Quest Vars & Randomization, explain more complex trigger sequences, and talk about cutsom triggers.
Until then, I'm open to questions & comments, and I wish you Good Luck if you are a new designer!