Tutorial Triggers - Adding a 'Add Event to Trigger' Action


Censored for your safe viewing
Adding a 'Add Event to Trigger' Action
By Dave312

The aim behind this tutorial is to teach you make use of the hidden native actions that are not available by default for use in GUI triggering. The example I will be demonstrating will be for making an Add Event to Trigger Action.

The first step is to decide which event this action will handle. I will be using the Unit Enters/Leaves Region Event, however these same steps can be applied and used for other events as well as any other native actions not available in the GUI.

Ok so open up your map, and then open up the console (Window -> Console). Type in browse to bring up the Archive Browser (you can type help into the console to bring up a list of available commands). You now need to navigate down to the natives.galaxy file which is located under the TriggerLibs folder.

Now you need to find the action you want to create. This file is split up into various sections which should help you find your action. Mine is of the type Unit so I'll will want to look under the unit section. It is not always easy to find what you want so you may want to try using the find function (crtl+f). I have found my action and it is shown below. Note that all Add Event to Trigger Actions start with TriggerAddEvent.
native void     TriggerAddEventUnitRegion (trigger t, unitref u, region r, bool state);
What you need to pay attention of here is the name of the action and the parameters specified.

Now open up the Triggers Window (don't close the Archive Browser as you will need to reference it later). Click on the New Action Definition icon on the toolbar (or Ctrl+Alt+R) to add your new action and name it whatever you want. I'm calling mine Add Event Unit Enters Region to Trigger. Now select the name of your trigger in the right-hand pane and uncheck the Based On Name property. You need to change the script identifier to the name of the action in the natives.galaxy file. For me, this becomes TriggerAddEventUnitRegion.

Now you need to modify the Options property and check Native as we are referencing a native action. Leave the rest unchecked. Now here is the tricky bit. For every parameter listed the natives.galaxy file, you need to add a corresponding parameter to your action. You can call the parameters whatever you want but you will need to change the script identifier to the name given in the natives.galaxy file. So for my first parameter, it says trigger t. The first word represents the type (Trigger), and the second word represents the script identifier (t). If your not sure of some of the types, just take a look at the Event you are trying to add and you should be able to work it out. Also note that for my last parameter, it is listed as bool (boolean) with a script identifier of state. If you look at the actual event, the boolean parameter represents the option Enters/Leaves. Because there are only 2 options to choose from (Enters or Leaves), the Region Enter/Leave State is marked as a boolean in the natives.galaxy file. If there were more options, it would be marked as an int (integer). For this reason, I have not chosen to use a type boolean parameter but the preset Region Enter/Leave State.

Finally, if say I wanted to not have to choose a specific unit for the unit parameter of my action, but rather use the preset Any Unit, I can allow this by selecting the parameter, then going to the bottom right-hand corner where it says Allowed Presets. I can then add my desired preset (right-click -> Add Preset...) here.

Now you can test your action to see if it works (the action can be found under the - General section of the action selection window). If it fails for any reason, you may want to check that you have correctly specified the script identifiers as these will prevent the action from working properly.

The now that brings us to the end of this tutorial. If you have any problems, please leave a post below and I'll do what I can to assist you.



Super Moderator
Staff member
...And here I was, thinking that GUI is unrestricted (other than forcing you to click 100 times per minute).

The images are broken.


Censored for your safe viewing
The images should work now.

The GUI isn't really that restricted, they just missed a couple things which can be added manually fairly easily.


New Member
Great tutorial, except you forgot to check "Use Reference" for the Unit parameter in your own example (since you're looking for an object of type <unitref> instead of <unit>);)
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.


    Hive Workshop