C_Map .GetPlayerMapPosition
(Redirected from API GetPlayerMapPosition)
Jump to navigation
Jump to search
Flavors |
---|
Links |
Info |
Added in 8.0.1 |
![]() |
This function is restricted.
|
Returns the location of the unit on a map.
position = C_Map.GetPlayerMapPosition(uiMapID, unitToken)
Arguments
Returns
- position
- table? : vector2
Example
Prints the current map coords for the player.
local map = C_Map.GetBestMapForUnit("player")
local position = C_Map.GetPlayerMapPosition(map, "player")
print(position:GetXY()) -- 0.54766619205475, 0.54863452911377
Sends a map pin to General chat for the target (but still uses your own location).
/run local c,p,t,m=C_Map,"player","target"m=c.GetBestMapForUnit(p)c.SetUserWaypoint{uiMapID=m,position=c.GetPlayerMapPosition(m,p)}SendChatMessage(format("%%t (%d%%)%s",UnitHealth(t)/UnitHealthMax(t)*100,c.GetUserWaypointHyperlink()),"CHANNEL",nil,1)
Patch changes
Patch 8.0.1 (2018-07-17): Changed to
C_Map.GetPlayerMapPosition()
and returns a vector2d.
Patch 7.1.0 (2016-10-25): Returns nil while inside a restricted area (instance/battleground/arena).
Patch 1.0.0 (2004-10-08): Added as
GetPlayerMapPosition()
See also
- WoWInterface: C_Map.GetPlayerMapPosition Memory Usage