Trigger Basics

From HIVE
Revision as of 06:16, 21 November 2010 by DevliN (talk | contribs) (1 revision: StarEdit.net Wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A trigger is the main driving event of a Starcraft 2 UMS (Use Map Settings) map or campaign. For your map to have anything other than the basic melee rules (start with 50 minerals, 6 drones and a base), you must use them.

For an example on how to make a simple trigger, click here.

Introduction

There are four main parts to a trigger, which we will go over very briefly.

  • 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.
  • Local 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 2. These are also local to each 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.

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.

(WIP)

-Shmeeps