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.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top