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

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
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:

02.png

*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:

Key_Stroke.jpg


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.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top