• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

How to Make a Unit Immune to Movement Slow?

Status
Not open for further replies.
Level 4
Joined
Dec 24, 2016
Messages
42
Hello Everyone,

I am watching to create an equip-item that allows the user to ignore all movement-speed-slowing effects. I do not want to create a trigger that will just remove all buffs affiliated with movement speed debuffs because the intent is to remove just the movement speed slow and not other effects like the damage reduction from Cripple or Damage-over-time from Slow Poison.

I have considered changing the movement speed via trigger each time a buff is detected and set the unit's movement speed to its default (with or without boots of speed). However, I have not experimented that much with this function as I have been encouraged not to use it. Regardless, is there a function that will allow the user to gain its speed (before becoming slowed) all the while ignoring all incoming slows. I would also like to make sure that speed boosts (Scroll of Speed, Berserk) do not screw up the function if the unit was slowed at the time. Is it possible to do this? or no? Worst case scenario, I will just make it so the item will remove all buffs affiliated with the slowing effect. However, all help concerning this issue will be helpful.
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
Yes it't possible. Just check the attached map.

Basic idea: Check which slowing effects the target has and then increase its movement speed to compensate the slow.

I used 4 abilities that add movement speed (+50/100/200/400%).
Should work fine, except that these abilities show buffs on the unit which may not be intended.
You could try to find a different ability to increase movement speed, that does not add a buff.
Maybe Engineering Upgrade?
You should add all slowing effects in your map to the conditions.
For abilities with several levels and different slows you need different buffs to know how much the unit is slowed.

After adding the speed bonus abilties I adjust the exact movement speed value by Set movement speed.
The value will not be the exact movement speed of the unit before slowed, but very accurate.
The inaccuary comes from the real/real operation and should not be noticed ingame. However the movement speed descriptions might be wrong, because the inaccuracy puts movement speed above the threshhold (my Knight had 350.00003) which put him above 350 and made him very fast.

I don't know how fast this trigger is. A lot of abilities are added/removed and each buff that slows has to be included in the conditions. I think if you only use it for items on several heroes it should be fine. Should not be used on whole armies.

  • Detect Slow
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 0 to 3, do (Actions)
            • Loop - Actions
              • Set MOV_Use_Ability[(Integer A)] = False
          • Set MOV_Mult = 1.00
          • -------- ------------------------------------------------- --------
          • -------- Here should be all slowing effects in the map --------
          • -------- ------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Slow) Equal to True
            • Then - Actions
              • Set MOV_Mult = (MOV_Mult - 0.60)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Cripple) Equal to True
            • Then - Actions
              • Set MOV_Mult = (MOV_Mult - 0.75)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Slow Poison (Non-stacking)) Equal to True
            • Then - Actions
              • Set MOV_Mult = (MOV_Mult - 0.50)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Slowed) Equal to True
            • Then - Actions
              • Set MOV_Mult = (MOV_Mult - 0.50)
            • Else - Actions
          • -------- ------------------------------------------------- --------
          • -------- add+ movement speed --------
          • -------- ------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Mult Less than or equal to -3.00
            • Then - Actions
              • Unit - Add +400% to (Picked unit)
              • Set MOV_Use_Ability[3] = True
              • Set MOV_Mult = (MOV_Mult + 4.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Mult Less than or equal to -1.00
            • Then - Actions
              • Unit - Add +200% to (Picked unit)
              • Set MOV_Use_Ability[2] = True
              • Set MOV_Mult = (MOV_Mult + 2.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Mult Less than or equal to 0.00
            • Then - Actions
              • Unit - Add +100% to (Picked unit)
              • Set MOV_Use_Ability[1] = True
              • Set MOV_Mult = (MOV_Mult + 1.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Mult Less than or equal to 0.50
            • Then - Actions
              • Unit - Add +50% to (Picked unit)
              • Set MOV_Use_Ability[0] = True
              • Set MOV_Mult = (MOV_Mult + 0.50)
            • Else - Actions
          • -------- ------------------------------------------------- --------
          • -------- remove + movement speed --------
          • -------- ------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Use_Ability[3] Equal to False
            • Then - Actions
              • Unit - Remove +400% from (Picked unit)
              • Unit - Remove Speed +400% buff from (Picked unit)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Use_Ability[2] Equal to False
            • Then - Actions
              • Unit - Remove +200% from (Picked unit)
              • Unit - Remove Speed +200% buff from (Picked unit)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Use_Ability[1] Equal to False
            • Then - Actions
              • Unit - Remove +100% from (Picked unit)
              • Unit - Remove Speed +100% buff from (Picked unit)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Use_Ability[0] Equal to False
            • Then - Actions
              • Unit - Remove +50% from (Picked unit)
              • Unit - Remove Speed +50% buff from (Picked unit)
            • Else - Actions
          • -------- ------------------------------------------------- --------
          • -------- set movement speed --------
          • -------- ------------------------------------------------- --------
          • Unit - Set (Picked unit) movement speed to ((Default movement speed of (Picked unit)) / MOV_Mult)
          • -------- ------------------------------------------------- --------
          • -------- debug --------
          • -------- ------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MOV_Mult Not equal to 1.00
            • Then - Actions
              • Game - Display to (All players) the text: (String(MOV_Mult))
              • Game - Display to (All players) the text: (String((Current movement speed of (Picked unit)), 4, 10))
            • Else - Actions
 

Attachments

  • test8.w3x
    19.2 KB · Views: 64
Level 4
Joined
Dec 24, 2016
Messages
42
Wow. Thank you for the help. I think your function could work (if abilities count exceed 10). Unfortunately, I would have to implement about "50!!!" different slow debuffs esp with taking into account the fact I have to set different debuffs for each leveling slow spell. Is this going to be a problem for the game's speed? I would set up a for-loop for individual heroes (via array) instead of setting up a unit group in hopes to minimize game lag. Will this work? I also want to ask how you are calculating your "add-speed" functions. I am having a hard time grasping the idea (50%?/100%?/200%?/400%?). What will I need to change those values to match the different types of slow-amounts?
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
I don't think that checking for the slowing debuffs will be a problem. As long as you don't have too many units with this effect it should be ok. Since you only use individual heroes it should work fine. You can of course change the periodic timer, if you want to increase performance.

The add speed functions do not have a direct relation to the slow amount of individual slows.
The system works like this:
I add all active slow effects on a unit to a real variable MOV_Mult.
1.00 = normal speed
0.50 = half speed
In the end I will increase movement speed by trigger by 1/MOV_Mult
However if MOV_MULT is far different than 1.00, weird things will happen.
With enough slow, MOV_MULT will be negative. This worked, as long as the unit has no speed bonus.
To have MOV_MULT somewhere near 1.00 I created these add speed functions.
The question is how many speed bonus abilties should you have.
My first speed bonus ability is 50% which means that I can have MOV_Mult in the range of 0.50-1.00, which can easily be compensated by triggers.
You need enough speed bonus abilities, so that the sum (750% in my case) is enough to compensate all slow effects on the unit.
You should be realistic here. How much slow will a unit have at the same time? Usually a unit will not have all 50 slow effects at the same time.
The next add speed abiltiy should always be twice the previous one.

These are the abilties of warcraft ,that slow:

70 frost arrow
50 slowed (frost)
50 slow poison
60 slow
75 cripple
50 drunken haze
60 Tornado

Did I miss something?
Sum is 415, so 750% would be enough for normal wracraft.

Some other spells that slow:

Hex/Polymorph change the unit to a slow moving unit. It is no %slow as the other ones. My system will still remove the slow from these abilties. Do not add these abilties to the conditions. They are automatically handled, because I set the movement speed of the unit to default movement speed / MOV_Mult.

Purge uses a different weird movement speed change. Purged units will still be slowed with this system.

Shadow strike's slow becomes weaker over time. Does not work well with this system, because you need to know how much the abilities slow in order to remove the slow effect.
 
Status
Not open for further replies.
Top