• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Make Units run away from Units owned by a player

Status
Not open for further replies.
Level 14
Joined
Mar 27, 2008
Messages
1,003
I've come across another problem. I can't figure out how to do this:

I need any of Player 10 (Light Blue)'s units to run away from any of Player 11 (Dark Green)'s units should Dark Green come within 750 of Light Blue. I have no idea how to do this and any help would be appreciated. Both LB and DG are NPC players (Computer) if that helps.
 
c7b569c1c355ad6a43b5fcb2e51e27de_out_zps77402a82.gif
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You could add P10 units into a unit group. Periodically loop through the group. Pick units in range of the position of picked unit. If the detected unit is owned by P11, order the looped unit to move to position of looped unit offset by x towards angle from position of detected unit to position of looped unit

Things that leak
 
Last edited:
You could remove the leak and have no lag at all, by the way.
If the detected unit is owned by P11, order the looped unit to move to position of looped unit offset by x towards angle from position of detected unit to position of looped unit
Wait. So if there are multiple detected units, the unit will run from the last picked right?
 
Wait. So if there are multiple detected units, the unit will run from the last picked right?
Possibly, but I think it shouldn't happen often.
anyway, here's how I make Maker's suggestion into a test map. If it bugs, I will use another method.
 

Attachments

  • AI Run.w3x
    17.3 KB · Views: 48
Status
Not open for further replies.
Top