• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Basics of a Trigger

Basics of a Trigger
By Kidd|WhiteHeaven|

Contents
What are Triggers?
How do we make a trigger?
How can a Trigger Activate?
What if the trigger doesn't/does have a event if its off?
How come a player won't leave since his unit died?
I know how to do that now, but how do the conditions work?
I kinda know the If/Then/Else function, but I still dont get why some functions have the "Matching Condition" function?



What are Triggers?
Triggers are functions started by Events that go to the Conditions then to the Actions. As like the Map Initialization trigger you ALWAYS find when you open the Trigger Editor in the World Editor.

How do we make a trigger?
To make a trigger, you either click on the button near the other buttons up top, or right click in the trigger panel(left panel) and select "New Trigger", if it says that. Then get working on a trigger.

How can a trigger activate?
As i said in What Are Triggers, triggers are started by events. Events is the MAIN thing to make a trigger work, If there if no event, then it will not work. For Instance,
  • Events
  • Map Initialization
  • Conditions
  • Actions
  • Unit - Make (Footman 021) Invulnerable
That would make the footman Invulnerable

What if the trigger doesn't/does have an event and its off?
Good Question. Triggers that DONT/DO have events but are off means that they will be on after another trigger finishes and has the "Trigger - Turn on (trigger)" function. For Instance, Here is a Trigger that is on and has the trigger turn on (trigger) function:
  • Events
  • Unit - A unit dies
  • Conditions
  • Actions
  • Game - Display Text to All Players with text HAHAHAHAHAHHAHA! YOU LOSE!!!!
  • Trigger - Turn on (Lost)
Now here is the Lost trigger:
  • Events
  • Conditions
  • Player Group - Pick all players in LOSERS and do Game - Defeat (Picked Player) with Message Wow you suck! Seriously!
But those triggering functions are not put in correctly. Read the next section why.

How come the player wont leave since his unit died?
Because he wasn't added to the player group LOSERS. To make him leave, you must do this before you turn on the Lost trigger. This belongs in the trigger that turns on Lost.
  • Events
  • Unit - A unit died
  • Conditions
  • Actions
  • Game - Display text to All Players with text HAHAHAHAHHAHA YOU LOSE!!
  • Player Group - Add (Owner of (Triggering Unit)) to LOSERS
  • Trigger - Turn on Lose
And to make sure it REALLY works, you need to make the LOSERS player group.
I know how to do that now, but how does the conditions work?
The conditions work only if it is true. Conditions make what will happen in a trigger be more SPECIFIC. Heres one condition function in the triggers:
  • (Triggering Unit) is A Hero) equal to True
That is what a condition trigger does. Use IF only you need it for something. One more thing, Condition triggers are also used in the Actions by another trigger. That trigger FUNCTION is called "If/Then/Else(Multiple actions or not)" That uses conditions if they are true, activates the Then actions. But if the conditions are not true, then it will activate the Else actions.

I kinda get the If/Then/Else trigger function, but i still dont get why there are some functions that uses the "Matching Condition" function
That is also somehow like If/Then/Else, but much different. And its not a function(to what im just ganna say,) Its a sub-function. Sub-functions are like functions, but controls what the function does. Take the hero level function for example,
  • Hero - Set (Triggering Unit) to Level 10, hide leveling graphics
The (Triggering Unit), the #10, and the hide are simply sub-functions in the trigger. They are the controllers of the function "Hero - Set Level", like any other function.

This is all for now. If this has helped you, then comment on if this will be approved or not. Thank you for reading!


~Kidd|WhiteHeaven|
 
Last edited:
Level 11
Joined
Oct 13, 2005
Messages
233
The tutorial so far doesn't seem to have enough content I think. You really didn't seem to cover events as far as needed. I didn't see conditions being discusses at all. Is this tutorial still in progress? It sure looks like it is from my point of view.

Good Question. Triggers that DONT/DO have events but are off means that they will be on after another trigger finishes and has the "Trigger - Turn on (trigger)" function. For Instance, Here is a Trigger that is on and has the trigger turn on (trigger) function:

There are a few parts I'd like to point out in this. Triggers don't have to finish before enabling another trigger. You simply need to use the "Trigger - Turn on (trigger)" function to do so as you said. I think you should go over why triggers are disabled before explaining how to enable them.

Because he wasn't added to the player group LOSERS. To make him leave, you must do this before you turn on the Lost trigger. This belongs in the trigger that turns on Lost.

You also forgot to mention that simply enabling a trigger won't cause it to run. To make it run, you will have to execute the trigger as well (if it has no event).

After covering events, conditions, and actions more in-depth, I think you will also need to give more examples as well. People will be able to understand more if they see how to do many things commonly seen in games.

Good luck with the tutorial.
 
Level 32
Joined
Oct 23, 2006
Messages
5,291
The Hive already has an introductory trigger tutorial: Basic Triggering

Since this submission covers much of the same material it can not be approved. A more advanced/detailed/specific tutorial COULD be included, providing that it described means or methods that we do not presently have in our archives.

~ Thread moved to Graveyard.
 
Top