How to skip a city name on foundation

liwy

Chieftain
Joined
Nov 15, 2009
Messages
63
Location
Brussels
Basically I want to avoid the superposition of names like with Eboracum-York-Jorvik among others, so I have coded some "name changing features" that allow a name to change under some conditions, like if the vikings conquer York it will become Jorvik. The problem is that now if the english refound a city they will create York again and that's what I want to avoid, I want the list to skip to the next name.
 
Basically I want to avoid the superposition of names like with Eboracum-York-Jorvik among others, so I have coded some "name changing features" that allow a name to change under some conditions, like if the vikings conquer York it will become Jorvik. The problem is that now if the english refound a city they will create York again and that's what I want to avoid, I want the list to skip to the next name.

You can use my Dynamic City Naming mod component to do that, and a lot more besides. Or you could pillage it for code. Essentially it lets you create a dictionary of cities and their alternate names, and with its priority system you can specify which civs or leaders are able to found them, and in which era.
 
It looks great but I have a little question: in the considered exemple I mentionned only named that are already in the list. What would happen if I remove Jorvik from the vikking list but still want the name of Eboracum/York to change to Jorvik if the scandinavians come to say hello? In the same order of idea I have a bit of code that change the name of Constantinople to Tsargrad if the slavs comes around but it should never appear in the russian city list.

Do I simply have to write this:

Spoiler :

<CityInfo>
<CityName>Byzantion</CityName>
<Civilizations>
<Civilization>
<CivilizationType>CIVILIZATION_GREECE</CivilizationType>
<CivilizationCityName>Byzantion</CivilizationCityName>
<bCivilizationCapital>0</bCivilizationCapital>
<iCivilizationPriority>2</iCivilizationPriority>
</Civilization>
<Civilization>
<CivilizationType>CIVILIZATION_BYZANTIUM</CivilizationType>
<CivilizationCityName>Constantinople</CivCityName>
<bCivilizationCapital>1</bCivilizationCapital>
<iCivilizationPriority>5</iCivilizationPriority>
</Civilization>
<Civilization>
<CivilizationType>CIVILIZATION_TURK</CivilizationType>
<CivilizationCityName>Istanbul</CivCityName>
<bCivilizationCapital>1</bCivilizationCapital>
<iCivilizationPriority>3</iCivilizationPriority>
</Civilization>
<Civilization>
<CivilizationType>CIVILIZATION_RUSSIA</CivilizationType>
<CivilizationCityName>Tsargrad</CivCityName>
<bCivilizationCapital>0</bCivilizationCapital>
<iCivilizationPriority>0</iCivilizationPriority>
</Civilization>
<Civilization>
<CivilizationType>CIVILIZATION_VIKKING</CivilizationType>
<CivilizationCityName>Miklagard</CivCityName>
<bCivilizationCapital>0</bCivilizationCapital>
<iCivilizationPriority>0</iCivilizationPriority>
</Civilization>
<Civilizations>
<Leaders/>
<Eras/>
</CityInfo>


I tried to install it and it works (after the correction of the "unicode" problem mentionned in the comments. I will make further experiments later.
 
Ah hang on. Just realised renaming on conquest was a feature I added, but never actually released. I'll try get 2.0 uploaded later today.
 
I've attached Dynamic City Naming 2.0. I'd made a number of improvements to it as part of my mod, but never got around to releasing an update to the standalone component. It's much faster, more stable, and has a few additional features such as renaming on capture.

However, it abandons the faux-XML approach and instead defines all cities in a Python dictionary at the top of DynamicCityNaming.py. Take a look at that file for instructions and examples.
 

Attachments

I think I overestimated and misjudged the structure as I directly tried to add names that have multi requirement, such as being in antiquity and Byzantine for "Byzantion" while it becomes Constantinoupolis later. In addition to I have to separate all civs or could I add 'or' like in the case of Memphis

Code:
'CITY_MENNEFER': [('CIVILIZATION_EGYPT', "Mennefer", 1, 5), ('LEADER_DJOSER', "Mennefer", 1, 5), ('CIVILIZATION_GREECE' or "CIVILIZATION_MACEDONIA" or "CIVILIZATION_INDO_GREEKS" or "CIVILIZATION_SELEUCIDE" or "CIVILIZATION_TROY", "Memphis", 0, 0), ('CIVILIZATION_BYZANTIUM', "Memphis", 0, 0)],

To be clear about what I wanted to do here is the result of what I did with Byzantium

Code:
'CITY_BYZANTIUM' : [('CIVILIZATION_GREECE' and ('ERA_ANCIENT' or 'ERA_CLASSICAL'), "Byzantion", 0, 3),
 ('LEADER_ALEXANDER', "Byzantion", 0, 2),
 ('CIVILIZATION_BYZANTIUM' and ('ERA_ANCIENT' or 'ERA_CLASSICAL'), "Byzantion", 1, 5),
 ('CIVILIZATION_BYZANTIUM' and not ('ERA_ANCIENT' or 'ERA_CLASSICAL'), "Constantinoupolis", 1, 5),
 (('CIVILIZATION_OTTOMAN') and ('ERA_MEDIEVAL' or 'ERA_RENAISSANCE'), "Konstantiniyye", 0, 5),
 (('CIVILIZATION_OTTOMAN') and ('ERA_INDUSTRIAL' or 'ERA_MODERN'), "Istanbul", 0, 5),
 (('CIVILIZATION_ARABIA' or "CIVILIZATION_NABATEA") and ('ERA_MEDIEVAL' or 'ERA_RENAISSANCE'), "Konstantiniyye", 0, 0),
 (('CIVILIZATION_ARABIA' or "CIVILIZATION_NABATEA") and ('ERA_INDUSTRIAL' or 'ERA_MODERN'), "Istanbul", 0, 0), 
(('CIVILIZATION_DENMARK' or "CIVILIZATION_SWEDEN" or "CIVILIZATION_VIKING") and ('ERA_MEDIEVAL'), "Miklagard", 0, 0),
 (('CIVILIZATION_ISRAEL') and ('ERA_MEDIEVAL' or 'ERA_RENAISSANCE'), "Kushtandina", 0, 0), (('CIVILIZATION_ISRAEL') and ('ERA_INDUSTRIAL' or 'ERA_MODERN'), "Istanbul", 0, 0), (('CIVILIZATION_ARMENIE') and ('ERA_MEDIEVAL' or 'ERA_RENAISSANCE' or 'ERA_INDUSTRIAL' or 'ERA_MODERN'), "Bolis", 0, 0),],

(note that I also wanted to add stargrad for the slavic civs)

To finish all of this I also wanted names that changes under some regimes especially for Russia and the evolution from Tsaritsyn-Stalingrad-Volgograd, if your code can't handle the change, if it can at least make the game recognize it as the same place that would be really usefull.

Thanks for your help :)
 
You can't use operations like 'and' or 'or' in your definitions. You need to have a seperate tuple for each civ or leader associated with the city. Also, era tuples will apply to all civilizations and leaders associated with the city, you can't define different era changes for each. Era handling is still a bit rudimentary, I'd like to improve it eventually. In particular, existing cities will not be automatically renamed when a defined era arrives, the effects only apply if a city is founded or captured in that era.

Here's what your Memphis entry should look like (using newlines for clarity while posting here):

Code:
'CITY_MENNEFER': 	[('CIVILIZATION_EGYPT', "Mennefer", 1, 5),
			 ('CIVILIZATION_GREECE', "Memphis", 0, 0),
			 ('CIVILIZATION_MACEDONIA', "Memphis", 0, 0),
			 ('CIVILIZATION_INDO_GREEKS', "Memphis", 0, 0),
			 ('CIVILIZATION_SELEUCIDE', "Memphis", 0, 0),
			 ('CIVILIZATION_TROY', "Memphis", 0, 0),
			 ('CIVILIZATION_BYZANTIUM', "Memphis", 0, 0)],

Here's the closest possible approximation of what you're trying to do with Byzantium:

Code:
'CITY_BYZANTIUM': 	[('CIVILIZATION_GREECE', "Byzantion", 0, 3),
			 ('CIVILIZATION_BYZANTIUM', "Constantinoupolis", 1, 5),
			 ('CIVILIZATION_OTTOMAN', "Konstantiniyye", 0, 5),
			 ('CIVILIZATION_ARABIA', "Konstantiniyye", 0, 0),
			 ('CIVILIZATION_NABATEA', "Konstantiniyye", 0, 0),
			 ('CIVILIZATION_DENMARK', "Miklagard", 0, 0),
			 ('CIVILIZATION_SWEDEN', "Miklagard", 0, 0),
			 ('CIVILIZATION_VIKING', "Miklagard", 0, 0),
			 ('CIVILIZATION_ISRAEL', "Kushtandina", 0, 0),
			 ('CIVILIZATION_ARMENIE', "Bolis", 0, 0),
			 ('ERA_INDUSTRIAL', "Istanbul", 0, 0),
			 ('ERA_MODERN', "Istanbul", 0, 0),
			 ('ERA_FUTURE', "Istanbul", 0, 0),
			 "Byzantium", "Constantinople"],

Greece will found the city as Byzantion, Byzantium will found it as Constantinoupolis. If any other listed civ captures the city, they will rename it to what is indicated. If any listed civ founds or captures the city from the Industrial era onwards, it will be (re)named Istanbul. "Byzantium" and "Constantinople" are added to the end so if someone manually renames the city to one of these, it'll still be recognized.
 
Back
Top Bottom