WoW:API GetBattlefieldPosition: Difference between revisions
Jump to navigation
Jump to search
(Documented from Blizzard_BattlefieldMinimap.lua) |
m (Move page script moved page API GetBattlefieldPosition to API GetBattlefieldPosition without leaving a redirect) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
Retrieves the location and name of a player in the battleground not in | {{wowapi}} | ||
Retrieves the location and name of a player in the battleground that is not in the same party or raid as you. | |||
posX, posY, name = GetBattlefieldPosition(index) | posX, posY, name = GetBattlefieldPosition(index) | ||
== Parameters == | |||
=== Arguments === | |||
:;index : Index of the player to retrieve information for | :;index : Index of the player to retrieve information for | ||
---- | ---- | ||
=== Returns === | |||
:;posX : X value of the player's position (Range from 0 to 1, relative to WorldMapDetailFrame) | :;posX : X value of the player's position (Range from 0 to 1, relative to WorldMapDetailFrame) | ||
:;posY : Y value of the player's position (Range from 0 to 1, relative to WorldMapDetailFrame) | :;posY : Y value of the player's position (Range from 0 to 1, relative to WorldMapDetailFrame) | ||
:;name : Name of the player | :;name : Name of the player | ||
---- | |||
=== Example === | |||
How to get the location of a player in the same party or raid group. | |||
if( GetNumRaidMembers() > 0 ) then | |||
for i=1, MAX_RAID_MEMBERS do | |||
local posX, posY = GetPlayerMapPosition( "raid" .. i ); | |||
if( posX ~= 0 and posY ~= nil ) then | |||
local playerName = UnitName( "raid" .. i ); | |||
end | |||
end | |||
else | |||
for i=1, MAX_PARTY_MEMBERS do | |||
local posX, posY = GetPlayerMapPosition( "party" .. i ); | |||
if( posX ~= 0 and posY ~= 0 ) then | |||
local playerName = UnitName( "party" .. i ); | |||
end | |||
end | |||
end | |||
---- | ---- | ||
__NOTOC__ | |||
Latest revision as of 04:45, 15 August 2023
← WoW API < GetBattlefieldPosition
Retrieves the location and name of a player in the battleground that is not in the same party or raid as you.
posX, posY, name = GetBattlefieldPosition(index)
Parameters[edit]
Arguments[edit]
- index
- Index of the player to retrieve information for
Returns[edit]
- posX
- X value of the player's position (Range from 0 to 1, relative to WorldMapDetailFrame)
- posY
- Y value of the player's position (Range from 0 to 1, relative to WorldMapDetailFrame)
- name
- Name of the player
Example[edit]
How to get the location of a player in the same party or raid group.
if( GetNumRaidMembers() > 0 ) then for i=1, MAX_RAID_MEMBERS do local posX, posY = GetPlayerMapPosition( "raid" .. i ); if( posX ~= 0 and posY ~= nil ) then local playerName = UnitName( "raid" .. i ); end end else for i=1, MAX_PARTY_MEMBERS do local posX, posY = GetPlayerMapPosition( "party" .. i ); if( posX ~= 0 and posY ~= 0 ) then local playerName = UnitName( "party" .. i ); end end end