- Joined
- Sep 9, 2009
- Messages
- 659
I want to set the units' health in an area to the average of their current health in percent. I don't have the trigger yet but this is how I plan on doing it.
I'd also like to know if
JASS:
call GroupEnumUnitsInRange(g, x, y, 600, null)
loop
set u = FirstOfGroup(g)
exitwhen u == null
set i = i + 1
set Real = (0 + GetUnitStatePercent(u, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE)) / i
call GroupRemoveUnit(g, u)
endloop
call GroupEnumUnitsInRange(g, x, y, 600, null)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE) * Real)
call GroupRemoveUnit(g, u)
endloop
I'd also like to know if
GetUnitStatePercent
is a good BJ and what's an alternate way to do CountUnitsInGroup
?