If I have multiple units set to an array. Unit[0], Unit[1], Unit[2]. How would I address each of them attacking with one trigger? How could I write it so the trigger editor knows which unit is firing?
[code]Event:
- Any unit attacks
Cond:
- None
Actions:
- If (attacking unit) is Unit[0] Then
....
- Else
- - If (attacking unit) is Unit[1] Then
...
...</p>
<p>[/code]
That way you won't be troubled by the limitations of the event.
If I understood your question wrongly, then please elaborate. I'm not 100% sure I got what you want ^.^
You could do something like this:
Events
Unit - Any Unit starts attacking
Local Variables
Conditions
Actions
General - Pick each integer from 0 to ArraySize, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Attacking Unit) == Unit[Picked Integer]
Then
Do whatever you want
General - Skip remaining actions
Else
or if you want them to do different things you should use a switch depending on Attacking Unit
If I have multiple units set to an array. Unit[0], Unit[1], Unit[2]. How would I address each of them attacking with one trigger? How could I write it so the trigger editor knows which unit is firing?
The best way to do it is like that:
[code]Event: - Any unit attacks Cond: - None Actions: - If (attacking unit) is Unit[0] Then .... - Else - - If (attacking unit) is Unit[1] Then ... ...</p> <p>[/code] That way you won't be troubled by the limitations of the event. If I understood your question wrongly, then please elaborate. I'm not 100% sure I got what you want ^.^
Thank you for the response. Very fair assumption. Its hard to word something like this.
That is the only thing I was able to get to work but its not practical if you have 100-200 units.
There has to be a better way of identifying individual units.
Well, why would you want to identify every unit? Maybe we can find a way to work around the trouble.
You could do something like this:
Events
Unit - Any Unit starts attacking
Local Variables
Conditions
Actions
General - Pick each integer from 0 to ArraySize, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Attacking Unit) == Unit[Picked Integer]
Then
Do whatever you want
General - Skip remaining actions
Else
or if you want them to do different things you should use a switch depending on Attacking Unit