→ WoW API
A one-time call to SetMapToCurrentZone() is required before GetPlayerMapPosition() will return the correct values.
Returns the position of a unit on the current map
posX, posY = GetPlayerMapPosition("unit");
- String - The unitId for which the position is returned. Does not work with all unit types. Works with "player", "partyN" or "raidN" as unit type. In particular, it does not work on pets. This was to disable range-checking mods.
- posX, posY
- Number - X value of the unit position (a proportion between 0 and 1, relative to WorldMapDetailFrame)
- Number - Y value of the unit position (a proportion between 0 and 1, relative to WorldMapDetailFrame)
- If both posX and posY are exactly 0, the position is unknown, unknowable, or not valid for the current map, i.e.
local posX, posY = GetPlayerMapPosition("player");