HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Basics of Triggers

12-29-2006, 11:32 PM#1
Archian
Note, that the tutorial is still in progress. Feel free to post comments & suggestions for improval :)

Basics of Triggers
By Archian

My ten-year-old cousin has just started warcraft III modding, and has begun experimenting with the Trigger Editor.
I promised that I would make a little tutorial relating to how to make some *very* basic, but useful triggers for custom maps.
This tutorial is also meant as a source of information that may encourage newcomer's to start triggering and from there, develop their knowlege.
So when you're done reading this tutorial, go inside the World Editor and do some experimenting yourself :)
Click the images for larger versions.

The "target group" of this tutorial is of course; beginners.

Table of Content


Introduction to The World Editors' "Trigger Editor"
The trigger editor is where the map script is written, either in GUI triggers or directly in JASS.
The map script controls any in-game events not dictated by the user. Triggers are essential for creating maps with complicated goals and atmosphere.

Trigger Editor: (Menu Bar\Module\Trigger Editor) Click image for larger version

Name:	TriggerEditor.jpg
Views:	505
Size:	22.8 KB
ID:	18257

Zoom (requires log in)
(From left to right: Variables... (Ctrl+B), New Category (Ctrl+G), New Trigger (Ctrl+T), New Trigger Comment (Ctrl+M), New Event (Ctrl+E), New Condition (Ctrl+D), New Action (Ctrl+R).

The Trigger Editor:
Button:Functions:
Click image for larger version

Name:	Variables....jpg
Views:	503
Size:	23.3 KB
ID:	18261Variable Editor ~ MrApple's Beginner's Guide to Variables.
Click image for larger version

Name:	NewCategory.jpg
Views:	498
Size:	22.7 KB
ID:	18250Creates a new category for triggers; useful in custom maps with many triggers to keep a better overview.
Click image for larger version

Name:	NewTrigger.jpg
Views:	497
Size:	22.4 KB
ID:	18253Creates a new trigger.
Click image for larger version

Name:	TriggerComment.jpg
Views:	496
Size:	22.8 KB
ID:	18256A "comment category" which you can use for "headlines" under (for example) categories so each trigger "group" is kept well organized.
Click image for larger version

Name:	NewEvent.jpg
Views:	502
Size:	22.7 KB
ID:	18252Creates a new event for a trigger.
Click image for larger version

Name:	NewCondition.jpg
Views:	496
Size:	22.8 KB
ID:	18251Creates a new condition for a trigger.
Click image for larger version

Name:	NewAction.jpg
Views:	495
Size:	22.4 KB
ID:	18249Creates a new action for a trigger.
Of course, you can just right-click on the list, a trigger or a category to create the above mentioned.

Click image for larger version

Name:	RightClick.jpg
Views:	108
Size:	73.1 KB
ID:	18254

GUI (Graphical User Interface)
A graphical user interface, is a particular case of user interface for interacting with a computer which employs graphical images and widgets in addition to text to represent the information and actions available to the user.
Usually the actions are performed through direct manipulation of the graphical elements.

Trigger Functions: "ECA" (Events, Conditions & Actions)

Note; each individual trigger can be created using various of countless (describing many) methods.
You will most likely come to discover that as you gain more experience.

There are 3 "categories" of trigger functions (Events, Conditions & Actions):
Trigger:
Trigger Functions
Events
Conditions
Actions
Notice, that these could be compared with the "cause and effect" theory. The cause and effect (Event and Action) with an optional "Condition" included.
When the event(s) occur, all conditions are met, the action(s) will take place.

Click image for larger version

Name:	Events.gif
Views:	495
Size:	119 Bytes
ID:	18246 Events
A trigger will start when any of the events listed occur.
Note; you can "run" a trigger from another trigger without having those events occuring.

Click image for larger version

Name:	Condition.gif
Views:	491
Size:	126 Bytes
ID:	18245 Conditions
Conditions are specific requirements which the trigger must observe.
It cannot perform it's actions unless all the condition requirements have been covered.
Note; that you can have 'And' / 'Or' conditions as well. Triggers that are run from another trigger have the option to ignore these conditions.

Click image for larger version

Name:	Actions.gif
Views:	496
Size:	115 Bytes
ID:	18243 Actions
If the event occurs, all conditions have been met, then this is the action(s) that the trigger will perform.
Note; that you can may 'Run' other triggers or turn other triggers OFF or ON as well.

Note; You may put any new triggers in the original Melee Initialization category created by the world editor, but you are not obligated to.
Categories have no influence on the functionality of the trigger, so it doesn't matter which order you put them in.

Enable, Initially On & Trigger Comments
Notice that there are 3 fields at the top of each trigger (highlight'ed below).
Click image for larger version

Name:	TriggerFields.jpg
Views:	78
Size:	48.5 KB
ID:	18259
  • Enabled - Determines whether or not the trigger is enabled in your map. If 'disabled', the trigger has no function.
  • Initially On - Triggers can be turned ON and OFF. When checked, the trigger will initially be ON when the game begins.
  • Trigger Comment - Is a text field area where you can add any comments regarding the specific trigger. Keep in mind that it has no impact on functionality.

Trigger Examples
Below is shown some basic trigger samples.

Opening A Gate #1 Click image for larger version

Name:	Events.gif
Views:	495
Size:	119 Bytes
ID:	18246Click image for larger version

Name:	Actions.gif
Views:	496
Size:	115 Bytes
ID:	18243
In this example, I will demonstrate a way to open a Gate without any condition(s).
Here's the trigger i'm using:
Trigger:
Gate
Collapse Events
Destructible - Lever 0039 <gen> dies
Conditions
Collapse Actions
Destructible - Open Gate (Horizontal) 0038 <gen>
Click image for larger version

Name:	Gate.jpg
Views:	328
Size:	392.1 KB
ID:	18248

Opening A Gate #2 Click image for larger version

Name:	Events.gif
Views:	495
Size:	119 Bytes
ID:	18246Click image for larger version

Name:	Condition.gif
Views:	491
Size:	126 Bytes
ID:	18245Click image for larger version

Name:	Actions.gif
Views:	496
Size:	115 Bytes
ID:	18243
In this example, I shall demonstrate a way to open a Gate with a condition.
Here's the trigger:
Trigger:
Gate
Collapse Events
Destructible - Lever 0039 <gen> dies
Collapse Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Collapse Actions
Destructible - Open Gate (Horizontal) 0038 <gen>
Click image for larger version

Name:	Gate2.jpg
Views:	274
Size:	314.3 KB
ID:	18247

The Sunken Brigde Click image for larger version

Name:	Events.gif
Views:	495
Size:	119 Bytes
ID:	18246Click image for larger version

Name:	Condition.gif
Views:	491
Size:	126 Bytes
ID:	18245Click image for larger version

Name:	Actions.gif
Views:	496
Size:	115 Bytes
ID:	18243
Here's the trigger i'm using for this demonstration:
Trigger:
Sunken Brigde
Collapse Events
Unit - A unit enters Region 000 <gen>
Collapse Conditions
(Owner of (Entering unit)) Equal to Player 1 (Red)
Collapse Actions
Destructible - Resurrect Short Natural Bridge (Vertical) 0000 <gen> with 2500.00 life and Show birth animation
Animation - Change Short Natural Bridge (Vertical) 0000 <gen>'s animation speed to 95.00% of its original speed
Trigger - Turn off (This trigger)
Click image for larger version

Name:	showregion.jpg
Views:	383
Size:	231.8 KB
ID:	18255

Click image for larger version

Name:	Brigde.jpg
Views:	341
Size:	381.6 KB
ID:	18244

The Specific Key
Coming soon...

Links


To be continued »
Attached Images
File type: gifActions.gif (115 bytes)
File type: jpgBrigde.jpg (381.6 KB)
File type: gifCondition.gif (126 bytes)
File type: gifEvents.gif (119 bytes)
File type: jpgGate2.jpg (314.3 KB)
File type: jpgGate.jpg (392.1 KB)
File type: jpgNewAction.jpg (22.4 KB)
File type: jpgNewCategory.jpg (22.7 KB)
File type: jpgNewCondition.jpg (22.8 KB)
File type: jpgNewEvent.jpg (22.7 KB)
File type: jpgNewTrigger.jpg (22.4 KB)
File type: jpgRightClick.jpg (73.1 KB)
File type: jpgshowregion.jpg (231.8 KB)
File type: jpgTriggerComment.jpg (22.8 KB)
File type: jpgTriggerEditor.jpg (22.8 KB)
File type: jpgTriggerFields.jpg (48.5 KB)
File type: jpgTriggerModules.jpg (32.9 KB)
File type: jpgVariables....jpg (23.3 KB)
12-29-2006, 11:57 PM#2
Orc_Tamer
Very cool and useful
12-30-2006, 01:07 PM#3
ragingspeedhorn
Very nice, there is a few grammar errors here and there though, such as "Ofcause" and "warcraft III modding" should be with capital letters, no?
12-30-2006, 01:08 PM#4
Bob27
If I were you I wouldn't link to another tutorial, like you did with the variables. I would try and make it so that the reader didn't have to leave the page to learn everything. The only thing I think you should link to is like at the bottom where your linking to the tutorial forums and the region tutorial.

Apart from that it seamed like a good start, good work :)
12-30-2006, 02:00 PM#5
PitzerMike
Very good for beginners.
And i personally like how you're linking to other tutorials.
No need to reinvent the wheel.

*approved*
12-31-2006, 08:32 AM#6
Murder X
Very nice I have to say. I wish I had this tutorial when I learned triggering a few years ago...

But one thing I had to laught: "warcraft modding".
I don't think we can talk about modding when we just create some gui triggers...

But: nice tut

gl & hf