Event Triggers Help

Griffon0129

Chieftain
Joined
Nov 8, 2015
Messages
8
I'm using this mod: http://forums.civfanatics.com/downloads.php?do=file&id=19358
but to add more restrictions to it I made the even trigger only work every 10 turns.
the python code:
Code:
def canTriggerCivilWar_Generic(argsList):
	kTriggeredData = argsList[0]
	turn = kTriggeredData.iTurn
	player = gc.getPlayer(kTriggeredData.ePlayer)
	pCity = player.getCity(kTriggeredData.iCityId)
	if gc.getMAX_CIV_PLAYERS ()==CyGame().countCivPlayersAlive ():
                return False
        if player.getNumCities () <=1:
                return False
        if pCity.isCapital():
                return False
        if (turn % 10 == 0):
		return True
	return False
(all I added was the 3 lines that checks the turns)
XML line to execute Python code (original mod author's code):
Code:
<PythonCanDo>canTriggerCivilWar_Generic</PythonCanDo>

and in the XML I have the trigger set to check every turn and if unhappiness is 5 then a civil war breaks out (from original mod author's code). Here is my problem: every turn that a city's unhappiness is 5 or below (including capital, which is already excluded from the event) I get the trigger text popup but nothing happens until a turn divisible by 10 (unless it's the capital then I still get the popup, but nothing ever happens).

any way to not get the text popup until the event actually triggers?

I basically want this event to happen every single time a city's happiness is low, but give time between the evens happening so that you can fix the problem (if you recapture the city from the new civ). A better solution might be to make it a random # instead of every 10 turns but don't know how to do that in Python.
 
I basically want this event to happen every single time a city's happiness is low, but give time between the evens happening so that you can fix the problem (if you recapture the city from the new civ). A better solution might be to make it a random # instead of every 10 turns but don't know how to do that in Python.

It doesn't look easy to do what you want with Events. Perhaps a chain of events checking each turn if the city is still in revolt and after x events, apply the civil war. A bit heavy.

About randomness, you could of course use the iWeight (without changing the Python) to simply trigger the civil war from time to time when the unhappiness is there.

If you want to keep your Python changes, you could add the message there (before the return true) and scrap it from the TriggerInfos. That would at least reduce the annoyance.
 
I thought about doing a chain of events like you said at one time, but thought that'd more complicated than necessary. I'll try the python popup thanks.
 
Back
Top Bottom