- Joined
- Jan 30, 2013
- Messages
- 12,879
Can this be used along with UnitMovementSpeedX?
Movement Speed:
The formula for unit movement speed is:
speed = (default speed * multiplier + bonus + other1)*other2
The "other" variables are movement speed bonuses offered by the object editor from abilities such as Unholy Aura and Item Movement Speed Bonus. Additive abilities such as the Boots of Speed contribute to "other1" while multiplicative abilities such as Endurance Aura contribute to "other2".
Hashtable addresses:
Positive Unit Handle ID -> Move Bonus
Negative Unit Handle ID -> Move Multiplier
Actions

Set GMSS_MoveBonus = YourBonus

Set GMSS_MoveMultiplier = YourMultiplier

Set GMSS_Target = YourUnit

Trigger - Run GMSS Main <gen> (checking conditions)
Actions

Set GMSS_MoveBonus = YourBonus

Set GMSS_MoveMultiplier = YourMultiplier

Set GMSS_MinimumSpeed = YourMinSpeed

Set GMSS_MaximumSpeed = YourMaxSpeed

Set GMSS_Target = YourUnit

Trigger - Run GMSS Main <gen> (ignoring conditions)
Actions

Set GMSS_MoveMultiplier = NegativeNumber

Set GMSS_Target = YourUnit

Trigger - Run GMSS Main <gen> (ignoring conditions)
//===================================================
// Simple configuration
//===================================================
/*
Just change these numbers to whatever you want, you can also set them to a variable (remember to
put "udg_" in front of the variable)
*/
function GMSS_GetDefaultMaxSpeed takes nothing returns real
return 522.0 // Value for Default Maximum Speed
endfunction
function GMSS_GetDefaultMinSpeed takes nothing returns real
return 0.000 // Value for Default Minimum Speed
endfunction
//===================================================
Actions

-------- YOU DON'T NEED TO CREATE A HASHTABLE, YOU CAN USE ONE YOU ALREADY HAVE --------

Hashtable - Create a hashtable

-------- ------------------------------------- --------

-------- If you don't want to create a hashtable, delete the line above and set the value of the GMSS_Hashtable to that of another hashtable --------

Set GMSS_Hashtable = (Last created hashtable)

-------- ------------------------------------- --------

-------- This is the child hashtable used by the system. Make sure it has free addresses in the range of Unit Handle IDs --------

Set GMSS_HASHTABLE_ADDRESS = 0
Actions

Set GMSS_Hashtable = YOUR_HASHTABLE

-------- ------------------------------------- --------

-------- This is the child hashtable used by the system. Make sure it has free addresses in the range of Unit Handle IDs --------

Set GMSS_HASHTABLE_ADDRESS = YOUR_FREE_CHILD_HASHTABLE_NUMBER
Set GMSS_Hashtable = YOUR_HASHTABLE
' API '
// Adds "amount" to unit speed bonus and sets move speed between "minSpeed" and "maxSpeed".
function GMSS_UnitAddMoveSpeedEx
takes
unit whichUnit
real amount => //!The amount to add to the unit's move speed.
real minSpeed => //!The unit's new speed will not be lower than this value.
real maxSpeed => //!The unit's new speed will not be higher than this value.
returns
real => //!The unit's flat move speed bonus after changes are applied.
endfunction
// Multiplies unit speed multiplier by "amount" and sets move speed between "minSpeed" and "maxSpeed".
function GMSS_UnitMultiplyMoveSpeedEx
takes
unit whichUnit
real amount => //!The amount to add to the unit's move speed.
real minSpeed => //!The unit's new speed will not be lower than this value.
real maxSpeed => //!The unit's new speed will not be higher than this value.
returns
real => //!The unit's move speed multiplier after changes are applied.
endfunction
// Like GMSS_UnitAddMoveSpeedEx, but min and max values are drawn from GMSS_GetDefaultMax(Min)Speed.
function GMSS_UnitAddMoveSpeed takes unit whichUnit, real amount returns real
takes
unit whichUnit
real amount => //!The amount to add to the unit's move speed.
returns
real => //!The unit's flat move speed bonus after changes are applied.
endfunction
// Like GMSS_UnitMultiplyMoveSpeedEx, but min and max values are drawn from GMSS_GetDefaultMax(Min)Speed.
function GMSS_UnitMultiplyMoveSpeed takes unit whichUnit, real amount returns real
takes
unit whichUnit
real amount => //!The amount to add to the unit's move speed.
returns
real => //!The unit's move speed multiplier after changes are applied.
endfunction
function GMSS_UnitGetMoveBonus takes unit whichUnit returns real
takes
unit whichUnit
returns
real => //!The unit's movement speed flat bonus.
endfunction
function GMSS_UnitGetMoveMultiplier takes unit whichUnit returns real
takes
unit whichUnit
returns
real => //!The unit's movement speed multiplier.
endfunction
// Clears all Hashtable or Table data stored for 'whichUnit' in the system.
// You won't need to call this yourself unless AUTO_CLEANUP is set to false.
function GMSS_ClearData takes unit whichUnit returns nothing
takes
unit whichUnit
returns
nothing
endfunction
Command | Action |
add x | add x stacking bonus to unit movement (can be negative) |
mul x | multiply unit movement by x stacking |
get | show unit move speed |
mod | show unit move bonus and multiplier |