Tutorial GUI - 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 < no point >
    • 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 <-- this fires when any unit dies
      • Map Initialization <-- this fires 1 time at the start of the map
      • A player types OMG! as an exact match <-- 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 <--- this requires that the owner of the unit IS NOT player 15, or neutral hostile i believe, (!=) = not equal to, (==) = equal to, (<=) = less than or equal to, (>=) = greater than or equal to
      • Or, any of the conditions are true <--- one of the conditions in this and all of the conditions not in this are required
        • Damage Taken (>) 1.00
        • BooleanVariable (==) true <--- this is a variable you set in another trigger
        • And, all of the conditions are true <--- 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 < no point >
      • Unit < no unit >
    • Conditions
    • Actions
      • Here is where the action'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:
 

Siretu

Starcraft 2 Editor Moderator
Staff member
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.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is online though at night
  • The Helper The Helper:
    You would probably have to take a loan to get the Rice cert it is like 14l
  • The Helper The Helper:
    I was hoping you were going to say you wanted to be a cook and wished to open up a Food Truck there are so many opportunities for that here
  • The Helper The Helper:
    you can only open the bar if you sell food and a food truck in the parking lot counts
  • The Helper The Helper:
    here in houston
  • The Helper The Helper:
    most bars are struggling to build food prep and even some I know are doing there own food trucks
  • The Helper The Helper:
    but yeah man you should come to Houston there is so much more opportunity here than San Antonio. Just look at all the homeless people on the Riverwalk and downtown there you cannot even walk down the street without getting mobbed them
  • The Helper The Helper:
    check out this place apparently it is the best roommate site out there roommates.com lol
  • Varine Varine:
    The homeless people reminded me of New York
  • Varine Varine:
    I'll check it out, my lease expires in like a few months so I need to figure something out.
  • Varine Varine:
    I tried to open a food truck in Sandpoint a few years ago but the city said no, then like two years later they passed new laws to encourage it and gave them all fucking tax breaks and shit. And at that point I didn't have enough money to go buy one so I was way too late to the game once other cities realized they could just bring their existing truck there, or sell their brick and mortar.
  • Varine Varine:
    I do like food trucks though, they're way more fun than restaurants and usually I also get some of that tip money there.
  • Varine Varine:
    Restaurants are really hard if you don't have a back up source of income to fund them sometimes, in my experience most owners either got really really lucky, had existing money that allowed them to buy an already successful one, or they have family money to fall back on for loans. It's few and far between to see very inspiring success stories where the person actually got it through hard work and perseverance. I thought about opening one lots and I always just end up not thinking it'll work. I would much rather just find someone that has that money and go work for them
  • The Helper The Helper:
    i am not talking about opening a brick and mortar I am talking about food trucks though I have seen some brick and mortar mexican places open up during covid that are doing good because there food is awesome!
  • The Helper The Helper:
    Food trucks are killing out here because Bars cannot open unless they sell food and the governor ok'd the use of a food truck in front as serving food
  • The Helper The Helper:
    Just not enough food trucks
  • The Helper The Helper:
    a buddy of mine just opened up a food truck and he is killing it but he is a great cook and has awesome food right in the middle of the pandemic too food trucks are immune to pandemic because they are take out in Texas you will always be able to get take out or delivery
  • The Helper The Helper:
    He is in the different food facebook groups in houston and posts videos of him making his food
  • The Helper The Helper:
    he is killing it
  • jonas jonas:
    @Varine with the restaurants, there surely is a lot of luck and hard work but most restaurants fail because they suck. Flair isn't right, economics not well thought through, food is mediocre or sucks, location is bad, etc. If you're thinking about opening one, make sure you're looking at the stories of those that would be playing at your level, don't let your hopes be dragged down by all the subpar restaurants out there.
  • jonas jonas:
    I'm a bit worried about the future of data science, there's an influx of incompetent people hired by incompetent managers, that can't last. But I'm sure smart data scientists will always be useful and hireable. Same as smart security people.
  • jonas jonas:
    My sister in law worked in a vegan food truck, the owners were also making a killing, added several trucks and opened two restaurants over 5 years
  • Ghan Ghan:
    The CompTIA stuff is pretty much crap unfortunately. The places that ask for those low-level certs aren't likely places you want to work. For IT you really want a degree, but in the meantime you need to figure out some way to learn the skills. Cybersecurity is really hot right now so competition is fierce.
  • tom_mai78101 tom_mai78101:
    I realized I don't have anything much to say, other than "Good luck!". Compared to other places, I'm just very lucky we didn't have a lot of surges of cases coming in.

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top