WoW:API GetPlayerMapPosition: Difference between revisions

m
Move page script moved page API GetPlayerMapPosition to WoW:API GetPlayerMapPosition without leaving a redirect
m (Move page script moved page API GetPlayerMapPosition to WoW:API GetPlayerMapPosition without leaving a redirect)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}} __NOTOC__


==Patch 3.0.2==
==Initialization==
NOTE: This appears to have issues with the advent of Patch 3.0.2
A one-time call to [[API SetMapToCurrentZone|SetMapToCurrentZone]]() is required before GetPlayerMapPosition() will return the correct values.
It seems to be only working intermittently.
 
Until you open the world map, this always seems to return (0,0). <br>
After you open and close the world map, the coords return the correct values. <br>
 
Start your code with the following two lines in your OnInitialize Section: <br>
WorldMapFrame:Show() <br>
WorldMapFrame:Hide() <br>


==Usage==
==Usage==
Line 28: Line 20:
:;posY : Number - Y value of the unit position (a proportion between 0 and 1, relative to WorldMapDetailFrame)
:;posY : Number - Y value of the unit position (a proportion between 0 and 1, relative to WorldMapDetailFrame)


{{spc}}
: If both posX and posY are exactly 0, the position is unknown, unknowable, or not valid for the current map, i.e.
: If both posX and posY are exactly 0, the position is unknown, unknowable, or not valid for the current map, i.e.
:* The player is inside an instance: the game will never return coordinates inside an instance. (CHANGED AS OF 3.0.1 - coordinates are returned within instances)
:* The map hasn't been updated yet; either open the map or use [[API SetMapToCurrentZone|SetMapToCurrentZone]]() after entering a new zone
:* The map hasn't been updated yet; either open the map or use [[API SetMapToCurrentZone|SetMapToCurrentZone]]() after entering a new zone
:* An unsupported [[unitId]] was given.
:* An unsupported [[unitId]] was given.
Anonymous user