Adding an event to a trigger

AgentPaper

From the depths, I come.
Reaction score
107
Is this just not possible anymore? It's not in the GUI, but can you use custom script and/or Galaxy code to do it? My problem is that I have a trigger that creates a hex grid of regions, and I want a trigger to run whenever a unit enters one of them, but I can't seem to figure out how to make that work without pre-placing the regions, which I do NOT want to do.
 

Yoshii

New Member
Reaction score
74
Is this just not possible anymore? It's not in the GUI, but can you use custom script and/or Galaxy code to do it? My problem is that I have a trigger that creates a hex grid of regions, and I want a trigger to run whenever a unit enters one of them, but I can't seem to figure out how to make that work without pre-placing the regions, which I do NOT want to do.

why not just save the created hex grid of region in a variable and have the event run?

I see what you mean though for the event part
 

AgentPaper

From the depths, I come.
Reaction score
107
I'm...not sure what you mean. Do you mean have the trigger just run constantly and check if units are in the regions? Because that's not going to work even a little bit.
 

Yoshii

New Member
Reaction score
74
I'm...not sure what you mean. Do you mean have the trigger just run constantly and check if units are in the regions? Because that's not going to work even a little bit.
I dont see the issue based on your first post; you mentioned you have a trigger creating region and being unable to call upon them because they are not "pre placed" .

Why not just to save those created region in a region variable or array then turn on the other trigger and call upon them by checking if any unit enter those variable as event.I had to do something like this in wc3 in a situation that look exactly like the one you described

unless there are some info im missing from your map.
 

AgentPaper

From the depths, I come.
Reaction score
107
That's exactly what I want to do. The trigger creates all of the region, assigns them to a variable, (an array of regions) and then I want that trigger to add an event to a different trigger, such that whenever a unit enters one of the regions, the trigger will run.

In WC3, this would have been as simple as using the "Add Event to Trigger" action, but that doesn't seem to exist in SC2 for whatever reason. What I'm asking is whether there's any way to do this with custom script or Galaxy code, since GUI doesn't support it at the moment.
 

Yoshii

New Member
Reaction score
74
That's exactly what I want to do. The trigger creates all of the region, assigns them to a variable, (an array of regions) and then I want that trigger to add an event to a different trigger, such that whenever a unit enters one of the regions, the trigger will run.

In WC3, this would have been as simple as using the "Add Event to Trigger" action, but that doesn't seem to exist in SC2 for whatever reason. What I'm asking is whether there's any way to do this with custom script or Galaxy code, since GUI doesn't support it at the moment.

why not create such trigger and have them turned off when game start and turn them once the region are created; you can assign the enter region event to your variable/array of your turned off trigger until it get a value

I doubt galaxy will support it in the way you want to do it, we can only hope.
 

AgentPaper

From the depths, I come.
Reaction score
107
How would having the trigger off at the start help in any way whatsoever? The problem is that I can't add the event to the trigger, and I can't have it at the beginning because you can't assign an event with a variable like that.
 

Arkless

New Member
Reaction score
31
custom script would be:

TriggerAddEventUnitRegion (trigger t, unitref u, region r, bool state);

triggernames are: gt_NAME
unitref has to be -1 for any unit (at least i think so, might be wrong)
global variables got the prefix gv_ and locals lv_ (for the region)
region/range events - true = entered, false = exited
 

AgentPaper

From the depths, I come.
Reaction score
107
custom script would be:

TriggerAddEventUnitRegion (trigger t, unitref u, region r, bool state);

triggernames are: gt_NAME
unitref has to be -1 for any unit (at least i think so, might be wrong)
global variables got the prefix gv_ and locals lv_ (for the region)
region/range events - true = entered, false = exited

Thank you very much. That's exactly what I was looking for. So, just to see if I have this right, the custom script would be:

TriggerAddEventUnitRegion (trigger gt_EnterHex, unitref -1, region gv_hex[lv_num], bool true);

This would add the event: Unit enters (Hex[Num]) to the trigger "Enter Hex"

Edit: Not working. Says I have a syntax error.

Edit: Edit: Also tried "TriggerAddEventUnitRegion (gt_EnterHex, -1, gv_hex[lv_num], true);" which gives: "Script failed to compile: Parameter type does not match the function definition"
 

Arkless

New Member
Reaction score
31
awh, sry, any unit = null (not -1)
looked it up now, yesterday I wrote everything from my memory >.< sry again

just to tell you how I got the -1, it's for any player in player events
 

AgentPaper

From the depths, I come.
Reaction score
107
awh, sry, any unit = null (not -1)
looked it up now, yesterday I wrote everything from my memory >.< sry again

just to tell you how I got the -1, it's for any player in player events

Thank you very much, it works perfectly!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top