Tinki3
Special Member
- Reaction score
- 418
This snippet groups a bunch of units within some range of some point.
It then works out which one of those units had the lowest HP.
"UnitLowestHP" is the unit you'd want to refer back to in this case.
It then works out which one of those units had the lowest HP.
Code:
Unit In Range With Lowest HP
Actions
Set TempReal = 9999999.00
Set TempPoint = (Position of (<YOUR UNIT HERE>))
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within 600.00 of TempPoint matching (((Matching unit) is alive) Equal to True)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of (Picked unit)) Less than TempReal
Then - Actions
Set TempReal = (Life of (Picked unit))
Set UnitLowestHP = (Picked unit) [COLOR="Green"]//Refer to this unit outside the 'Loop - Actions' and after the Unit Group function[/COLOR]
Else - Actions
Custom script: call RemoveLocation(udg_TempPoint)