AI rename city on capture?

Pwyll

Chieftain
Joined
Dec 4, 2005
Messages
10
I am working on my first new civilization mod, and I would like this civilization to rename any cities they capture to the next available name in their city names list. Anyone have any idea how to do this? I would like this behavior to be limited to the new civilization if possible. Thanks in advance!
 
Check the python in the Greek World scenario. It has exactly what you want.
 
Thanks! It looks like I need to overwrite the onCityAcquired method to add a line to call a custom method that will rename the city. That part is the same as the GreekWorld mod. But the GreekWorld mod uses a custom checkCities function that checks who owns particular cities and renames them accordingly (Istanbul was Constantinople, Now its Istanbul not Constantinople...) :)

What I'm trying to do is a little different as I do not have preset cities. For now, I am only adding this civilization, not an entire scenario, though I think I will try to create one with this civ later.

Without preset civilizations in a game, how do I check that the new owner is my custom civilization? Can I pass owner from the argsList in onCityAcquired to my custom method and then call owner.getCivilizationName()? If so, do I use the short name to compare?

Once I get that part down, I think I will need some of the code from onCityBuilt, so a popup appears if the player is human asking to rename the city. I'm not sure how to acquire the next available name from the civ's list.
 
Can any of the local Python gurus take a shot at this? I've been trying to hammer away at it, but without much luck. I'm trying to learn a new language (Python) and the Civ API at the same time, and I'm a little over my head methinks.
 
Back
Top Bottom