LordSaddler1
New Member
- Reaction score
- 4
Is there a Pick Nearest Unit command?
Set Point1 = Position of <some unit>
Set UnitGroup = Units within 500.0 of Point1 matching (((Matching unit) ... whatever you need))
Set Distance = 1000.0 (anything bigger than the range above will do)
Set Unit = No unit
Pick every unit in UnitGroup and do
Set Point2 = Position of (Picked unit)
If Distance between Point1 and Point2 less than Distance then
Set Unit = (Picked unit)
Set Distance = Distance between Point1 and Point2
Custom script: call RemoveLocation( udg_Point2 )
Custom script: call RemoveLocation( udg_Point1 )
Custom script: call DestroyGroup( udg_UnitGroup )
... do whatever do "Unit"