Hello.
I'm trying to create a trigger without an event.
I want to add an event from another trigger.
Here's what I want to do:
Pick a unit group. Loop through the group. Add each of the units in that unit group to an event doing: 'A unit gets within X range of (Picked unit)'.
I can't find any action that suits my purpose, though.
I found this on google:
native void TriggerAddEventUnitRange (trigger t, unitref u, unit fromUnit, fixed range, bool state);
I think this is what I'm looking for, but I don't know how to use it.
EDIT: I don't have Heart of the Swarm, if that matters.
I can't find any action that suits my purpose, though.
Dynamic event attachment is not supported by GUI. You will need to use "custom script" features to directly call the event attachment natives. You could also write a GUI wrapper for them but this still requires understanding the custom script feature.
Quote:
I found this on google: native void TriggerAddEventUnitRange (trigger t, unitref u, unit fromUnit, fixed range, bool state); I think this is what I'm looking for, but I don't know how to use it.
You call it like you would any other native function. This is similar to a classic c function call (tutorials how to make such calls litter the internet as C is a major language).
Of important note is that u is a unit reference so you will need to wrap a unit as a unit reference when passing it as an argument. Use null to represent any unit however you probably need to define the origin unit as some unit for the event to work.
Quote:
EDIT: I don't have Heart of the Swarm, if that matters.
Makes no difference next to which mods you can link. You are required to update to HotS (>=2.0) to play online so you have all HotS engine features available.
Dynamic event attachment is not supported by GUI. You will need to use "custom script" features to directly call the event attachment natives. You could also write a GUI wrapper for them but this still requires understanding the custom script feature.
I have a basic understanding. I used to do a lot of map editing in Warcraft III, but the editor in SC2 is so different.
You call it like you would any other native function. This is similar to a classic c function call (tutorials how to make such calls litter the internet as C is a major language).
I need to know some of the data. Such as the name of the trigger that I want to add this event to. In WC3 there used to be a function "convert trigger to custom text" - which allowed me to find out these kind of things. I haven't seen any function like that in SC2, though.
Of important note is that u is a unit reference so you will need to wrap a unit as a unit reference when passing it as an argument. Use null to represent any unit however you probably need to define the origin unit as some unit for the event to work. Quote:
I figured one of the units would be the specific unit I'm checking for, and the other unit would be the one that comes within range?
EDIT:
I found ctrl+F11 which fits my need for "convert to custom script".
UPDATE:
Here's what I want to do:
In Map init:
-add a bunch of units (manually) to a unit group
-loop through the unit group
-throw in this script:
Not entirely sure what you're trying to do. Can you just use "run trigger" in your other trigger? Or make your new trigger an action definition instead?
I need to know some of the data. Such as the name of the trigger that I want to add this event to. In WC3 there used to be a function "convert trigger to custom text" - which allowed me to find out these kind of things. I haven't seen any function like that in SC2, though.
It is called "Veiw Script" under the Data menu and shows you the entire map script. It is built 1 second after you make any change to GUI so no need to save.
Yes that should work. Do remember that "1.0" is 1 tile. Also it will fire when any unit enters range of the unit returned by UnitGroupLoopCurrent which depending on how many units receive this event could possibly lead to performance problems.
Not entirely sure what you're trying to do. Can you just use "run trigger" in your other trigger? Or make your new trigger an action definition instead?
I don't know. Maybe I could.
The thing is, I'm used to the WC3 editor, and it's (obviously) not the same thing as the SC2 editor.
Maybe there's a better/easier/more efficient way to do this, but this is the way I'm used to do it:
Step 1. Create a Unit Group
Step 2. Add units to <Unit_Group>
3. For every unit in <Unit_Group>, do...
4. Add (Picked Unit) to event: "TriggerAddEventUnitRange"
What this will do is: Whenever ANOTHER (matching condition) unit comes within range of a unit from <Unit_Group> - something will happen.
Why would I do all this, you may ask? In case I decide to add many, many units to <Unit_Group>, this is an efficient way to add each and every one of them to the trigger.
Like I said: maybe there's an easier way to do this in the new editor which I don't know about. In that case feel free to inform me, I would love to learn. =)
It is called "Veiw Script" under the Data menu and shows you the entire map script. It is built 1 second after you make any change to GUI so no need to save.
Yes that should work. Do remember that "1.0" is 1 tile. Also it will fire when any unit enters range of the unit returned by UnitGroupLoopCurrent which depending on how many units receive this event could possibly lead to performance problems.
How many (ish) are we talking about for performance issues? 10? 100? 1000? 10000?
I know every little thing adds up and all that, but I would like to get a basic idea of how much I've got to work with. :P
How many (ish) are we talking about for performance issues? 10? 100? 1000? 10000? I know every little thing adds up and all that, but I would like to get a basic idea of how much I've got to work with. :P
Not sure, I am just mentioning it in case latter down the line you have problems.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello. I'm trying to create a trigger without an event. I want to add an event from another trigger.
Here's what I want to do: Pick a unit group. Loop through the group. Add each of the units in that unit group to an event doing: 'A unit gets within X range of (Picked unit)'.
I can't find any action that suits my purpose, though.
I found this on google: native void TriggerAddEventUnitRange (trigger t, unitref u, unit fromUnit, fixed range, bool state); I think this is what I'm looking for, but I don't know how to use it.
EDIT: I don't have Heart of the Swarm, if that matters.
Dynamic event attachment is not supported by GUI. You will need to use "custom script" features to directly call the event attachment natives. You could also write a GUI wrapper for them but this still requires understanding the custom script feature.
You call it like you would any other native function. This is similar to a classic c function call (tutorials how to make such calls litter the internet as C is a major language).
Of important note is that u is a unit reference so you will need to wrap a unit as a unit reference when passing it as an argument. Use null to represent any unit however you probably need to define the origin unit as some unit for the event to work.
Makes no difference next to which mods you can link. You are required to update to HotS (>=2.0) to play online so you have all HotS engine features available.
I have a basic understanding. I used to do a lot of map editing in Warcraft III, but the editor in SC2 is so different.
I need to know some of the data. Such as the name of the trigger that I want to add this event to. In WC3 there used to be a function "convert trigger to custom text" - which allowed me to find out these kind of things. I haven't seen any function like that in SC2, though.
I figured one of the units would be the specific unit I'm checking for, and the other unit would be the one that comes within range?
EDIT: I found ctrl+F11 which fits my need for "convert to custom script".
UPDATE: Here's what I want to do: In Map init: -add a bunch of units (manually) to a unit group -loop through the unit group -throw in this script:
TriggerAddEventUnitRange (gt_TradingStationRange, null, UnitGroupLoopCurrent(), 1.0, true);
Will this work? "null" represents "Any Unit gets within range of ...", right? Will gt_<trigger_name"> suffice?
Not entirely sure what you're trying to do. Can you just use "run trigger" in your other trigger? Or make your new trigger an action definition instead?
It is called "Veiw Script" under the Data menu and shows you the entire map script. It is built 1 second after you make any change to GUI so no need to save.
Yes that should work. Do remember that "1.0" is 1 tile. Also it will fire when any unit enters range of the unit returned by UnitGroupLoopCurrent which depending on how many units receive this event could possibly lead to performance problems.
I don't know. Maybe I could. The thing is, I'm used to the WC3 editor, and it's (obviously) not the same thing as the SC2 editor. Maybe there's a better/easier/more efficient way to do this, but this is the way I'm used to do it:
Step 1. Create a Unit Group Step 2. Add units to <Unit_Group> 3. For every unit in <Unit_Group>, do... 4. Add (Picked Unit) to event: "TriggerAddEventUnitRange"
What this will do is: Whenever ANOTHER (matching condition) unit comes within range of a unit from <Unit_Group> - something will happen.
Why would I do all this, you may ask? In case I decide to add many, many units to <Unit_Group>, this is an efficient way to add each and every one of them to the trigger.
Like I said: maybe there's an easier way to do this in the new editor which I don't know about. In that case feel free to inform me, I would love to learn. =)
EDIT:
Thanks. =)
How many (ish) are we talking about for performance issues? 10? 100? 1000? 10000? I know every little thing adds up and all that, but I would like to get a basic idea of how much I've got to work with. :P
Not sure, I am just mentioning it in case latter down the line you have problems.