Lore archive · Warcraft Wiki, 2023 dump
API GetUnitSpeed
Last wiki revision 2022-08-03
Returns the movement speed of the unit. currentSpeed, runSpeed, flightSpeed, swimSpeed = GetUnitSpeed(unit)
- unit: : UnitId - The unit to query the speed of.
- currentSpeed: - current movement speed in yards per second (normal running: 7; an epic ground mount: 14)
- runSpeed: - the maximum speed on the ground, in yards per second (including talents such as Pursuit of Justice and ground mounts)
- flightSpeed: - the maximum speed while flying, in yards per second (the unit need to be on a flying mount to get the flying speed)
- swimSpeed: - the maximum speed while swimming, in yards per second (not tested but it should be as the flying mount)
The following snippet prints your current movement speed in percent: /script print(string.format("Current speed: %d%%", GetUnitSpeed("player") / 7 * 100))
As of 4.2, runSpeed, flightSpeed, swimSpeed returns were added. It seem you can also get target unit speed (not tested on the opposite faction). A constant exists: "BASE_MOVEMENT_SPEED" which is equal to 7 (4.2).
Source
https://warcraft.wiki.gg/wiki/API_GetUnitSpeed · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.