C_Map.GetPlayerMapPosition

From Wowpedia
Jump to: navigation, search

Returns the position of the given unit for a map. Only works for the player and party members.

position = C_Map.GetPlayerMapPosition(uiMapID, unitToken)

Arguments

uiMapID 
number : UiMapID
unitToken
string : UnitId

Returns

position 
Vector2DMixin?

Examples

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

See also

External links