# TutorialGUI - Triggering for Dummies (the basics)

#### GFreak45

##### I didnt slap you, i high 5'd your face.
Prerequisits:
• None

Alright so there are a few things we are going to look at:
• Variables
• Events
• Conditions
• and Actions

Variables

Alright, essentially a variable is something that stores information, there are many types of information that they can store but every variable has a defined type. IE: a point variable can not store a unit, but a unit variable can. For example, we are going to use an action to save a variable of the position of a unit every time it is damaged.
Trigger:
• Example
• Events
• Any unit takes fatal or non-fatal damage
• Local Variables
• Point &lt; no point &gt;
• Conditions
• Actions
• Set Point = position of triggering unit

this saves the variable: Point, as the position of the unit that was last damaged when it was damaged. Now we will go over a few different parts of variables:
• Indexes/Arrays
• Constants
• Global Variables
• Local Variables

Indexes/Arrays:
An array variable is essentially a variable with multiple instances to it (or it can save multiple pieces of information), array variables can have a max array set by you in the editor, now this array includes 0 so if you are using it to get a player number or something of that sort it will not work if your player number becomes equal to the max array (the actual arrays for the variable are 0 through max - 1) a variable would look like this in your editor if it has an array: variable[array]. Arrays are capable of being multi-dimensional (up to 4 dimensions) like this: variable[dimension 1][dimension 2][dimension 3]. Each of these dimensions is refered to as an index and can only be defined by an integer, for example: variable[1] works, but variable[a] doesn't.

Constants:
A constant is the only type of variable that can not be an array. It is a variable that can not be set by actions because it is, as the name says, constant. It remains the same value throughout the entire game, but what it stays can be set by changing the default value. These are mainly used for systems that have edit-able options, so that when a player copies the system into their map, they can change a constant like a setting.

Global Variables:
These are variables that can simply be used in any trigger or to keep information throughout the game, which is important, because the next type can not do this.

Local Variables:
These are variables that are used only in the trigger that they are defined in. Essentially these are for saving information throughout a trigger without it overlapping when the trigger fires again or another trigger tries to use the variable. Every time the trigger that uses them is finished the variable is destroyed and recycled for use in that trigger again.

Events

Events are the part of a trigger that causes it to run. There are a wide variety of events ranging from a specific game time or real time, all the way to a unit casting an ability or a unit dying. You can have multiple events in a trigger and it will run off of any of them. When you have an event firing off a unit, player, or some other type of object in game you can use Triggering X (triggering unit, triggering player) to get that specific unit or player that caused the event to happen. There are also other types of event responses, like Damaging Unit (used when the event is, a unit takes damage), I am going to create another tutorial later about event responses and more complex events, even adding events to a trigger.

Trigger:
• Example
• Events
• A unit Dies &lt;-- this fires when any unit dies
• Map Initialization &lt;-- this fires 1 time at the start of the map
• A player types OMG! as an exact match &lt;-- this fires when a player types OMG!
• Local Variables
• Conditions
• Actions

Conditions

Conditions are essentially a requirement that must be fulfilled before the actions can begin (IE an event is fired where a unit takes damage, but you have a condition that they are in a specific region, if they are not, the actions will not fire). These conditions can require many many different things, ranging from a requirement that a variable is equal to something specific all the way to a unit-type requirement. Conditions can also include Or/And conditions, an OR condition is a list of conditions requiring that 1 of the conditions listed is fulfilled, AND conditions require that all listed conditions are full filled just like a normal condition section of a trigger, but they can be used inside OR conditions

Trigger:
• Example
• Events
• Any unit takes damage
• Local Variables
• Conditions
• Owner of triggering unit (!=) Player 15 &lt;--- this requires that the owner of the unit IS NOT player 15, or neutral hostile i believe, (!=) = not equal to, (==) = equal to, (&lt;=) = less than or equal to, (&gt;=) = greater than or equal to
• Or, any of the conditions are true &lt;--- one of the conditions in this and all of the conditions not in this are required
• Damage Taken (&gt;) 1.00
• BooleanVariable (==) true &lt;--- this is a variable you set in another trigger
• And, all of the conditions are true &lt;--- this requires that a set of conditions are true for this condition to be fulfilled
• Unit type of triggering unit (==) zergling
• Unit type of Damaging unit (!=) zergling
• Actions
• Do something but who cares what it is right now.

basically, if the unit that takes damage is owned by a computer, and it fulfills any of the conditions in the or condition it can go on with it's actions, the or condition has a few conditions inside it that are viable answers, the damage is greater than or equal to 1, a boolean variable is set to true, or the damage source is not a zergling and the triggering unit is

Actions

Actions, to be put as basically as possible, do something. Each of them does. An action is a reaction to the event, doing whatever it is that you want them to do. When in a trigger, they complete each action in an order, from top to bottom, but sometimes that order will not matter. If you have an action that moves a unit when it enters a region then right after you set a variable to that units position it would be different than if you set the units position before it was moved, but if you set a unit variable to that unit when it enters, then move it, it would be the same as though you had set it after you moved it because that unit has not been changed in the move.

Trigger:
• Example
• Events
• Any unit enters Region 1
• Local Variables
• Point &lt; no point &gt;
• Unit &lt; no unit &gt;
• Conditions
• Actions
• Here is where the action&#039;s orders matter.
• Set Point = position of triggering unit
• Unit - Move triggering unit to the center of Region 2
• OR...
• Unit - Move triggering unit to the center of Region 2
• Set Point = position of triggering unit
• Each of those do different things, but below does not matter what order they are in.
• Set Unit = Triggering unit
• Unit - Move triggering unit to the center of Region 2

Any questions on this just pm me or make a post in the SC2 Galaxy Editor thread. I plan to add some pictures to this later, but until then, go out and create!

This goes on to:

I just wanted to post here acknowledge this. I have seen it and read it but I will wait with the comments on it until I'm done judging after the deadline runs out.

thanks, ill be waiting when is the deadline?

I think it is supposed to be a month in total. I thought Sim updated his post about it.

General chit-chat
Help Users
• No one is chatting at the moment.
• jonas:
your stories are both frightening and hilarious
• The Helper:
I worked as a waiter for a few years in college and in general the places I worked were clean. There was some gross stuff but nothing major or anything that would kill anyone LOL
• Varine:
I mean I'm in North Idaho, I don't think we even have a dedicated inspector up here. When I was in San Antonio they came to my food truck like four times one night, I was really confused about it.
• Varine:
I require everyone in the kitchen to have a food handlers permit, but those are a fucking joke. It's like 20 multiple choice questions and I think you only need 75%. Of all of the people I've hired, only one has failed it on their first attempt and he was a weird kid that was homeschooled and clearly was very isolated.
+1
• Varine:
Very awkward, I think most of his "education" consisted of Bible studies. He didn't last very long.
+1
• Varine:
@Ghan The ServeSafe Manager's certification is the one that lapsed. I didn't realize it until like June, I just haven't had time to dedicate to taking it. Last time it was a whole thing, took like six hours, had to go to a class, apparently they've eased up on it though. The website said i need a webcam with audio and I think install a screen monitor program to make sure I'm not cheating, I'm guessing it'll be a couple hours still. In Idaho only one person is required to have it though, like I don't even need to be there lol. Just someone that works there. It's very lax. I think the only thing I've ever been marked down on was I needed to get more thermometers, and they told me I had to buy smaller gloves because one girl had tiny hands and the mediums were too big for her, they said the tips get cut off a lot when they are too big. Then I didn't hear from them for like a year again.
+1
• Varine:
Someone reported us today though, they said they got sick on Tuesday. I talked to them and they definitely didn't get sick from us, but I presume I'll get a visit sooner than later now though. They rescinded their complaint to the health department after I talked to them, since they were having a birthday party and apparently went to several places that day and also made burgers at home, were drinking heavily probably, and they only had calamari at my restaurant, which we prep daily. Comes in frozen, so the oldest it could have been was two days out of freeze. I think they decided it was from the burgers they made, they called back later to apologize I guess but I didn't talk to them then. My guess is they just got too fucking drunk and puked, but so long as they aren't disparaging me anymore I don't really care.
+1
• jonas:
That's like 90% of homeschooled kids - the bible is the only thing you need! Unfortunately that doesn't survive first contact with the world outside the home
• The Helper:
Dude was all birthday drunk with his family trying to make life difficult for you guys and not even your fault
• The Helper:
What else you doing in Idaho though
• Ghan:
I've heard that they made the ServSafe test questions more difficult, but they also reduced the score you have to get to pass so it balances a bit.
• The Helper:
This is the coolest drink I have ever seen - Nebula frost https://www.thehelper.net/threads/cocktail-nebula-frost.195645/
+1
• Varine:
Eh, mostly trying to leave I think.
• Varine:
I'm slowly getting the equipment I need to start my digitization business though, so that'll be a nice little side thing in the off season. I'm saving up for a new camera, the one I have has been kind of janky with trying to capture slides, but it's doing okay for the few times I need it.
• Varine:
I'm trying to learn how to do colorization, but being colorblind it's not going great. So I might just not do that, just do scanning and digital restoration. With just handling film it's not too bad, but trying to do old home videos on VHS and shit are a nightmare right now. Fragile tapes, my VCR doesn't have a fantastic reader head thing so that doesn't help. I'm sure I can find a better solution to this than using a VCR though
• Varine:
I just don't know that much about how they work still, but most of that is on hold until the end of the summer when I can take days off again
• Varine:
I think we end lunches at the end of the month and then I can have a normal schedule. Go back to taking classes, etc.
• The Helper:
the being color blind thing is killing me
• The Helper:
its like I dont have arms and I want to be a tennis player
• Varine:
I got these colorblind people sunglasses but they don't help. Just makes it way more obvious that I don't know some colors
+1
• Varine:
Then a while back I REALLY wanted to get into Kerbal, but they don't have a fucking colorblind mode
• Varine:
And I can't find a mod for it, so I guess I'm not going to get this figured out since their icons are all like, slightly different greens\
• Varine:
And a few shooter games. Like idk why red and green became standards for enemy and ally, like blue doesn't exist.
• The Helper:
I used to not really be able to tell between black and white and color tv back in the day but I cannot relate besides that