Difference between revisions of "Triggers"
MarkOfCain (talk | contribs) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Unlike the [[Data Editor]] which determines the general behavior of the game elements, the triggers dictate the events and actions that occur at specific points within a Starcraft II map. By setting an appropriate event, some acquirable conditions, and a few actions, you can easily make anything change or happen. | |
− | == Trigger | + | == Trigger Module == |
The first thing you need to know about the trigger editor, is how to open the window. There are a couple ways to do this. | The first thing you need to know about the trigger editor, is how to open the window. There are a couple ways to do this. | ||
*Pushing '''F6''' will open the window for you. | *Pushing '''F6''' will open the window for you. | ||
Line 13: | Line 13: | ||
[[File:Trigger.jpg|350px|thumb|Dark_Marine's (Riney) trigger window from Zombies: The Escape]] | [[File:Trigger.jpg|350px|thumb|Dark_Marine's (Riney) trigger window from Zombies: The Escape]] | ||
− | == | + | == Elements == |
There are four main parts to a trigger: | There are four main parts to a trigger: | ||
− | * '''Events:''' An event is what must happen before a trigger can run. You'll find plenty of these, such as "A unit enters an area", "A unit is attacked/Killed", "A Player pressed a Key", and plenty of other. What this means is that any time this event occurs, this trigger will run and perform what it was written to do. | + | * '''[[Events]]:''' An event is what must happen before a trigger can run. You'll find plenty of these, such as "A unit enters an area", "A unit is attacked/Killed", "A Player pressed a Key", and plenty of other. What this means is that any time this event occurs, this trigger will run and perform what it was written to do. |
− | * '''Conditions:''' It wouldn't be sensible to have all types of one event always run a trigger, even if we don't want it to. For instance, we may want a trigger that only runs when a player has a unit in an area and that unit is killed. If we do either event, it wont check to see if the other one is met though. This is why conditions were made. They are simple comparative statements that must be true to let the trigger continue to run. In this case, we could say to run the trigger on the event that a unit is killed, and the condition that the unit is in the specified area. | + | * '''[[Conditions]]:''' It wouldn't be sensible to have all types of one event always run a trigger, even if we don't want it to. For instance, we may want a trigger that only runs when a player has a unit in an area and that unit is killed. If we do either event, it wont check to see if the other one is met though. This is why conditions were made. They are simple comparative statements that must be true to let the trigger continue to run. In this case, we could say to run the trigger on the event that a unit is killed, and the condition that the unit is in the specified area. |
− | * ''' | + | * '''[[Variables]]:''' Remember back to algebra class, when we would say that X is some variable for an unknown value? This is the same concept, except that we specify it's contents, which can range from numbers to units to triggers to... just about anything! In fact, there are about 70 different types of variables, all for some sort of data in StarCraft II. These can be defined to be global variables outside of the triggers, accesable by all triggers, or local variables within a trigger, meaning each one can only be used inside of whichever trigger it was created. |
− | * '''Actions:''' Actions are what are performed assuming both the event runs the trigger and the conditions are met to allow the trigger to continue. These can be anything from doing actions with units, with resources, with the camera, the game, the environment, you name it. Pretty much anything in the game you can think of can be changed with these actions. | + | * '''[[Actions]]:''' Actions are what are performed assuming both the event runs the trigger and the conditions are met to allow the trigger to continue. These can be anything from doing actions with units, with resources, with the camera, the game, the environment, you name it. Pretty much anything in the game you can think of can be changed with these actions. |
+ | * '''Comments:''' Comments are inconsequential to the function of the map, and only serve as a reminder or description of the trigger. | ||
Triggers are run in the given order, Events -> Conditions -> Actions. An event must start the trigger, it's conditions must pass, and then the actions can take place. | Triggers are run in the given order, Events -> Conditions -> Actions. An event must start the trigger, it's conditions must pass, and then the actions can take place. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Trigger Window Hotkeys == | == Trigger Window Hotkeys == | ||
Line 45: | Line 30: | ||
*'''Ctrl + B''' creates a new variable. | *'''Ctrl + B''' creates a new variable. | ||
*'''Ctrl + W''' creates a copy of the selected 'type' if on the '''left menu'''. For example, if you currently have a Variable selected, it'll create a new Var. It does the same for Folders, Triggers, etc. If in the '''right menu''', it'll either create a new Event, Condition, Variable or Action based on the field you have selected. This is a very useful hotkey, as you can see. | *'''Ctrl + W''' creates a copy of the selected 'type' if on the '''left menu'''. For example, if you currently have a Variable selected, it'll create a new Var. It does the same for Folders, Triggers, etc. If in the '''right menu''', it'll either create a new Event, Condition, Variable or Action based on the field you have selected. This is a very useful hotkey, as you can see. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==See Also== | ==See Also== | ||
*[[Starter_Guide#Triggers_.28F6.29|Some useful links]] | *[[Starter_Guide#Triggers_.28F6.29|Some useful links]] | ||
+ | *[[Variables]] | ||
[[Category:StarCraft II]] | [[Category:StarCraft II]] | ||
[[Category:Triggers]] | [[Category:Triggers]] | ||
[[Category:Reference]] | [[Category:Reference]] |
Latest revision as of 02:31, 25 December 2012
Unlike the Data Editor which determines the general behavior of the game elements, the triggers dictate the events and actions that occur at specific points within a Starcraft II map. By setting an appropriate event, some acquirable conditions, and a few actions, you can easily make anything change or happen.
Trigger Module
The first thing you need to know about the trigger editor, is how to open the window. There are a couple ways to do this.
- Pushing F6 will open the window for you.
- Going to Modules > Triggers
Now that the trigger window is open, you'll see quite a few areas.
The picture on the right could be what your trigger window may look like, depending on how far into a project you are.
Elements
There are four main parts to a trigger:
- Events: An event is what must happen before a trigger can run. You'll find plenty of these, such as "A unit enters an area", "A unit is attacked/Killed", "A Player pressed a Key", and plenty of other. What this means is that any time this event occurs, this trigger will run and perform what it was written to do.
- Conditions: It wouldn't be sensible to have all types of one event always run a trigger, even if we don't want it to. For instance, we may want a trigger that only runs when a player has a unit in an area and that unit is killed. If we do either event, it wont check to see if the other one is met though. This is why conditions were made. They are simple comparative statements that must be true to let the trigger continue to run. In this case, we could say to run the trigger on the event that a unit is killed, and the condition that the unit is in the specified area.
- Variables: Remember back to algebra class, when we would say that X is some variable for an unknown value? This is the same concept, except that we specify it's contents, which can range from numbers to units to triggers to... just about anything! In fact, there are about 70 different types of variables, all for some sort of data in StarCraft II. These can be defined to be global variables outside of the triggers, accesable by all triggers, or local variables within a trigger, meaning each one can only be used inside of whichever trigger it was created.
- Actions: Actions are what are performed assuming both the event runs the trigger and the conditions are met to allow the trigger to continue. These can be anything from doing actions with units, with resources, with the camera, the game, the environment, you name it. Pretty much anything in the game you can think of can be changed with these actions.
- Comments: Comments are inconsequential to the function of the map, and only serve as a reminder or description of the trigger.
Triggers are run in the given order, Events -> Conditions -> Actions. An event must start the trigger, it's conditions must pass, and then the actions can take place.
Trigger Window Hotkeys
- Ctrl + T creates a new trigger.
- Ctrl + E creates a new event.
- Ctrl + K creates a new condition.
- Ctrl + R creates a new action.
- Ctrl + B creates a new variable.
- Ctrl + W creates a copy of the selected 'type' if on the left menu. For example, if you currently have a Variable selected, it'll create a new Var. It does the same for Folders, Triggers, etc. If in the right menu, it'll either create a new Event, Condition, Variable or Action based on the field you have selected. This is a very useful hotkey, as you can see.