Modmodding Q&A Thread

I might have made use of some utility methods I've written for DoC. I'll take a look at it again, maybe it's easy enough modify so that it works with RFC.
 
How can I add new Soviet name for non-Russian civs?
I replaced Chojbalsan in all entry with Bayan Tu'men, that should become Choibalsan when the government is communist.
Is the following bold is correct? I will add the entry to OnTechAcquired as well

Code:
def applySovietNames():
	for city in utils.getCityList(iRussia):
		sOldName = city.getName()
		sNewName = ""
		
		if sOldName == 'Caricyn': sNewName = 'Stalingrad'
		elif sOldName == 'Sankt-Peterburg': sNewName = 'Leningrad'
		elif sOldName == "Tver'": sNewName = 'Kalinin'
		elif sOldName == 'Ekaterinburg': sNewName = 'Sverdlovsk'
		elif sOldName == 'Nizhnij Novgorod': sNewName = 'Gorki'
		elif sOldName == 'Samara': sNewName = 'Kujbyshev'
		elif sOldName == "Car'grad": sNewName = "Konstantinopol'"
		elif sOldName == 'Bobrujsk': sNewName = 'Stalink'
		elif sOldName == 'Vjatka': sNewName = 'Kirov'
		elif sOldName == 'Bavly': sNewName = "Oktjabr'skij"
		elif sOldName == 'Sumin': sNewName = 'Sumy'
		elif sOldName == 'Sjangan': sNewName = 'Gon Kong'
		
[COLOR="Red"][B]	for city in utils.getCityList(iMongolia):
		sOldName = city.getName()
		sNewName = ""
		
		if sOldName == "Bayan Tu'men": sNewName = 'Choibalsan'[/COLOR]
[/B]
		if sNewName != "":
			city.setName(sNewName, False)
 
Yes, but currently the applySovietNames() method is only triggered when Russia discovers communism, so you have to change that too (the method then would need to carry the civilization that discovered communism as a parameter).
 
Wait, so you mean the current method applies whenever Russia discover Communism tech regardless being a Communist or not? I thought that method will apply when Russia reaches Industrial Era and apply civic con.CentralPlanning....

btw, I like your Easter Egg hahaha
 
Wait, so you mean the current method applies whenever Russia discover Communism tech regardless being a Communist or not? I thought that method will apply when Russia reaches Industrial Era and apply civic con.CentralPlanning....
Sorry, I meant it applies when they adopt Central Planning.
 
Easter eggs are meant to be discovered, not spoiled.
 
I changed my mind a bit, instead of defining what city list for Russia and what city list for Mongolia, I would like a method that rename whenever the city owner is communist, regardless being Russia, Mongolia, China, Korea or even USA.

Is the following correct?

Code:
for city in utils.getCityList(i[B][COLOR="Red"]Civ[/COLOR][/B]):
		sOldName = city.getName()
		sNewName = ""
 
I changed my mind a bit, instead of defining what city list for Russia and what city list for Mongolia, I would like a method that rename whenever the city owner is communist, regardless being Russia, Mongolia, China, Korea or even USA.

Is the following correct?

Code:
for city in utils.getCityList(i[B][COLOR="Red"]Civ[/COLOR][/B]):
		sOldName = city.getName()
		sNewName = ""
Assuming that the iCiv variable is passed along as a method parameter, yes.
 
Code:
elif iEra == con.iIndustrial:
		[B][COLOR="Red"]if iCiv in [iRussia, iMongolia][/COLOR][/B]:
			if pCiv.getCivics(3) == con.iCivicCentralPlanning: applySovietNames()

and this is how the method to trigger it should written as. am I correct?
 
You also need to pass in iCiv into the method.

Code:
elif iEra == con.iIndustrial:
		if iCiv in [iRussia, iMongolia]:
			if pCiv.getCivics(3) == con.iCivicCentralPlanning: applySovietNames([COLOR="Red"]iCiv[/COLOR])
and
Code:
def applySovietNames([COLOR="Red"]iCiv[/COLOR]):
        ...
 
By the way, Leoreth, I'm thinking of a more effective way to write CNM... take Jerusalem for example. Instead of writing each rename civilization/language-based, like civ A Yerushalayim, civ Arab al-Quds, civ Turks Kudus etc.. is it possible to base the rename on the city?

Something roughly like this:

Code:
#Jerusalem
lJerusalem = [Yerushalayim, Al-Quds, Jerusalem, Hierousalem, Kudus, Qods]
    for city.getCoordinate() == [73,38] and names in lJerusalem:
        if city.getLanguages() = iLangGreece: city.setName("Hierousalem", False)
        elif city.getLanguages() = iLangArabia: city.setName = ("Al-Quds", False)
        elif city.getLanguages() = iLangTurkey: city.setName = ("Kudus", False)
etc

that applies to civilization that has enormous amount of names... like Jerusalem, Venice, Constantinople, Cadiz, Pataliputra, etc.
I think this makes the language have only has 1 name for the city, yeah... but I think allowing Zoroastrian Persia to rename al-Quds to Qods is not relevant anymore since we have Iran, so if Zoroastrian Persia survive they should still retain their ancient name for the city. Also, if Mughals is founding random city in the Near East + Iran, they won't get ancient city names like Dur Untash or Dura Europos (I'm adding iLangIranian for the first language for Iran and Mughals)

The other not-so-significant like Xi'an, Panduranga, Mbuji-Mayi etc are defined "traditionally" in the bottom like status quo.
 
NKN is correct by the way.

About the CNM stuff, I know the current method is rather tedious, and I've spent some time trying to come up with a method to simplify it, but couldn't think of anything that wouldn't cause more trouble on another end.

What you're proposing is one name per language for a specific tile, which is how SoI works, but not RFC, and I'd like to keep it that way. When you're using the SoI paradigm a lot of things become easier, i.e. you can also use only one global city name map full of universal master names and then rename to the specific language on founding. Renaming is a simple matter of first reverting to the master name according to location and than renaming to the new language again.

Effectively the name-to-name relationships are simplified to 1-to-n instead of the current n-to-m.

Which is nice, but again not really what RFC does.
 
Sure.

Step 1: Set up a C++ compiler.
Step 2: Ask me again after you've set up a C++ compiler.
 
You've said that adding another civ is much easier now. Can you post a tutorial for those who want to try?

Go through all the C++ and Python code, and the XML files. Every time you see all the other civs mentioned, add Canada (or whatever). So you'll need to edit CityNameManager.py, Consts.py, RiseAndFall.py, and so on. Also add Canada to CIV4CivilizationInfos.xml, and an appropriate leader to CIV4LeaderHeadInfos.xml.

(Also, you'll need to add "Canadian Embassy" everywhere the other embassies are listed.)
 
Back
Top Bottom