• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Forbidding movement to a unit

Status
Not open for further replies.

Cigue

C

Cigue

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 by a moderator:
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
 
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.
Back
Top