WoW API: GetUnitSpeed

Revision as of 04:46, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API GetUnitSpeed to API GetUnitSpeed without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WoW API < GetUnitSpeed

Added with WoW 3.0 Template:Wotlk-inline

UsageEdit

Returns a value representing the moving speed of a unit.

value = GetUnitSpeed("unit")

ParametersEdit

ArgumentsEdit

unit
String - The unitId for which the speed information is returned. This has not been tested with all units but does work for "Player" units.

ReturnsEdit

value
Number - value of the unit speed

ExamplesEdit

Player unit moving at 100% -- value = 7
Player unit moving at 175% -- value = 12.25
Player unit moving at 200% -- value = 14

Misc. CalculationsEdit

7 * 1.75 = 12.25 so apparently 7 = 100%

For example, the following will put the speed in % into the variable s.

s = string.format("%d", (GetUnitSpeed("Player") / 7) * 100);