Tutorial GUI - Triggering for Dummies (custom actions and functions)

GFreak45

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

In this tutorial we will be going over 2 things, custom actions and functions. These are very usefull because you can make it much faster to do more routine actions or create functions that get complex values with mathematics or even run off variables.

Actions

We will begin with Custom Actions. When you first create one (via right clicking the left hand box for triggers, highlighting new, and selecting New Action Definition. You should get a picture that looks like this on the right:


*Traceline is only the name of the function being made, it has nothing to do with what is actually in the function.

Each of these does different things but i will explain the most important parts first.
Returns and parameters: In custom actions you will not use returns, they are only for functions, but parameters are important to make your custom actions as versatile and fluid as possible. A parameter is essentially one of the red or green options on actions and functions that you fill in. It is a field custom to that specific instance of this action. It is similar to a local variable because it is attached only to a specific action. There are many types ranging from variable data types to presets (operators like !=, <=, ==, or true/false).

the parameter field should look like the local variable field in a trigger after you define some locals, like this:
Trigger:
  • Parameters
    • I = 0 &lt;integer&gt;
    • P = == &lt;Any Option Parameter&gt;


The next field we will look at is the Grammar Text. This is the field at the bottom of the trigger editor when you create a new action. As an example this should look like this:



where (All Players) and Debug are the default parameters, the green field is what they have already set, and any red paramaters are ones that must be set before the trigger containing the action can be activated, you can create these with paramaters that have the option no default value checked just above the default value when they are selected.
You set this by setting the Grammar Text field to whatever text you want without the parameters put in, include a space for each parameter, then go back and select it with the drop down menu on the bottom. This will input the parameter then walah, you action will look nice and pretty when you select it in the trigger editor.

The name of the Action is what will be displayed in the Editor when selecting an action, and if the function name is based off the action name, it will be the same as the name without any spaces. This is for use in custom text, you call that exact text to do this action.

Next is the Hint Text, that is simply the grayed out text along the bottom, telling what each action/function does.

Custom Text is a place where you can write out your actions rather than selecting them, but until the custom coding program for the galaxy editor is finished this wont be something to really get into.

Finally the local variables and custom actions. This part is essentially a trigger. The only difference is you can use the parameters as well, then when set by the user they will fill in the options set to those parameters.

Functions

In order for me to properly explain functions you must understand variables. Essentially a function is like a variable in that, they take something and return something. like this:

set variable X[index] = data type of the variable

function FunctionName takes Parameters returns data type of the return

so basically, a function with a return type of a unit, can replace a field in an action that requires a unit, like damage unit: the victim can be set to a custom function with a return type unit.

so now we will create an ability with a custom action and a custom function to fit our needs.
this ability will be based off the snipe ability (off the ghosts), the ability will do 2 things: Blink behind the target unit and then deal damage in an aoe. Think of how you could do that with 1 action and 1 function and try it out, then check this:

action:

Trigger:
  • Blink Area Damage
    • Return Type: (None)
    • Parameters
      • Blinker = No Unit &lt;Unit&gt;
      • Facing Point = No Location &lt;Location&gt;
      • Blink Point= No Location &lt;Location&gt;
      • Real = 50.0 &lt;Real&gt;
      • Integer = 2 &lt;Integer&gt;
    • Grammar Text: Moves Blinker to Blink Point facing Facing Point and deals Real damage in a Integer Radius.
    • Hint: Moves a unit to a point and deals damage in a radius around that point.
    • Local Variables
    • Actions
      • Unit - Move Blinker to Blink Point facing Facing Point
      • Unit Group - Pick Every unit within Real(Integer) of Blink Point matching conditions (Owner of Matching unit (==) enemy of Owner of Triggering Unit) and do actions
        • Loop Actions
          • Unit - Cause Blinker to damage Picked Unit dealing Real damage with the effect Psionic Storm (Damage)

function:

Trigger:
  • Point Behind Unit
    • Return: (Location)
    • Parameters
      • Unit = No Unit &lt;Unit&gt;
    • Grammar Text: Behind Unit
    • Hint: Gets the point behind the selected unit.
    • Local Variables
    • Actions
      • General - Return (Position of Unit offset by 1.0 in the direction of ((Facing Angle of Unit) + 180))

and here we wrap it all up nicely in a 3 element trigger:

Trigger:
  • Full Trigger
    • Events
      • A unit finishes casting an ability targeting a unit
    • Conditions
      • Ability being cast = Snipe (i forget the real name)
    • Actions
      • Unit - Move Triggering Unit to (Behind Target Unit of ability cast) facing (Position of Target unit of ability cast) and deal 50.0 damage in a 2 Radius

if you can get that without checking the spoilers first you are golden, now go out an use this to your advantage and create functions and actions that make your life easier :)

Here are some ideas you can try:

Easy:
A Damage action that avoids loops in triggers fired by damage by turning off the trigger it is in, dealing the damage, then turning the trigger back on.
A Deal aoe damage action targeting a point a radius and a source as the parameters
A function returning a point in relation to a unit specific to what direction it is facing, example above

Advanced:
A dialog box with all labels/buttons included with spacing based on the ammount of dialog items
A chain lightning action dealing damage to a target then bouncing to a max number of additional targets 1 at a time but never hitting the same target twice.
A function returning the damage reduction factor of a unit by dealing 1 damage to it then checking how much was actually dealt due to reduction, then setting the units health back to what it was

This goes on to:
  • WIP
 
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