How to add a new leader?

apenpaap

Tsar of all the Internets
Joined
Apr 7, 2008
Messages
1,468
Location
Amsterdam
I've been getting a little sick of seeing Monty's insane grin and Huayna's pre-explosion trembling until the 21st century lately, so I've been thinking I want to replace them with another leader when their civs reach the Renaissance. That would be José de San Martin from Colonization for the Incas (not sure about the Aztecs, though; I'll have to see if I can find a decent Juarez).

I know how to add in a leaderhead in normal civ, but I'll need some information to be able to mod the Python well so they actually switch when they reach the renaissance. I've seen some leader switching code in DynamicCivs.py, but I don't know if this is the only file I'd need to change or if there are others. I'm guessing the code that needs to be changed in this file would be:

elif iPlayer == iInca:
return

to

elif iPlayer == iInca:
if iEra >= con.iRenaissance:
self.setLeader(iPlayer, con.iJose)
return
 
Your guess is right. Make sure that the indentation (number of tabs) is correct, though, otherwise the code will trigger an error (if in doubt, copy the code for another leader and change the variables).

You also have to make sure that "con.iJose" actually refers to your new leader. This is done in Consts.py, where you will find a long list of all leader IDs. There you have to increase iNumLeaders by one and then add "iJose" into the list according to his position in the LeaderHeadInfo.xml (e.g. if you added him at the end, iJose goes at the end of the list).
 
^Thanks, I'll try that once I can get Colonization reinstalled later today. I've also found a great Juarez in Ekmek's leaderhead thread.

I have two more questions: is it possible to make all leaders playable (so you can choose them in the civ selection screen) or does that break the game somehow? And is there a limit to the number of leaderheads a civ can have, or could I add a fifth English leader? (George III using the English king leaderhead from Colonization)
 
Can you even make the leader selectable in a scenario? I've never tried that.

And there aren't really any leader limits. I think you could include George III without problems.
 
Ah, of course, it's a scenario; forgot that.

And well, José de San Martin works and takes over a few turns after gifting the Incas Education. I'm about to test Juarez (takes over the Aztecs in the Renaissance) and George (takes over England in the Industrial age, then Victoria replaces him at Assembly Line). Thanks for your help.
 
Well, if you want to change who you are, you can just edit the scenario WBSave (search for LEADER_STALIN and replace him with LEADER_YAROSLAV, generally you can find the correct tags in CIV4LeaderheadInfos.xml).

Making it so that you can choose ingame would be the harder part I think.
 
Back
Top Bottom