Change a civic in an random event - possible?

ostar

Warlord
Joined
Nov 13, 2005
Messages
160
I would like to create a (random) event that will allow a player to have the option to automatically change a civic by making the proper choice. I think it can be done, because during diplomacy you can change a civic when another civ asks you to.

But can it be done in an event? And if so can anyone point me to an example where it has been done? (I assume with python of course.)
 
It can be done using the random events system (XML+Python)

You can find examples in the Sword of Islam mod in my sig, i.e. CASTE_SYSTEM and RELIGIOUS_LAW events ask player to switch to said civics or face bad consequences. It comes down to adding the trigger & choice of events to the XML (I assume you can do that), linking it to Python functions (PythonCallback tag) and writing those functions (in EntryPoints/CvRandomEventInterface.py). For instance, to switch to theocracy with an event, you use this:
Code:
def applyTheocracy1(argsList):
	iEvent = argsList[0]
	kTriggeredData = argsList[1]
	player = gc.getPlayer(kTriggeredData.ePlayer)
	player.setCivics(4, gc.getInfoTypeForString("CIVIC_THEOCRACY"))
	player.changeRevolutionTimer(gc.getDefineINT("MIN_REVOLUTION_TURNS"))

setCivics(x, y) sets the civic y of column x (columns are from 0 to 4)
changeRevolutionTimer sets the delay before you can switch civics again, as if you changed them in civics screen

EDIT: skip the changeRevolutionTimer line, it's not exposed to Python in the default BTS DLL so it won't work unless you edit the DLL as well.
 
Back
Top Bottom