I have a button that creates units and adds them to an array so I can access their data, when one is attacked I want to be able to pull that unit from the array and modify its custom properties. How can I go about doing this.
Just use Triggering Unit. This will be the unit that was attacked.
If you are using some sort of record/struct, have a loop going through all elements and check if the current unit equals triggering unit, if yes you have your index.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have a button that creates units and adds them to an array so I can access their data, when one is attacked I want to be able to pull that unit from the array and modify its custom properties. How can I go about doing this.
So array of units
[0 => marine, 1=> marine, 2 => marine, 3 => marine]
lets say the marine with the key of 2 is attacked
Event any unit is attacked
Action
Change UnitArray[unitthatwasattacked].custompropertie
@farban6: Go
Just use Triggering Unit. This will be the unit that was attacked.
If you are using some sort of record/struct, have a loop going through all elements and check if the current unit equals triggering unit, if yes you have your index.