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:
(all I added was the 3 lines that checks the turns)
XML line to execute Python code (original mod author's code):
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.
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
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.