• 🏆 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!

Forbidding movement to a unit

Status
Not open for further replies.
Level 2
Joined
Feb 27, 2010
Messages
8
I'd like to make a unit sometimes un-moveable while still making it able to attack. Setting movement speed to 0 does not seem to work. Any ideas?

EDIT : It has to be able to move under certain conditions.
 
Last edited:
Level 2
Joined
Feb 27, 2010
Messages
8
I'm sorry, I didn't say it the right way.

I'm trying to make my unit moveable IF and only IF <insert condition here>.

Any ideas?
 
  • trigger
  • Events
    • Unit - A unit is issued an order targeting a point
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • And - Conditions
          • (Issued Order) Equal to (order(smart))
          • (Unit-type of (Triggering unit)) Equal to X (place the unit-type you want to not move)
          • Here, place the condition you want Not Equal to X (this is defining the opposite of the condition you want to happen, for example if the unit you want to move must be a Hero, use the Boolean Comparison "((Triggering unit) is a Hero) Equal to False")
      • Then - Actions
        • Unit - Order (Triggering unit) to Stop
      • Else - Actions
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
A unit will only be allowed to move if its movement speed is above 0. Why not set the unit's movement speed to 0 when you want it's movement to be disabled, and then reset it back to the default speed when you want the unit to be able to move again:

JASS:
native SetUnitMoveSpeed takes unit whichUnit, real newSpeed returns nothing

constant native GetUnitDefaultMoveSpeed takes unit whichUnit returns real
constant native GetUnitMoveSpeed takes unit whichUnit returns real
 
Status
Not open for further replies.
Top