WoW:API GetPlayerMapPosition: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Formatting mostly) |
||
| Line 1: | Line 1: | ||
{{wowapi}} __NOTOC__ | |||
Returns the postion of a unit on the current map | Returns the postion of a unit on the current map | ||
| Line 6: | Line 5: | ||
posX, posY = GetPlayerMapPosition("unit"); | posX, posY = GetPlayerMapPosition("unit"); | ||
== Parameters == | |||
=== Arguments === | |||
:;unit : String - The [[unitId]] for which the position is returned. Does not work with all unit types. Works with <tt>"player"</tt>, <tt>"party''N''"</tt> or <tt>"raid''N''"</tt> as unit type. In particular, it does not work on pets. This was to disable range-checking mods. | |||
:;unit : String - The [[ | |||
=== Returns === | |||
:posX, posY | :posX, posY | ||
| Line 19: | Line 16: | ||
:;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) | ||
If both posX and posY are 0, | {{spc}} | ||
: 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 | |||
:* 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. | |||
== Example == | |||
local posX, posY = GetPlayerMapPosition("player"); | local posX, posY = GetPlayerMapPosition("player"); | ||
=== Result === | |||
0.43320921063423, 0.69365233182907 | 0.43320921063423, 0.69365233182907 | ||
Revision as of 09:37, 11 August 2006
← WoW API < GetPlayerMapPosition
Returns the postion of a unit on the current map
posX, posY = GetPlayerMapPosition("unit");
Parameters
Arguments
- 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.
Returns
- posX, posY
- posX
- Number - X 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)
- 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
- The map hasn't been updated yet; either open the map or use SetMapToCurrentZone() after entering a new zone
- An unsupported unitId was given.
Example
local posX, posY = GetPlayerMapPosition("player");
Result
0.43320921063423, 0.69365233182907