View Full Version : Any way to change Civ colors using Python?


MatthewH86
Nov 28, 2007, 03:59 PM
Hey, I've searched Google and civfanatics and come up with nothing. Is there any way that a Civilization's teamcolor can be changed using only the python console?

I've managed to get it to display the teamcolor index, but there seems to be no setPlayerColor method so I'm stumped.

CyGlobalContext.getPlayer(7).getPlayerColor() returns 9(PLAYERCOLOR_DARK_RED) for Rome so I know I'm querying the right object.

Can anyone help?

jdog5000
Nov 29, 2007, 08:05 AM
I don't know if it's currently possible through Python, but I can tell you how the game sets colors for players when it adds a new one (ie a colony) part way through the game. In the function CvGame::addPlayer, after determining which color to give the player it calls:

GC.getInitCore().setColor(eNewPlayer, eColor);

The initCore has no interface to Python that I'm aware of ... it controls basically all the stuff you can set up on the Custom Game menu, so which slot has which civ type or whether they're human or AI controlled etc. When you call getPlayerColor, it eventually calls GC.getInitCore().getColor() as well, so this is the setting you'll want to change. It looks to me like you'd need to mod the SDK to allow you to change the colors from Python. Good luck.