You need to make a function that will search through the unit group array. Then return the unit group that the triggering unit is in.
Get Unit Group
Options: Function
Return Type: Unit Group
Parameters
Unit = No Unit <Unit>
Grammar Text: Get Unit Group(Unit)
Hint Text: (None)
Custom Script Code
Local Variables
Index = 0 <Integer>
Unit Group = (Empty unit group) <Unit Group>
Actions
General - For each integer Index from 0 to Max Unit Group Count with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit is in Unit Groups[Index]) == True
Then
General - Return Unit Groups[Index]
Else
General - Return No Unit Group
Trigger will look something like this
Trigger
Events
Unit - Any Unit acquires a target
Local Variables
Unit Group = (Empty unit group) <Unit Group>
Conditions
(Owner of (Triggering unit)) == 1
Actions
Variable - Set Unit Group = (Get Unit Group((Triggering unit)))
Unit Group - Pick each unit in Unit Group and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
((Picked Unit) has [Insert Behavior]) == False
Then
Unit - Add 1 [Insert Behavior] to (Picked unit) from (Picked unit)
Else
Hey mates,
is there any way to trigger an event like in the Title?
Background is, that i dont want to create a Trigger for every single unit group (cause there are many in my map..)
So i want to create "universal trigger" which works for every unit group:
Any unit acquires a target
If unit is owned by player X
pick every unit in group of triggering unit
add behavior to picked unit
Hope you are able to help me.. :-)
Thanks
Fl3tsch3r
You need to make a function that will search through the unit group array. Then return the unit group that the triggering unit is in.
Trigger will look something like this
Thanks for your answer! I didn't work with Functions right now so im not sure if i fully understand how to do it.
But im going to try and reply if i got it to work :-)
Thanks again for now
Link Removed: http://www.mediafire.com/file/5d9j357nspju507/Unit_Group_Example.SC2Map
Here's an example map you can refer to if needed.
In reply to Prodigy454:
Just wanted to let you know that it worked perfectly for me!! Thanks alot again