City Lists - How to mod them? - SOLVED

IgorS

Your ad could be here!
Joined
Sep 28, 2008
Messages
2,297
Location
Rishon
How to mod city lists.
I want to thank everyone who tried to help me (see discussion below).

OK, now the solution. We will change the city list for Sumer.

1. We will create a brand new city list in an XML file, like this:
Spoiler Sumer City List :

<GameData>
<LocalizedText>
<!--Sumeria-->
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_00" Language="en_US">
<Text>Unug</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_01" Language="en_US">
<Text>Eridu</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_02" Language="en_US">
<Text>Bad-tibira</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_03" Language="en_US">
<Text>Larsa</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_04" Language="en_US">
<Text>Zimbir</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_05" Language="en_US">
<Text>Shuruppak</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_06" Language="en_US">
<Text>Kish</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_07" Language="en_US">
<Text>Urim</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_08" Language="en_US">
<Text>Lagash</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_09" Language="en_US">
<Text>Nibru</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_10" Language="en_US">
<Text>Girsu</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_11" Language="en_US">
<Text>Adab</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_12" Language="en_US">
<Text>Isin</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_13" Language="en_US">
<Text>Umma</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_14" Language="en_US">
<Text>Hamazi</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_15" Language="en_US">
<Text>Mari</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_16" Language="en_US">
<Text>Akshak</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_17" Language="en_US">
<Text>Akkad</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_18" Language="en_US">
<Text>Kuara</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_19" Language="en_US">
<Text>Zabala</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_20" Language="en_US">
<Text>Kisurra</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_21" Language="en_US">
<Text>Marda</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_22" Language="en_US">
<Text>Dilbat</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_23" Language="en_US">
<Text>Borsippa</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_24" Language="en_US">
<Text>Gudua</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_25" Language="en_US">
<Text>Der</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_26" Language="en_US">
<Text>Eshnunna</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_27" Language="en_US">
<Text>Nagar</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_28" Language="en_US">
<Text>Larak</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_29" Language="en_US">
<Text>Eresh</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_30" Language="en_US">
<Text>Nina</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_31" Language="en_US">
<Text>Pazurish-Dagan</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_32" Language="en_US">
<Text>Harbidum</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_33" Language="en_US">
<Text>Failaka</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_34" Language="en_US">
<Text>Kid-nun</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_35" Language="en_US">
<Text>Urukag</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_36" Language="en_US">
<Text>Kesh</Text>
</Row>
<Row Tag="LOC_CITY_NAME_SUMERIA_CITY_37" Language="en_US">
<Text>Shaduppum</Text>
</Row>
</LocalizedText>
</GameData>


2. We go to our mod properties and then to "In-Game Actions". We add an action, and give it any name we want, and choose the type UpdateText. We add our XML file to the file list that appears below.

3. We create another XML file, and write the following code:
Spoiler Database Code :

<GameData>
<CivilizationLeaders>
<Replace CivilizationType="CIVILIZATION_SUMERIA" LeaderType="LEADER_GILGAMESH" CapitalName="LOC_CITY_NAME_SUMERIA_CITY_00"/>
</CivilizationLeaders>
<CityNames>
<Delete CivilizationType="CIVILIZATION_SUMERIA"/>
<!-- Sumeria -->
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_00"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_01"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_02"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_03"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_04"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_05"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_06"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_07"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_08"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_09"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_10"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_11"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_12"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_13"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_14"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_15"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_16"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_17"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_18"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_19"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_20"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_21"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_22"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_23"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_24"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_25"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_26"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_27"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_28"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_29"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_30"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_31"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_32"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_33"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_34"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_35"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_36"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_37"/>
</CityNames>
</GameData>

Basically, what we do here is tell the game to use as a capital a city from our new list, and not the one set as default. Then, we delete the city list for the Sumerian civilization and replace it with our own.

4. Now, we go back to the mod properties, and create a new in-game action, only this time of the type UpdateDatabase, and add our database XML file to the list.

5. Build our mod, and voila!
 
Last edited:
To delete all cities of a certain civilization, using SQL, the following delete statement:

DELETE FROM CityNames WHERE CivilizationType='CIVILIZATION_AMERICA';

BUT, note the ID numbers for the range of cities before deleting.

To then insert new cities for a civilization:

INSERT INTO CityNames (ID, CivilizationType, LeaderType, ContinentType, CityName, SortIndex) VALUES
(X, 'CIVILIZATION_AMERICA', NULL, NULL, 'LOC_CITY_NAME_SPRINGFIELD', 0);

WHERE X is he ID number of the first city you deleted, until the last city you replace.
 
Last edited:
To delete all cities of a certain civilization, using SQL, the following delete statement:

DELETE FROM CityNames WHERE CivilizationType='CIVILIZATION_AMERICA';

BUT, note the ID numbers for the range of cities before deleting.

To then insert new cities for a civilization:

INSERT INTO CityNames (ID, CivilizationType, LeaderType, ContinentType, CityName, SortIndex) VALUES
(X, 'CIVILIZATION_AMERICA', NULL, NULL, 'LOC_CITY_NAME_SPRINGFIELD', 0);

WHERE X is he ID number of the first city you deleted, until the last city you replace.
Thanks. Is SQL the only way? Or is there an option with XML?
 
Trying to do this with XML, but nothing works. Here is the code I used. What is wrong?

Changing Sumer's Capital:
<GameInfo>
<CivilizationLeaders>
<Delete CivilizationType="CIVILIZATION_SUMERIA"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" LeaderType="LEADER_GILGAMESH" CapitalName="LOC_CITY_NAME_SUMERIA_CITY_00"/>
</CivilizationLeaders>
</GameInfo>

Replacing Sumer's city list:
<GameInfo>
<CityNames>
<Delete CivilizationType="CIVILIZATION_SUMERIA"/>
<!-- Sumeria -->
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_00"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_01"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_02"/>
<Row CivilizationType="CIVILIZATION_SUMERIA" CityName="LOC_CITY_NAME_SUMERIA_CITY_03"/> (etc...)
</CityNames>
</GameInfo>

Why won't it work?

What about the mod settings? I have added the xml as an "update database" command. Is that right?
 
I think it's way simpler than that. You don't need to worry about the mechanics of attaching any city names to CIVILIZATION_SUMERIA. You can just update the names themselves, the LOC's:

Create a .sql file. Like NewCityNames.sql

Include bits like this:

Code:
update LocalizedText
set Text = 'Newtown'
where Language = 'en_US'
and Tag = 'LOC_CITY_NAME_SUMERIA_CITY_01';

You'll have to add the SQL file name to one of the two UpdateText Actions. I'm not sure which one for city names, but my guess would be In-Game.

The xml's only end up triggering sql statements, so this will actually run quicker (not that either will be slow).
 
I think it's way simpler than that. You don't need to worry about the mechanics of attaching any city names to CIVILIZATION_SUMERIA. You can just update the names themselves, the LOC's:

Create a .sql file. Like NewCityNames.sql

Include bits like this:

Code:
update LocalizedText
set Text = 'Newtown'
where Language = 'en_US'
and Tag = 'LOC_CITY_NAME_SUMERIA_CITY_01';

You'll have to add the SQL file name to one of the two UpdateText Actions. I'm not sure which one for city names, but my guess would be In-Game.

The xml's only end up triggering sql statements, so this will actually run quicker (not that either will be slow).
This is not what I want. I know how to add the text. I want to know how to set the city list itself. I know how to make LOC_CITY_NAME_SUMERIA_CITY_01 display the city name. I want to know how to actually insert LOC_CITY_NAME_SUMERIA_CITY_01 into the game. And how to make it the capital.
The question is NOT about adding text, but actually making the city list work, modding the info in the Civilizations.xml file.
 
for redirecting from Rome to Ostia, this works just fine:
Code:
<GameData>
	<CivilizationLeaders>
		<Replace CivilizationType="CIVILIZATION_ROME" LeaderType="LEADER_TRAJAN" CapitalName="LOC_CITY_NAME_OSTIA"/>
	</CivilizationLeaders>
</GameData>
It is the more-direct approach alternative to deleting then re-stating. You do need the file's action set up as <UpdateDatabase id="XML_GameplayChanges"> in the modinfo file. And it needs to be under <Components> (ie, <InGameActions> if you are using modbuddy).

Table <CityNames> is also on the InGame (Components) side so would need the same kind of modinfo action, and can be in the same xml file or sql file as the example code I tested.

Column ID in table <CityNames> seems to be auto-asserted so you probably do not need to include it. Nor does Firaxis include it in their XML code. This is similar to the way (ID) was handled in civ5.
Column SortIndex in <CityNames> defaults to a value of '0' and appears to not be used since all entries in the database are '0'.
 
Last edited:
for redirecting from Rome to Ostia, this works just fine:
Code:
<GameData>
    <CivilizationLeaders>
        <Replace CivilizationType="CIVILIZATION_ROME" LeaderType="LEADER_TRAJAN" CapitalName="LOC_CITY_NAME_OSTIA"/>
    </CivilizationLeaders>
</GameData>
It is the more-direct approach alternative to deleting then re-stating. You do need the file's action set up as <UpdateDatabase id="XML_GameplayChanges"> in the modinfo file. And it needs to be under <Components> (ie, <InGameActions> if you are using modbuddy).

Table <CityNames> is also on the InGame (Components) side so would need the same kind of modinfo action, and can be in the same xml file or sql file as the example code I tested.

Column ID in table <CityNames> seems to be auto-asserted so you probably do not need to include it. Nor does Firaxis include it in their XML code. This is similar to the way (ID) was handled in civ5.
Column SortIndex in <CityNames> defaults to a value of '0' and appears to not be used since all entries in the database are '0'.
Thank you. Can't say I made sense of everything you wrote, but I am going to try this stuff out now, and see how it goes.
I hope I can figure it out now.

But should the code I posted above work? Did I just not define the modinfo correctly?
 
without the mod itself to look at it is impossible to say
OK! Thanks a lot, I got it to work!
Now, I only need to figure out how to insert my city lists instead of the game's, and I can get this mod working.
 
without the mod itself to look at it is impossible to say
Well, it seems to work, I guess. I need more testing to do, but I guess it works. And I think I know what my mistake was. Instead of <GameData> I wrote <GameInfo> because I thought this is what it was supposed to say since the civilizations.xml file starts with <GameInfo>. Anyway, I hope my mod works, and if it does, I will post the xml code here so others could see a ready code.

Oh, and still no one has answered my question about two civs having the same city name but with different codes. Like, say, Greece and Macedon both having Pella as a city name, only for Greece the code is (for instance) LOC_GREECE_PELLA and for Macedon it is LOC_MACEDON_PELLA. Could it cause problems, crashes, or stuff like that?
 
The game behaves the same whether you state <GameInfo> -- </GameInfo> at the beginning/end of the file or <GameData> -- </GameData>.

Re the same city name "In-Game" you'd have to test since no one seems to have a ready answer. This is the same method we all end up using to figure out what makes the game go *poof* if no one else has already tried something in particular.
 
The game behaves the same whether you state <GameInfo> -- </GameInfo> at the beginning/end of the file or <GameData> -- </GameData>
Thanks for that. I figured as much, but confirmation helps.
 
The game behaves the same whether you state <GameInfo> -- </GameInfo> at the beginning/end of the file or <GameData> -- </GameData>.
OK, so I guess this was not the problem, then.

Re the same city name "In-Game" you'd have to test since no one seems to have a ready answer. This is the same method we all end up using to figure out what makes the game go *poof* if no one else has already tried something in particular.
I read something about it, but, yes, there is no confirmation that this is indeed the case, so I wanted to check if anyone actually experienced such a thing. Plus, I noticed that Firaxis renamed Newcastle to Newcastle-upon-Tyne after the release of the Australia DLC (because Australia also has Newcastle as a city name).
 
You can rename cities on the city details screen, or with lua, to have identical names and it doesn't cause any problems, so I see no reason why having two LOC_CITY_NAME strings with identical text would cause problems.

The game's quite happy to have multiple cities with identical names, regardless of who owns them, and they all show up in dialogues like the trade route chooser, diplo trade or spy destination.

This is in contrast to Civ BE, which did not allow duplicate names and would automatically pick a different one if you tried to assign a name that was already used.

p.s. England has both "Newcastle" and "Newcastle-upon-Tyne" in it's city list, which hasn't changed since launch.
 
You can rename cities on the city details screen, or with lua, to have identical names and it doesn't cause any problems, so I see no reason why having two LOC_CITY_NAME strings with identical text would cause problems.

The game's quite happy to have multiple cities with identical names, regardless of who owns them, and they all show up in dialogues like the trade route chooser, diplo trade or spy destination.

This is in contrast to Civ BE, which did not allow duplicate names and would automatically pick a different one if you tried to assign a name that was already used.

p.s. England has both "Newcastle" and "Newcastle-upon-Tyne" in it's city list, which hasn't changed since launch.
Yes, this is exactly what I thought. I only asked this question, because I read somewhere that the game can crash if there are two cities of the same name. I guess this was just someone's wrong assumption.
 
OK. The mod works. Problem solved. See first post for solution.
 
Back
Top Bottom