View Full Version : Real Capitals


Panopticon
Jan 04, 2009, 11:41 AM
http://forums.civfanatics.com/downloads.php?do=file&id=13501

This is a very small mod to move a civ's capital from the old location to a new location after it is resurrected. For instance, Egypt begins in Niwt-Rst, but will now move its capital to Cairo if it is resurrected. The other civs which move capitals are Persia (Parsa -> Tehran), Japan (Kyoto -> Tokyo), Ethiopia (Aksum -> Addis Ababa), Vikings (Nidaros -> Copenhagen or Oslo), Arabia (Mecca -> Riyadh), Khmer (Angkor -> Phnom Penh), Mongolia (Karakorum -> Ulaanbataar) and Turkey (Sogut -> Ankara or Istanbul).

Download at the link above if you don't already use a modified Consts.py or RiseAndFall.py file. If you do, then you simply need to edit the Python code by adding the lines included below.

In Consts.py:

Add after tCapitals:
tNewCapitals = ( #for RiseAndFall
((69, 35), (68, 35), (69, 33)), #Cairo
((90, 40), (90, 40)), #Delhi
((102, 47), (102, 47)), #Beijing
((76, 40), (76, 40)), #Baghdad
((67, 41), (67, 41)), #Athens
((80, 41), (81, 41), (82, 39)), #Teheran
((58, 39), (58, 39)), #Carthage
((60, 44), (60, 44)), #Rome
((116, 46), (116, 47), (113, 45)), #Tokyo
((72, 26), (72, 27), (72, 29)), #Addis Ababa
((22, 35), (22, 35)), #Tikal
((60, 55), (59, 58), (59, 59), (60, 59), (61, 62)), #Copenhagen & Oslo
((76, 35), (77, 35), (77, 34), (75, 33)), #Mecca
((102, 32), (102, 34)), #Phnom Penh
((52, 43), (52, 43)), #Madrid
((55, 50), (55, 50)), #Paris
((53, 54), (53, 54)), #London
((62, 52), (62, 52)), #Berlin
((73, 54), (73, 54)), #Moscow
((57, 53), (57, 53)), #Amsterdam
((53, 31), (53, 31)), #Timbuktu
((49, 43), (49, 43)), #Lisbon
((28, 22), (28, 22)), #Cuzco
((101, 50), (102, 50), (99, 51)), #Ulaanbataar
((18, 37), (18, 37)), #Mexico City
((72, 43), (68, 45), (67, 45), (69, 44), (70, 43)), #Ankara & Istanbul
((27, 46), (27, 46))) #Washington



In RiseAndFall.py:

Replace
tCapitals = con.tCapitals
with
tCapitals = con.tCapitals
tNewCapitals = con.tNewCapitals

Replace the entire function def moveBackCapital
with
def moveBackCapital(self, iCiv):
apCityList = PyPlayer(iCiv).getCityList()
if (len(tNewCapitals[iCiv])):
for j in range(len(tNewCapitals[iCiv])):
pCurrent = gc.getMap().plot( tNewCapitals[iCiv][j][0], tNewCapitals[iCiv][j][1] )
if ( pCurrent.isCity()):
newCapital = pCurrent.getPlotCity()
if (newCapital.getOwner() == iCiv):
if (not newCapital.hasBuilding(con.iPalace)):
for pCity in apCityList:
pCity.GetCy().setHasRealBuilding((con.iPalace), False)
newCapital.setHasRealBuilding((con.iPalace), True)
else:
iMaxValue = 0
bestCity = None
for pCity in apCityList:
loopCity = pCity.GetCy()
#loopCity.AI_cityValue() doesn't work as area AI types aren't updated yet
loopValue = max(0,500-loopCity.getGameTurnFounded()) + loopCity.getPopulation()*10
#print ("loopValue", loopCity.getName(), loopCity.AI_cityValue(), loopValue) #causes C++ exception
if (loopValue > iMaxValue):
iMaxValue = loopValue
bestCity = loopCity
if (bestCity != None):
for pCity in apCityList:
loopCity = pCity.GetCy()
if (loopCity != bestCity):
loopCity.setHasRealBuilding((con.iPalace), False)
bestCity.setHasRealBuilding((con.iPalace), True)

jessiecat
Jan 04, 2009, 11:57 AM
Which mod are you talking about? Shouldn't your question be in the main RFC threads instead of here? Or are you proposing a new mod for RFC?

Panopticon
Jan 04, 2009, 12:00 PM
I'm aware that some people seem to think this is the RFC Europe forum, but it's not, and many of the threads are about actual finished modifications to the base game.

Rhye
Jan 04, 2009, 12:01 PM
very nice. I might add it to the standard mod

jessiecat
Jan 04, 2009, 12:28 PM
I'm aware that some people seem to think this is the RFC Europe forum, but it's not, and many of the threads are about actual finished modifications to the base game.

I wasn't assuming that at all. Just wondering.

ZachScape
Jan 04, 2009, 01:40 PM
This is a great idea! It could make a lot of people happy. For example. Remember this (http://forums.civfanatics.com/showthread.php?t=247699) thread. I don't know a lot about Eastern history but people on that thread do.

Anyways, there is a typo in the code, unless it is the native spelling. It's not a big deal, but you have Teheran.
I also thought Mali should respawn with Bamako. Don't know where it should be on the Civ map, but seems like a good place considering it's the resurrected Malinese capital IRL.
And Inca should spawn with Lima, 3 tiles left, 1 up.

I'm not going to patch my game yet, seeing as I don't know how, but I'll wait for Rhye's next patch. So all the pressure is on you Rhye. :crazyeye:

So good job, and hopefully this thread gets as popular as your other mod thread. :goodjob:

Panopticon
Jan 04, 2009, 02:11 PM
The debate about China was the inspiration for this mod, actually. If Rhye ever implements a change of capital, this would facilitate Beijing's becoming the capital later in the game. But the same problem applies to other civs too. The spelling of Tehran is commented out so it doesn't matter. Bamako isn't a city in the CityNameManager. Lima would be a good addition in my view, but many people don't consider Inca to carry forward as Peru.

It's really quite easy to change the files yourself. It's just like editing a text file - you need a text editor like Notepad.

BurnEmDown
Jan 04, 2009, 03:35 PM
Yes I think it's the most important of all capital movements, now Rhye should change the Chinese's starting location few tiles south and add maybe 2 or 3 indy cities to represent the divided states of ancient China.

Virdrago
Jan 11, 2009, 09:25 AM
Good ideas Panopticon.

Rod
Jan 12, 2009, 04:49 AM
Hello,

what exactly is the code doing ?? I always thought that the AI on respawn automatically chooses the appropiate next best location ? E.g. when Persia respawns but there is no city at the location of Teheran, what will it do then ?

Panopticon
Jan 12, 2009, 07:02 AM
If there is no city in the NewCapital plot, it then looks at the old capital plot. So Persia will first check Tehran, then Parsa, and then it will run the best-city check. The only change this mod makes is that a new first step is added.

PPQ_Purple
Oct 22, 2009, 12:28 PM
Any chance of someone editing this into the appropriate file and uploading the file?
I have a slight fear of messing with python becouse of the strange way it handles indentations.

Panopticon
Oct 22, 2009, 01:46 PM
Sure. The problem is that it stops you using other mods that affect Consts and RiseAndFall, so be careful.

PPQ_Purple
Oct 22, 2009, 05:09 PM
Thanks, you are a genius.

Ready_set_go
Oct 25, 2009, 08:00 AM
Could you do something with China, moving it's first Capital to Xian, then respawn with Beijing?

Panopticon
Oct 25, 2009, 08:50 AM
It's complicated and I don't particularly want to or know how to. Ask the people who changed Maya to Korea; they should have found out all the details needed in moving the capital spawning site. After that, all you need is this code to ensure respawn happens in Beijing.

Leoreth
Oct 25, 2009, 10:24 AM
I've also heard there's some routine in the Chinese AI that prevents them from settling any city north of their spawning site (i.e. Beijing) to leave more room for Mongolia.

So be careful, a southern capital could have unintended side effects.

Panopticon
Oct 25, 2009, 03:34 PM
I'm sure they would try to build Beijing, because like all the civs they have a high attraction value for their capital plots. But it surely would have unintended consequences.