• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Stop units from moving when they are attacked

Status
Not open for further replies.
Level 5
Joined
Jun 12, 2018
Messages
148
Yes you can do this easily with a trigger, just sets the event to "when a unit is attacked", check with conditions if the attacking unit is a long range unit (you'll have to set manually what you call "long range" , eg 800.00) or invisible (you have to use "Or" condition and fill the 2 conditions with what I've said).
Then you just have to add one action ordering the attacked unit to stop.
 
Level 12
Joined
Feb 5, 2018
Messages
521
  • Trigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • -------- Triggering unit = attacked unit --------
      • -------- Here you can check if the unit is visible or not --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacking unit) is invisible to (Owner of (Triggering unit)).) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop.
        • Else - Actions
      • -------- Here you can check if the unit is ranged --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Unit-type of (Attacking unit)) is A ranged attacker) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop.
        • Else - Actions
      • -------- Here you can check the distance between the units --------
      • -------- Check the value to whatever you like --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between (Position of (Triggering unit)) and (Position of (Attacking unit))) Greater than or equal to 600.00
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop.
        • Else - Actions
Hope this helps or gives you an idea how to do it :)
 
Status
Not open for further replies.
Top