• 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.

[General] Limitations of Set Unit Speed?

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
No matter how small of a number I put in for the speed, it seems to not go any slower then a certain amount.

This is my code:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (CloakingUnit[CloakLevelInit] has buff Cloaking ) Equal to True
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cloak for CloakingUnit[CloakLevelInit]) Equal to 1
        • Then - Actions
          • Custom script: set udg_CloakSpeedBonus[udg_CloakLevelInit] = .0010
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Cloak for CloakingUnit[CloakLevelInit]) Equal to 2
            • Then - Actions
              • Custom script: set udg_CloakSpeedBonus[udg_CloakLevelInit] = .0025
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Cloak for CloakingUnit[CloakLevelInit]) Equal to 3
                • Then - Actions
                  • Custom script: set udg_CloakSpeedBonus[udg_CloakLevelInit] = .0040
                • Else - Actions
    • Else - Actions
  • Game - Display to (All players) the text: (String(CloakSpeedBonus[CloakLevelInit]))
  • Unit - Set CloakingUnit[CloakLevelInit] movement speed to ((Default movement speed of CloakingUnit[CloakLevelInit]) / CloakSpeedBonus[CloakLevelInit])
And as you can see, I have that "Display Text" there, and each time it prints for the loop, it prints:

"0.010"
"0.025"
"0.040"

But each unit moves at the same speed...

What is the code for the "SetUnitMoveSpeed takes unit whichUnit, real newSpeed returns nothing"

In Common.j? I can't seem to find it anywhere. Maybe that'll help me figure something out.

EDIT: Also, as for my other recent thread, I have fixed the issue and I'll update it soon with my solution for future references.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
Unit - Set CloakingUnit[CloakLevelInit] movement speed to ((Default movement speed of CloakingUnit[CloakLevelInit]) / CloakSpeedBonus[CloakLevelInit])
I think your mathematics are messed up...

At level 1 you are setting the movement speed to default movement speed (say 10 (12.8 second to cross a tile) divided by 0.01. This results in a movement speed of 1000 which exceeds the maximum unit speed of 577 (not sure, something like that) which is only enabled by raising the maximum movement speed in the game play constants from something lower. As you raise levels you get slower (level 3 is only 250 movement speed for a 10 speed default unit, a possible value).

I do not see any reason to do this as it converts a small unit of speed into a very large unit of speed prone to capping off the game engine. Are you sure you do not mean....

Unit - Set CloakingUnit[CloakLevelInit] movement speed to ((Default movement speed of CloakingUnit[CloakLevelInit]) / (1 - CloakSpeedBonus[CloakLevelInit]))

Which would make more sense or...

Unit - Set CloakingUnit[CloakLevelInit] movement speed to ((Default movement speed of CloakingUnit[CloakLevelInit]) * (1 + CloakSpeedBonus[CloakLevelInit]))

Which also makes more sense.
 
Level 12
Joined
May 20, 2009
Messages
822
@_@

Yes, you are completely right...I was on a one-track mind there, trying to make 10% by dividing by a decimal...

When instead I could just multiple by 1.1 and that's 10% right there....

Thanks, I wish I would have realized that earlier.

(320, the base movement speed of my hero, divided by .001 is 320,000!!!)

EDIT: Really, the whole idea behind this spell is just a toggleable Wind Walk without the Backstab damage. And it also stays on until it has zero mana. (Or of course until turned off)
 
Level 12
Joined
May 20, 2009
Messages
822
Might be that you haven't changed the minimum unit speed to zero or something small.

Nah, Super Good was correct. xD! I was waaaay exceeding the max unit speed by dividing by .001, .0025, .0040...Which caused 320,000 speed, 128,000, and 80,000 respectively...

Which of course, is FAR beyond the 522 max unit speed.

EDIT: Is there any way to make the text from this speed bonus be green instead of Red? The function ALWAYS makes it a "Negative" bonus to speed, making it be "Speed: Very Fast" instead of "Speed: Very Fast"
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
EDIT: Is there any way to make the text from this speed bonus be green instead of Red? The function ALWAYS makes it a "Negative" bonus to speed, making it be "Speed: Very Fast" instead of "Speed: Very Fast"
I think if it hits the game limits it becomes red anyway. Remember that you actually need to set 522 as the maximum in game constants (it defaults slower).

Most people ignore that field anyway as "very fast" is not at all helpful in decerning movement speed. SC2 did away with that and instead gives you a speed metric like 2.2+0.1 as an example.

Also be aware that default speed may actually be slower than the unit's current speed. Default speed + X% may actually be slower than the unit's current speed when under the affect of endurance aura, boots of speed, bloodlust or any source of movement speed increase.
 
Level 12
Joined
May 20, 2009
Messages
822
I think if it hits the game limits it becomes red anyway. Remember that you actually need to set 522 as the maximum in game constants (it defaults slower).

Most people ignore that field anyway as "very fast" is not at all helpful in decerning movement speed. SC2 did away with that and instead gives you a speed metric like 2.2+0.1 as an example.

Also be aware that default speed may actually be slower than the unit's current speed. Default speed + X% may actually be slower than the unit's current speed when under the affect of endurance aura, boots of speed, bloodlust or any source of movement speed increase.

All of those effects you mentioned won't be too much of a hassle, if any of those effect a unit (Except maybe Bloodlust) and I reset to default, they'll just take effect again immediately afterword.

Ontop of that, I think the Gameplay Constants field of Max Speed is ignored, because not only does Windwalk take the Blademaster well over 400 speed @ level 3 (I think), but using triggers I can also use MAX speed of 522 (Or at least it looks like it)

However, things like Bloodlust and Scroll of Speed may still be an issue. I'm not too worried about it right now, though. It'll be an easy fix anyway if it is.

EDIT: 300, which is the Blademaster's default movement speed, +70% from Windwalk Level 3 is 510.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
, they'll just take effect again immediately afterword.
I think resetting to default speed sets the speed (with the boosts factored in) to the default amount so when boosts are removed the unit will be slower than default speed. This is why it is strongly not recommended to use triggers to modify speed in parallel to standard buffs (or at least that is what I have thought all this time, maybe I am wrong).

Ontop of that, I think the Gameplay Constants field of Max Speed is ignored, because not only does Windwalk take the Blademaster well over 400 speed @ level 3 (I think), but using triggers I can also use MAX speed of 522 (Or at least it looks like it)
Maybe, not sure.

EDIT: 300, which is the Blademaster's default movement speed, +70% from Windwalk Level 3 is 510.
Who says it can use all that speed? It might be reserved for in case of debuffs like slow.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Yeah blademan breaks gameplay constant limit with windwalk, he is dread of melee games.
 
Level 12
Joined
May 20, 2009
Messages
822
Well, like I said. I'm not too worried about it at this moment. If I notice that it is in fact reseting it to default without calculating Boots of Speed, or Bloodlust, or something else, then it's an easy fix anyway.

Just save the current speed into a variable before changing the speed at all, then add the new speed, then when removing the speed buff, check if any speed-applying effects are on the unit, and if it is then just reset the speed to the variable. And if not, then divide/multiple the speed in a way to remove the bonus that the speed-applying effects did.

Like,

Unit is issued order with no target
Order equal to immolation

Set DefaultSpeed = Current Speed of Unit
Set speed of unit to (Speed of unit x 1.25) (1.25 = 25%)
-------
(Etc)
Order equal to unimmolation
If
Unit has buff Bloodlust equal to true then
Set speed of unit to DefaultSpeed
Else
Set DefaultSpeed = DefaultSpeed x .75
Set Speed of unit to DefaultSpeed


x .75 removes 25%, which is the bonus Bloodlust gives.

EDIT: After doing some tests, I have found two things:

Setting speed to "Default" does in fact NOT interrupt speed bonuses from from Bloodlust or Boots of speed.

My heroes speed is 320. +Bloodlust makes 400 speed. Plus only Boots of speed makes 380. Plus both makes 475, doesn't matter what order they come in. + my speed bonus makes 500, 516, and 522+ Respectively. Reverting back and forth between cloaking and not cloaking, the speed seems to be respectively 400, 380, or 475, when having Bloodlust or Boots of Speed or Both.

It also seems that when you USE the Gameplay Constants, the speed max is set to 400. But, on my compile map, where I do NOT have "Use Custom Gameplay Constants" enabled, the "Max Speed" seems to be set to 522!
 
Last edited:
Status
Not open for further replies.
Top