• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Stop units from moving when they are attacked

Status
Not open for further replies.
Level 5
Joined
Jun 12, 2018
Messages
149
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 13
Joined
Feb 5, 2018
Messages
568
  • 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