Detecting when a units movement is reduced to 0?

HalosNTariff

New Member
Reaction score
13
Hi, I'm building a map where your units ultimate ability is only unlocked if and when you are under certain constraints, eg. if you are on less than 30% hp, or exactly 100% hp etc.

For one of my units I need the ultimate ability to become available only if its movement speed is currently 0, then when the movement speed increases again the ability is removed.

However I cannot find a way to detect when the movement speed is reduced, I tried 'a unit is issued an order targeting a point' with the condtion 'triggering units current movement speed = 0' but it didn't work.

Does anybody know how I can do this?

Thanks in advance.
 

SanKakU

Member
Reaction score
21
actually, i'm guessing it might work but your unit's movement speed isn't going to zero ever because you need to enable it in gameplay constants. point of advice though...i haven't played around with other functions like pause a unit and so forth...but i can say unless you want to actually make a unit not move at all...i would make the minimum movement speed for units be 1. that way getting to 1 at least they can slowly rotate. at movement zero they can't even do that, they're like a building. kinda weird... anyway did you change that? because if you didn't then that's your problem right there...

so yeah, go to gameplay constants and change the unit minimum movespeed or whatever it's called, i think maximum maxes out at 522 and minimum at 0. 522 is nice, but i prefer 1 over 0. most maps use 100 or greater though, i guess.

another thing to double check with which is always nice is a little thing i like to call debugging...for the action to make sure the event and condition are compatible, i always make an action that displays a message to the player that's testing the map. (usually player red, unless he's a comp or something like that)

that way i can be sure the event and condition are compatible, which is really a huge time saver when i'm working on the actions...actions are the biggest part of the trigger but they're only half of it...so if you don't get the smaller part done right and you work on the biggest part before it's done right...you could be wasting a lot of time.
 

HalosNTariff

New Member
Reaction score
13
I've already changed the gameplay constants, and it's possible to still rotate with 0 movement speed, you just can't go anywhere.

I can't check for the 'stop' order because then it would just get the ability when it wasn't moving, I need it to gain the ability when it is physically frozen i.e. it cannot move. I have a couple of abilities which freeze units so I guess I'll just have to check for those buffs.
 

UndeadDragon

Super Moderator
Reaction score
447
Yeah, checking for the buff would be the simplest way.

EDIT: I have another rep bar now :eek:
 

Tom Jones

N/A
Reaction score
437
You'll need jass:
Trigger:
  • Actions
    • Set Some_Unit = *Some unit*
    • Custom script: set udg_Some_Boolean = IssuePointOrder(udg_Some_Unit,"move",GetUnitX(udg_Some_Unit),GetUnitY(udg_Some_Unit))
    • -------- Some_Boolean will now be true if the unit can move, false if cant --------
 

SanKakU

Member
Reaction score
21
I've already changed the gameplay constants, and it's possible to still rotate with 0 movement speed, you just can't go anywhere.

i wanted to make a unit which cannot move and so i gave it 0 movement speed and guess what? it couldn't rotate. so explain that to me, then. 1 means you can't go anywhere but you can still rotate, that's what my tests have proven. why haven't yours done the same? in fact when you give a unit a base movement speed of zero it doesn't even have the move command. it basically acts like a building.

it's possible that if you didn't give a unit a base movement speed of zero and your spell or whatever is supposed to reduce his speed to zero is letting the unit rotate that your movement speed isn't going all the way down to 0. it's stopping at some point, either because of an error in calculating the movement speed reduction, or, more likely, because reducing the current speed must only go so far and not as far as zero. that would be the main thing that would make sense. yeah i just tested it and i guess it's that since the base movement speed is not zero, you are reducing the movement speed, you can rotate the unit. my theory is that the unit's movement speed is not going to zero...i guess a text message should let us know, right?

aha! i was right. you can't make a unit's movement speed go all the way to zero that way. it only goes down to one.

this trigger sets the movement speed (there are many other ways to reduce the movement speed, this is just one example.
Trigger:
  • Untitled Trigger 003
    • Events
      • Player - Player 3 (Teal) types a chat message containing zero as An exact match
    • Conditions
    • Actions
      • Unit - Set Couatl 0196 <gen> movement speed to 0.00

this trigger displays the movement speed of the unit. it shows 1.00 instead of 0.00 so you need to check for unit speed going all the way down to 1, not 0, like i already told you.
Trigger:
  • Untitled Trigger 003 Copy 2 Copy Copy
    • Events
      • Player - Player 3 (Teal) types a chat message containing ms as An exact match
    • Conditions
    • Actions
      • Game - Display to Player 3 (Teal), at offset (0.00, 0.00) the text: (String((Current movement speed of Couatl 0196 <gen>)))

actually, this taught me something interesting, which is that you can set the minimum unit movement speed to 0 instead of one and still get units able to go down only to one. so then you can add units with no move command and 0 movespeed also.

now i don't have to use movement speed minimum 1 since zero might be a little better i guess.

let me recommend this to you, if you have trouble with lining up your events and conditions properly to make actions...always test your actions by displaying the conditions and events in text messages. like what i did above just now.

edit: oh whoops i guess i already said that, didn't i?: "another thing to double check with which is always nice is a little thing i like to call debugging...for the action to make sure the event and condition are compatible, i always make an action that displays a message to the player that's testing the map. (usually player red, unless he's a comp or something like that)

that way i can be sure the event and condition are compatible, which is really a huge time saver when i'm working on the actions...actions are the biggest part of the trigger but they're only half of it...so if you don't get the smaller part done right and you work on the biggest part before it's done right...you could be wasting a lot of time. "

ok, in case you aren't sure how i did that i had to use the action conversion: convert real to string. using conversion: ...to string is really handy for getting the information you need for the debugging.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top