- Joined
- Dec 9, 2009
- Messages
- 397
Is there a way to detect when a unit begins running at something to attack?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
if GetIssuedOrderId() == S2I("attack") then
Events

Unit - A unit Is issued an order targeting an object
Events

Time - Every 0.60 seconds of game time
Conditions
Actions

Set Point = (Position of UnitBeingRunAt)

Custom script: set bj_wantDestroyGroup = true

Unit Group - Pick every unit in (Units within 512.00 of Point) and do (Actions)


Loop - Actions



If (All Conditions are True) then do (Then Actions) else do (Else Actions)




If - Conditions





(Current order of (Picked unit)) Equal to (Order(move))





(Picked unit) Not equal to UnitBeingRunAt




Then - Actions





Game - Display to (All players) the text: (Name of (Picked unit))




Else - Actions

Custom script: call Removelocation(udg_Point)
Events

Time - Every 0.60 seconds of game time
Conditions
Actions

Set Point = (Position of UnitBeingRunAt)

Custom script: set bj_wantDestroyGroup = true

Unit Group - Pick every unit in (Units within 512.00 of Point) and do (Actions)


Loop - Actions



If (All Conditions are True) then do (Then Actions) else do (Else Actions)




If - Conditions





Or - Any (Conditions) are true






Conditions







(Current order of (Picked unit)) Equal to (Order(move))







(Current order of (Picked unit)) Equal to (Order(attack))





(Picked unit) Not equal to UnitBeingRunAt




Then - Actions





Game - Display to (All players) the text: (Name of (Picked unit))




Else - Actions

Custom script: call Removelocation(udg_Point)
Trigger - Add to (This trigger) the event (Unit - A unit comes within 256.00 of UnitBeingRunAt)
Trigger - Add to (This trigger) the event (Unit - A unit comes within 256.00 of UnitBeingRunAt)
I'll try adding the event unit acquires a target
So, can I find out what the target is if I use that?