What are triggers?
When you want to make things happen in your warcraft III map like quests or cutscene’s you will need triggers. Triggers are a easy to use programming tool that allows you to trigger events ingame.
A trigger is made out of 3 parts. Event, Condition and Action. You need a Event to start a trigger and if the conditions are met you can preform the action.
If you look at the image on the right you see that i made a trigger. This trigger’s event gets triggered after 5 seconds and then checks the condition hero is alive. If the hero is indeed alive the action shows you a message confirming that the hero is alive. This can also be used to make cutscenes or a quest objective.
Event
A event is what must happen before the trigger runs. If you have no event the trigger will never run. A event can trigger when a unit dies or after a certain time. You can also use more than 1 event if you want the trigger to run multiple times. For example you are defeated after 30 minutes or when your hero dies. But beware that the event will happen every time the event is triggered. When you use a event like unit enters region. It will happen every time a unit enters that region. You can close a trigger with a action to fix that but more on that later.
Condition
You may have a event but before the actions will run you must pass the conditions. Conditions are optional and a trigger will work without them just fine. But it can come in handy if you have a defeat condition that should only work if something else happens. For example if you have two hero’s and they both die you lose. But what if one dies? You can use a if unit dies event but then the trigger will run even if one hero is still alive. Therefor we need a condition. The condition can check or the other hero is alive. If the other hero is dead you can trigger the actions but if the other hero is alive the trigger won’t run.
Action
Once the Event has happened and the conditions are met the actions will run. The actions are the thing that actually happen when you run the trigger. This can be a cutscene or a Quest but also spawning a unit or destroy/kill one. For example if you kill a enemy hero you will get a small cutscene or you completed the quest. You can also use special effects like a question mark above a unit or change the weather. You can also close a trigger with the turn off trigger action. This will prevent the trigger from running again. It is best if you place this action in the trigger before the other actions. Otherwise you have the risk that a cutscene will start while you are already in it.