WoW:API GetPlayerMapPosition: Difference between revisions
Jump to navigation
Jump to search
GetPlayerMapPosition -Documentation by Meog-
(Added minor info about the 0,0 error and SetMapToCurrentZone.) |
No edit summary |
||
| Line 10: | Line 10: | ||
:("unit") | :("unit") | ||
:;unit : String - The [[API TYPE UnitId|UnitId]] for which the position is returned. (Does not work with all unit types. Works with <tt>player</tt>, <tt>party<i>N</i></tt> or <tt>raid<i>N</i></tt> as unit type. This was to disable range-checking mods). | :;unit : String - The [[API TYPE UnitId|UnitId]] for which the position is returned. (Does not work with all unit types. Works with <tt>player</tt>, <tt>party<i>N</i></tt> or <tt>raid<i>N</i></tt> as unit type. In particular, it does not work on pets. This was to disable range-checking mods). | ||
---- | ---- | ||
Revision as of 09:04, 2 December 2005
Returns the postion of a unit on the current map
posX, posY = GetPlayerMapPosition("unit");
- Arguments
- ("unit")
- 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 0, then the position is unknown, unknowable, or not valid for the current map. This usually happens inside an instance, if the map hasn't been updated (by either opening the map or using SetMapToCurrentZone) after entering a new zone, or using a UnitId other than the ones above.
- Example
local posX, posY = GetPlayerMapPosition("player");
- Result
0.43320921063423, 0.69365233182907