- Joined
- Nov 3, 2013
- Messages
- 989
Why isn't this working? The units get stuck repeadely issuing "attack target" order, but that should only happen if there's a unit with less HP. And obviously there can't be more than one unit with the least. (There can be a tie, but that just means the first one picked becomes the attack target.)
-
attack nearby lowest health
-
Events
- Unit - A unit Is attacked
-
Conditions
- (Owner of (Attacking unit)) Not equal to (Triggering player)
-
Actions
- Set tempUnit = (Triggering unit)
- Set tempPoint = (Position of (Attacking unit))
- Set tempReal = (Life of tempUnit)
-
Unit Group - Pick every unit in (Units within 85.00 of tempPoint matching (((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) 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 tempUnit = (Picked unit)
- Set tempReal = (Life of tempUnit)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Custom script: call RemoveLocation(udg_tempPoint)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Triggering unit) Not equal to tempUnit
-
Then - Actions
- Unit - Order (Attacking unit) to Attack tempUnit
- Else - Actions
-
If - Conditions
-
Events