WoW:API UnitLevel: Difference between revisions

(Set as {{wowapi}}, copy-edited for tone, clarity)
m (Move page script moved page API UnitLevel to API UnitLevel without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
(No difference)

Latest revision as of 04:47, 15 August 2023

WoW API < UnitLevel

Returns the unit's level.

 /script SendChatMessage("Level "..UnitLevel("target"));

If the current target is a Level 50 mob, this macro will print Level 50 in your chat window. If the unit's level is unknown, i.e. a Level ?? target, or is a special boss, UnitLevel() will return -1.

Details

Note that the value returned by UnitLevel("player") will most likely be incorrect when called in a PLAYER_LEVEL_UP event handler, or shortly after leveling in general. Check PLAYER_LEVEL_UP arg1 for the correct level.