• Our Forum Hosts will be doing maintenance sometime in the next 72 hours and you may experience an outage lasting up to 5 minutes.

Real Capitals

Panopticon

Utilitarian
Joined
Aug 4, 2007
Messages
1,454
Location
Ireland
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.

Spoiler :
In Consts.py:

Add after tCapitals:
Code:
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
Code:
tCapitals = con.tCapitals
with
Code:
tCapitals = con.tCapitals
tNewCapitals = con.tNewCapitals

Replace the entire function def moveBackCapital
with
Code:
        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

Divine Monarch
Joined
Mar 26, 2007
Messages
4,405
Location
Cornwall, somewhere near England
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

Utilitarian
Joined
Aug 4, 2007
Messages
1,454
Location
Ireland
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.
 

jessiecat

Divine Monarch
Joined
Mar 26, 2007
Messages
4,405
Location
Cornwall, somewhere near England
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

King
Joined
Aug 26, 2008
Messages
617
Location
New York
This is a great idea! It could make a lot of people happy. For example. Remember this 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

Utilitarian
Joined
Aug 4, 2007
Messages
1,454
Location
Ireland
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

Emperor
Joined
Jul 18, 2008
Messages
1,718
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.
 

Rod

King
Joined
Sep 22, 2004
Messages
754
Location
Munich / Germany
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

Utilitarian
Joined
Aug 4, 2007
Messages
1,454
Location
Ireland
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.
 

Panopticon

Utilitarian
Joined
Aug 4, 2007
Messages
1,454
Location
Ireland
Sure. The problem is that it stops you using other mods that affect Consts and RiseAndFall, so be careful.
 

Panopticon

Utilitarian
Joined
Aug 4, 2007
Messages
1,454
Location
Ireland
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

Blue Period
Moderator
Joined
Aug 23, 2009
Messages
36,421
Location
東京藝術大学
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

Utilitarian
Joined
Aug 4, 2007
Messages
1,454
Location
Ireland
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.
 
Top Bottom