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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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