Stop units from moving when they are attacked

Status
Not open for further replies.

Panqueen Plazi

P

Panqueen Plazi

Is there anyway to stop a unit from moving when they are attacked by a long range unit or an invisible unit?
 
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.
 
  • 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.
Back
Top