Ralle
Owner
- Joined
- Oct 6, 2004
- Messages
- 10,182
Introduction
This tutorial describes the difference between Events, Conditions and Actions.
I will show some examples along the way and help you to understand the effects and power of triggers.
We have many things to do, so let's get started.
To begin we must create a new blank trigger using WE’s Trigger Editor. Press F4 on your keyboard or select the lowercase “c” button on the toolbar. Now select New>Trigger from the trigger menu and…presto! A new trigger is born.
Events
Events are the functions that “trigger” your triggers.
For example, when you make a timed bomb, the event will activate the trigger when the timer reaches 0.
We can make simple events for triggers by right clicking on the event and selecting “New Event.” The Configure Event window then opens and displays Map Initialization as the default event. We’ll chose a different event for our first trigger so scroll down the list until you find Unit - Generic Unit Event and select it. The default event in this category is A Unit Dies and this is the event that we want. Notice how the word “Dies” is colored and underlined? This means that you can change the value for that field to a variety of other generic unit events. For now, let’s leave it alone and proceed.
To create a timed trigger select the event: Time - Periodic Event.
The default value for this event is two seconds. Let’s edit this value so that our trigger fires every minute. Click on the underlined and colored 2.00 and a window opens that allow us to change this value to any real number. Use the tiny arrow button or type in 60 to make the change.
For a region specific event use: Unit - Unit Enters Region.
Conditions
Conditions are present to make your trigger run only under certain conditions. In the above example, the trigger would fire when any unit owned by any player enters Region 000. Say you wanted only certain units or players to trip the trigger?
Let's just add a simple condition to our trigger to make only certain unit types operate it. Again, right click on the condition to create a new one. Since the default condition is Boolean Comparison, scroll down and select Unit Type Comparison. This applies the condition:
Another simple condition would allow only a certain player (or players) to set off the trigger:
This condition would qualify our timed trigger:
We could also add a condition like this:
Conditions are necessary for a trigger to work properly but that doesn't mean that you will be forced to use them in order to make the trigger work.
Actions
Actions are the main part of a trigger. If we take the example from before with the bomb, this will be the explosion of your bomb.
So when something triggers your event, it checks if it matches the conditions (if they exist). Then it runs your actions.
So here we have our trigger again. The one with the dying archer:
All my examples have only one event, one action and one condition. They could have an unlimited of each, like this more advanced trigger:
You could also make a trigger like this:
I hope you learned something about this subject and that it wasn't a waste of our time. I’m sure that you now realize that the question: "is it an event, a condition, or an action???" is unnecessary and you will always know just how to make a trigger. Beginning trigger editors should start simple, learn some of the many options available, and practice, practice, practice!
This tutorial describes the difference between Events, Conditions and Actions.
I will show some examples along the way and help you to understand the effects and power of triggers.
We have many things to do, so let's get started.
To begin we must create a new blank trigger using WE’s Trigger Editor. Press F4 on your keyboard or select the lowercase “c” button on the toolbar. Now select New>Trigger from the trigger menu and…presto! A new trigger is born.
-
Untitled Trigger 001
- Events
- Conditions
- Actions
Events
Events are the functions that “trigger” your triggers.
For example, when you make a timed bomb, the event will activate the trigger when the timer reaches 0.
We can make simple events for triggers by right clicking on the event and selecting “New Event.” The Configure Event window then opens and displays Map Initialization as the default event. We’ll chose a different event for our first trigger so scroll down the list until you find Unit - Generic Unit Event and select it. The default event in this category is A Unit Dies and this is the event that we want. Notice how the word “Dies” is colored and underlined? This means that you can change the value for that field to a variety of other generic unit events. For now, let’s leave it alone and proceed.
-
Unit Dies
-
Events
- Unit - A unit Dies
- Conditions
- Actions
-
Events
To create a timed trigger select the event: Time - Periodic Event.
The default value for this event is two seconds. Let’s edit this value so that our trigger fires every minute. Click on the underlined and colored 2.00 and a window opens that allow us to change this value to any real number. Use the tiny arrow button or type in 60 to make the change.
-
Timed Trigger 001
-
Events
- Time - Every 60.00 seconds of game time
- Conditions
- Actions
-
Events
For a region specific event use: Unit - Unit Enters Region.
-
Unit Enters Region
-
Events
- Unit - A unit enters Region 000 <gen>
- Conditions
- Actions
-
Events
Conditions
Conditions are present to make your trigger run only under certain conditions. In the above example, the trigger would fire when any unit owned by any player enters Region 000. Say you wanted only certain units or players to trip the trigger?
Let's just add a simple condition to our trigger to make only certain unit types operate it. Again, right click on the condition to create a new one. Since the default condition is Boolean Comparison, scroll down and select Unit Type Comparison. This applies the condition:
-
Unit Enters Region
-
Events
- Unit - A unit enters Region 000 <gen>
-
Conditions
- (Unit-type of (Triggering unit)) Equal to Footman
- Actions
-
Events
Another simple condition would allow only a certain player (or players) to set off the trigger:
-
Unit Enters Region
-
Events
- Unit - A unit enters Region 000 <gen>
-
Conditions
- (Owner of (Triggering unit)) Equal to Player 1 (Red)
- Actions
-
Events
This condition would qualify our timed trigger:
We could also add a condition like this:
-
Unit Dies
-
Events
- Unit - A unit Dies
-
Conditions
- (Unit-type of (Dying Unit)) Equal to Archer
- Actions
-
Events
Conditions are necessary for a trigger to work properly but that doesn't mean that you will be forced to use them in order to make the trigger work.
Actions
Actions are the main part of a trigger. If we take the example from before with the bomb, this will be the explosion of your bomb.
So when something triggers your event, it checks if it matches the conditions (if they exist). Then it runs your actions.
So here we have our trigger again. The one with the dying archer:
-
Unit Enters Region
-
Events
- Unit - A unit Dies
-
Conditions
- (Unit-type of (Entering unit)) Equal to Archer
-
Actions
- Unit - Create 2 Archer for (Owner of (Dying unit)) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
-
Events
-
Unit Enters Region
-
Events
- Unit - A unit enters Region 000 <gen>
-
Conditions
- (Unit-type of (Entering unit)) Equal to Footman
-
Actions
- Unit - Kill (Entering unit)
-
Events
All my examples have only one event, one action and one condition. They could have an unlimited of each, like this more advanced trigger:
-
Unit Enters Region
-
Events
- Unit - A unit enters Region 000 <gen>
-
Conditions
- (Unit-type of (Entering unit)) Equal to Footman
- (Owner of (Entering unit)) Equal to Player 3 (Teal)
-
Actions
- Unit - Kill (Entering unit)
-
Events
You could also make a trigger like this:
-
Unit Dies
-
Events
- Unit - A unit Dies
-
Conditions
- (Unit-type of (Dying unit)) Equal to Archer
-
Actions
- Unit - Create 2 Archer for (Owner of (Dying unit)) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
- Unit - Change ownership of (Last created unit) to (Owner of (Killing unit)) and Change color
-
Events
I hope you learned something about this subject and that it wasn't a waste of our time. I’m sure that you now realize that the question: "is it an event, a condition, or an action???" is unnecessary and you will always know just how to make a trigger. Beginning trigger editors should start simple, learn some of the many options available, and practice, practice, practice!
Last edited by a moderator: