Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GameData.GetScenarioPlayerGroups

From RoR Wiki

UI Lua API · Scenario functions
Version: WAR 1.4.8

Returns the players of the local player's realm in the current scenario (or city siege instance), with their scenario group slot and status.

players = GameData.GetScenarioPlayerGroups()

Arguments

None.

Returns

players
table – Array of player tables, indexed from 1, or nothing if the client has no scenario data.

Each player table has these fields:

Key Type Meaning
name wstring Character name.
career wstring Career name.
careerId number Career id.
rank number Character rank.
sgroupindex number Scenario group the player is in. The stock UI treats 0 as "not in a group".
sgroupslotnum number Slot within that scenario group.
health number Health percentage.
ap number Action point percentage.
morale number –
isMainAssist boolean true for the player the client has stored as the local player's main assist (see IsPlayerMainAssist).

Details

  • Only players whose realm matches the local player's realm are listed. If there is no player object, every entry is listed.
  • Unlike GameData.GetScenarioPlayers there is no realm field and no stats.
  • When GameData.Player.isInSiege is true the client reads the city instance's list; otherwise it reads the scenario's list. If that list does not exist, the function returns nothing.

Errors

None.

Example

From default/ea_scenariogroupwindow/source/scenariogroupwindow.lua:

ScenarioGroupWindow.playerGroupData = GameData.GetScenarioPlayerGroups()
...
if( player.sgroupindex > 0 ) then
    local groupIndex = player.sgroupindex
    local groupSlotNum = player.sgroupslotnum

See also