Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetCampaignCityData

From RoR Wiki
Revision as of 19:43, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · RvR functions
Version: WAR 1.4.8

Returns the RvR campaign state of a capital city.

cityData = GetCampaignCityData(cityId)

Arguments

cityId
number – City id, for example GameData.CityId.EMPIRE or GameData.CityId.CHAOS.

Returns

cityData
table – City table (see below), or nothing if the id is invalid.
Key Type Meaning
cityId number City id.
initialRealm number –
controllingRealm number –
cityState number State of the city. The stock map code compares city states with SystemData.CityStates values.
numFortressesCaptured number Number of captured fortresses. The stock world map shows its city locks from it.

Details

  • When the client has no campaign data at all, the function returns nothing without an error (and without checking the argument).
  • A new table is built on every call.
  • The function takes exactly one argument.

Errors

  • Error in function call 'GetCampaignCityData': Paring %d is not a valid campaign city id. (sic, "Paring"; only the low 16 bits of the id are printed)

Example

From default/ea_worldmapwindow/source/campaignview.lua:

if( GameDefs.ZoneCityIds[zoneId] ~= nil )
then
    local cityData = GetCampaignCityData( GameDefs.ZoneCityIds[zoneId] )
    WindowSetShowing(  zoneWindowName.."Lock1", cityData.numFortressesCaptured <= 1 )
    WindowSetShowing(  zoneWindowName.."Lock2", cityData.numFortressesCaptured == 0 )

See also