Combining XML and Python city naming

Arkaeyn

King
Joined
Jan 12, 2005
Messages
936
Location
nomad, USA
I'm currently working on a mod to update the way that city naming in Civilization works. My goals include

1) having the same cities foundable by different civilizations.This is easily accomplished in XML if the cities have the same name. Civ won't add a duplicate name of the same city. So the Greeks will build Thebes if the Egyptians aren't in the game.

2) changing city names upon conquest. For example, if the Greeks capture Roman Constantinople, they change the name to Byzantium. This is easily accomplished using Python (the code is in the Greekworld.py) So far so good.

This is where the problems come in: combining the XML and the Python.

Example: I want the Romans and the French to be able to found the same city - Masillia/Marseille, and if one founds it first, the other cannot. However, since it's a different name, I can't use the simple XML duplication. I could use Python, but the city name list is XML.

My theoretical solution, not knowing much Python, is to create a variable for city names, which equals one thing for Romans, and another for French. But I'm not certain if this will work, given that the names themselves are in XML, but the name changing code is in Python.

So basically, my question to the skilled modders out there: Is it possible to move city naming into Python? or to use variables in XML? or to make XML and Python work together in this case to accomplish what I want?
 
Right. Loads of ways of doing this, ranging from bloody complicated, but easy to mod, to quite simple, but harder to mod.

The easy way is just to do it in python. It's probably easiest just to copy all the lists to python, though you could do it other ways.

The hard way is to mess about with the XML structure loads so that it can be used to do what you want.

I'd go for the easy way.
 
I prefer the easy way too. I see no reason to do the hard way just to stay out of Python, but then, I don't know much about Python.

Rhye, as far as I can tell, the Greek World mod only does half of what I want, which is the city renaming. I want to have it work with built cities as well - if the French have built Marseilles, the Romans won't build Massilia. Unless your mod does do that....
 
Back
Top Bottom