Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Register
Advertisement

Returns the location of the unit on a map.

position = C_Map.GetPlayerMapPosition(uiMapID, unitToken)

Arguments[]

uiMapID
number : UiMapID
unitToken
string : UnitId

Returns[]

position
Vector2DMixin?🔗

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
API C Map

Sending a map pin for a target

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[]

Battle for Azeroth Patch 8.0.1 (2018-07-17): Changed to C_Map.GetPlayerMapPosition() and returns a vector2d.
Legion Patch 7.1.0 (2016-10-25): Returns nil while inside a restricted area (instance/battleground/arena).
WoW Icon update Patch 1.0.0 (2004-10-08): Added as GetPlayerMapPosition()

See also[]

Advertisement