<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AGetCityInstanceId</id>
	<title>API:GetCityInstanceId - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AGetCityInstanceId"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetCityInstanceId&amp;action=history"/>
	<updated>2026-10-18T04:54:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:GetCityInstanceId&amp;diff=30362&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetCityInstanceId&amp;diff=30362&amp;oldid=prev"/>
		<updated>2026-10-16T19:43:22Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Scenario}}&lt;br /&gt;
Returns the instance number of the city the player is in, wrapped in a table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
data = GetCityInstanceId()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;data : &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; – A table with one field:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Type !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;instanceId&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || City instance number stored by the client.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The value is a single number kept by the client; the function does not check whether the player is actually in a city instance. The stock UI only calls it while &amp;lt;code&amp;gt;GameData.Player.isInSiege&amp;lt;/code&amp;gt; is true.&lt;br /&gt;
* The result is always a table, never a plain number. Read &amp;lt;code&amp;gt;data.instanceId&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;default/ea_scenariosummarywindow/scenariosummarywindow.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if ( GameData.Player.isInSiege )&lt;br /&gt;
then&lt;br /&gt;
    local cityName = GetZoneName( GameData.Player.zone )&lt;br /&gt;
    local instanceIdData = GetCityInstanceId()&lt;br /&gt;
    LabelSetText( &amp;quot;ScenarioSummaryWindowScenarioName&amp;quot;, GetStringFormat( StringTables.Default.TEXT_CITY_INSTANCE_LABEL, { cityName, instanceIdData.instanceId } ) )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:GetCampaignCityData|GetCampaignCityData]]&lt;br /&gt;
* [[API:GetCityRatingForCityId|GetCityRatingForCityId]]&lt;br /&gt;
* [[API:GameData.GetScenarioPlayers|GameData.GetScenarioPlayers]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>