Headlock
Nomnomnomnom
All,
Im working on making regularly recurring elections, using the Random Events system, specifically basing it on the quest format (without actually presenting it as a 'quest'...if you get me..
I nearly have it nailed except for one crucial aspect:
1) I have a trigger that says theres an election due
2) This has 2 events- liberal/conservative options with varied effects.
3) You choose one,
4) 5 turns later a 'hidden' (ie very little text to the player) event occurs that expires the effects of whatever choice you made,
5) the next turn, the Election trigger fires again
there will be further refinements of this process, once i get stage 4 to work.
Basically,
I need a python script that checks to see if a specific event has occurred, (ie choosing liberal or conservative) and returns false until 4 turns after that event. It then undoes the event's effects.
Im very experienced with the XML side of this- you can safely assume I have tried everything possible there (ie additonalevents & eventtimes), yet it still is not working properly.
Thence, the need for the python script above :/
Any help appreciated!
Regards,
HDK
Screenshots will be included shortly.
CODE:
Im working on making regularly recurring elections, using the Random Events system, specifically basing it on the quest format (without actually presenting it as a 'quest'...if you get me..

I nearly have it nailed except for one crucial aspect:
1) I have a trigger that says theres an election due
2) This has 2 events- liberal/conservative options with varied effects.
3) You choose one,
4) 5 turns later a 'hidden' (ie very little text to the player) event occurs that expires the effects of whatever choice you made,
5) the next turn, the Election trigger fires again
there will be further refinements of this process, once i get stage 4 to work.
Basically,
I need a python script that checks to see if a specific event has occurred, (ie choosing liberal or conservative) and returns false until 4 turns after that event. It then undoes the event's effects.
Im very experienced with the XML side of this- you can safely assume I have tried everything possible there (ie additonalevents & eventtimes), yet it still is not working properly.
Thence, the need for the python script above :/
Any help appreciated!
Regards,
HDK
Screenshots will be included shortly.
CODE:
Spoiler XML TRIGGER :
Code:
<EventTriggerInfo>
<Type>EVENTTRIGGER_GENERAL_ELECTION</Type>
<WorldNewsTexts>
<Text>TXT_KEY_EVENTTRIGGER_GENERAL_ELECTION</Text>
</WorldNewsTexts>
<TriggerTexts>
<TriggerText>
<Text>TXT_KEY_EVENT_GENERAL_ELECTION</Text>
<Era>NONE</Era>
</TriggerText>
</TriggerTexts>
<bSinglePlayer>0</bSinglePlayer>
<iPercentGamesActive>100</iPercentGamesActive>
<iWeight>-1</iWeight>
<bProbabilityUnitMultiply>0</bProbabilityUnitMultiply>
<bProbabilityBuildingMultiply>0</bProbabilityBuildingMultiply>
<Civic>CIVIC_REPRESENTATION</Civic>
<iMinTreasury>0</iMinTreasury>
<iMinPopulation>0</iMinPopulation>
<iMaxPopulation>0</iMaxPopulation>
<iMinMapLandmass>0</iMinMapLandmass>
<iMinOurLandmass>0</iMinOurLandmass>
<iMaxOurLandmass>-1</iMaxOurLandmass>
<MinDifficulty>NONE</MinDifficulty>
<iAngry>0</iAngry>
<iUnhealthy>0</iUnhealthy>
<UnitsRequired/>
<iNumUnits>0</iNumUnits>
<iNumUnitsGlobal>0</iNumUnitsGlobal>
<iUnitDamagedWeight>0</iUnitDamagedWeight>
<iUnitDistanceWeight>0</iUnitDistanceWeight>
<iUnitExperienceWeight>0</iUnitExperienceWeight>
<bUnitsOnPlot>0</bUnitsOnPlot>
<BuildingsRequired/>
<iNumBuildings>0</iNumBuildings>
<iNumBuildingsGlobal>0</iNumBuildingsGlobal>
<iNumPlotsRequired>0</iNumPlotsRequired>
<bOwnPlot>0</bOwnPlot>
<iPlotType>-1</iPlotType>
<FeaturesRequired/>
<TerrainsRequired/>
<ImprovementsRequired/>
<BonusesRequired/>
<RoutesRequired/>
<ReligionsRequired/>
<iNumReligions>0</iNumReligions>
<CorporationsRequired/>
<iNumCorporations>0</iNumCorporations>
<bPickReligion>0</bPickReligion>
<bStateReligion>0</bStateReligion>
<bHolyCity>0</bHolyCity>
<bPickCorporation>0</bPickCorporation>
<bHeadquarters>0</bHeadquarters>
<Events>
<Event>EVENT_GENERAL_ELECTION_1</Event>
<Event>EVENT_GENERAL_ELECTION_2</Event>
</Events>
<PrereqEvents/>
<bPrereqEventPlot>0</bPrereqEventPlot>
<OrPreReqs/>
<AndPreReqs>
<PrereqTech>TECH_CONSTITUTION</PrereqTech>
<PrereqTech>TECH_LIBERALISM</PrereqTech>
<PrereqTech>TECH_NATIONALISM</PrereqTech>
</AndPreReqs>
<ObsoleteTechs/>
<bRecurring>1</bRecurring>
<bTeam>0</bTeam>
<bGlobal>0</bGlobal>
<bPickPlayer>0</bPickPlayer>
<bOtherPlayerWar>0</bOtherPlayerWar>
<bOtherPlayerHasReligion>0</bOtherPlayerHasReligion>
<bOtherPlayerHasOtherReligion>0</bOtherPlayerHasOtherReligion>
<bOtherPlayerAI>0</bOtherPlayerAI>
<iOtherPlayerShareBorders>0</iOtherPlayerShareBorders>
<OtherPlayerHasTech>NONE</OtherPlayerHasTech>
<bPickCity>0</bPickCity>
<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
<bShowPlot>0</bShowPlot>
<iCityFoodWeight>0</iCityFoodWeight>
<PythonCanDo/>
<PythonCanDoCity/>
<PythonCanDoUnit/>
<PythonCallback/>
</EventTriggerInfo>
Spoiler XML EVENTS :
Code:
<EventInfo>
<Type>EVENT_GENERAL_ELECTION_1</Type>
<Description>TXT_KEY_EVENT_GENERAL_ELECTION_1</Description>
<LocalInfoText/>
<WorldNewsTexts>
<Text>TXT_KEY_NEWS_EVENT_GENERAL_ELECTION_1</Text>
</WorldNewsTexts>
<OtherPlayerPopup/>
<QuestFailText/>
<bQuest>0</bQuest>
<bGlobal>0</bGlobal>
<bTeam>0</bTeam>
<bPickCity>0</bPickCity>
<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
<bDeclareWar>0</bDeclareWar>
<iGold>0</iGold>
<bGoldToPlayer>0</bGoldToPlayer>
<iRandomGold>0</iRandomGold>
<iCulture>0</iCulture>
<iEspionagePoints>0</iEspionagePoints>
<bGoldenAge>0</bGoldenAge>
<iFreeUnitSupport>0</iFreeUnitSupport>
<iInflationMod>0</iInflationMod>
<iSpaceProductionMod>0</iSpaceProductionMod>
<Tech>NONE</Tech>
<TechFlavors/>
<iTechPercent>0</iTechPercent>
<iTechCostPercent>0</iTechCostPercent>
<iTechMinTurnsLeft>0</iTechMinTurnsLeft>
<PrereqTech>NONE</PrereqTech>
<UnitClass>NONE</UnitClass>
<iNumFreeUnits>0</iNumFreeUnits>
<bDisbandUnit>0</bDisbandUnit>
<iUnitExperience>0</iUnitExperience>
<iUnitImmobileTurns>0</iUnitImmobileTurns>
<UnitPromotion/>
<UnitName/>
<UnitCombatPromotions/>
<UnitClassPromotions/>
<BuildingClass>NONE</BuildingClass>
<iBuildingChange>0</iBuildingChange>
<BuildingExtraYields/>
<BuildingExtraCommerces>
<BuildingExtraCommerce>
<BuildingClass>BUILDINGCLASS_THEATRE</BuildingClass>
<CommerceType>COMMERCE_CULTURE</CommerceType>
<iExtraCommerce>4</iExtraCommerce>
</BuildingExtraCommerce>
<BuildingExtraCommerce>
<BuildingClass>BUILDINGCLASS_LIBRARY</BuildingClass>
<CommerceType>COMMERCE_RESEARCH</CommerceType>
<iExtraCommerce>4</iExtraCommerce>
</BuildingExtraCommerce>
</BuildingExtraCommerces>
<BuildingExtraHappies/>
<BuildingExtraHealths/>
<iHappy>0</iHappy>
<iHealth>0</iHealth>
<iHurryAnger>0</iHurryAnger>
<iHappyTurns>5</iHappyTurns>
<iRevoltTurns>0</iRevoltTurns>
<iMinPillage>0</iMinPillage>
<iMaxPillage>0</iMaxPillage>
<iFood>0</iFood>
<iFoodPercent>0</iFoodPercent>
<FreeSpecialistCounts/>
<FeatureType>NONE</FeatureType>
<iFeatureChange>0</iFeatureChange>
<ImprovementType>NONE</ImprovementType>
<iImprovementChange>0</iImprovementChange>
<BonusType>NONE</BonusType>
<iBonusChange>0</iBonusChange>
<RouteType>NONE</RouteType>
<iRouteChange>0</iRouteChange>
<BonusRevealed>NONE</BonusRevealed>
<BonusGift>NONE</BonusGift>
<PlotExtraYields/>
<iConvertOwnCities>0</iConvertOwnCities>
<iConvertOtherCities>0</iConvertOtherCities>
<iMaxNumReligions>-1</iMaxNumReligions>
<iOurAttitudeModifier>0</iOurAttitudeModifier>
<iAttitudeModifier>0</iAttitudeModifier>
<iTheirEnemyAttitudeModifier>0</iTheirEnemyAttitudeModifier>
<iPopulationChange>0</iPopulationChange>
<AdditionalEvents/>
<EventTimes/>
<ClearEvents/>
<PythonCallback/>
<PythonExpireCheck/>
<PythonCanDo/>
<PythonHelp/>
<Button>,Art/Interface/Buttons/Process/Blank.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,5</Button>
<iAIValue>1000</iAIValue>
</EventInfo>
<EventInfo>
<Type>EVENT_GENERAL_ELECTION_2</Type>
<Description>TXT_KEY_EVENT_GENERAL_ELECTION_2</Description>
<LocalInfoText/>
<WorldNewsTexts>
<Text>TXT_KEY_NEWS_EVENT_GENERAL_ELECTION_2</Text>
</WorldNewsTexts>
<OtherPlayerPopup/>
<QuestFailText/>
<bQuest>0</bQuest>
<bGlobal>0</bGlobal>
<bTeam>0</bTeam>
<bPickCity>0</bPickCity>
<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
<bDeclareWar>0</bDeclareWar>
<iGold>0</iGold>
<bGoldToPlayer>0</bGoldToPlayer>
<iRandomGold>0</iRandomGold>
<iCulture>0</iCulture>
<iEspionagePoints>0</iEspionagePoints>
<bGoldenAge>0</bGoldenAge>
<iFreeUnitSupport>0</iFreeUnitSupport>
<iInflationMod>0</iInflationMod>
<iSpaceProductionMod>0</iSpaceProductionMod>
<Tech>NONE</Tech>
<TechFlavors/>
<iTechPercent>0</iTechPercent>
<iTechCostPercent>0</iTechCostPercent>
<iTechMinTurnsLeft>0</iTechMinTurnsLeft>
<PrereqTech>NONE</PrereqTech>
<UnitClass>NONE</UnitClass>
<iNumFreeUnits>0</iNumFreeUnits>
<bDisbandUnit>0</bDisbandUnit>
<iUnitExperience>0</iUnitExperience>
<iUnitImmobileTurns>0</iUnitImmobileTurns>
<UnitPromotion/>
<UnitName/>
<UnitCombatPromotions/>
<UnitClassPromotions/>
<BuildingClass>NONE</BuildingClass>
<iBuildingChange>0</iBuildingChange>
<BuildingExtraYields>
<BuildingExtraYield>
<BuildingClass>BUILDINGCLASS_FORGE</BuildingClass>
<YieldType>YIELD_PRODUCTION</YieldType>
<iExtraYield>4</iExtraYield>
</BuildingExtraYield>
</BuildingExtraYields>
<BuildingExtraCommerces>
<BuildingExtraCommerce>
<BuildingClass>BUILDINGCLASS_BANK</BuildingClass>
<CommerceType>COMMERCE_GOLD</CommerceType>
<iExtraCommerce>4</iExtraCommerce>
</BuildingExtraCommerce>
</BuildingExtraCommerces>
<BuildingExtraHappies/>
<BuildingExtraHealths/>
<iHappy>0</iHappy>
<iHealth>0</iHealth>
<iHurryAnger>0</iHurryAnger>
<iHappyTurns>0</iHappyTurns>
<iRevoltTurns>0</iRevoltTurns>
<iMinPillage>0</iMinPillage>
<iMaxPillage>0</iMaxPillage>
<iFood>0</iFood>
<iFoodPercent>0</iFoodPercent>
<FreeSpecialistCounts/>
<FeatureType>NONE</FeatureType>
<iFeatureChange>0</iFeatureChange>
<ImprovementType>NONE</ImprovementType>
<iImprovementChange>0</iImprovementChange>
<BonusType>NONE</BonusType>
<iBonusChange>0</iBonusChange>
<RouteType>NONE</RouteType>
<iRouteChange>0</iRouteChange>
<BonusRevealed>NONE</BonusRevealed>
<BonusGift>NONE</BonusGift>
<PlotExtraYields/>
<iConvertOwnCities>0</iConvertOwnCities>
<iConvertOtherCities>0</iConvertOtherCities>
<iMaxNumReligions>-1</iMaxNumReligions>
<iOurAttitudeModifier>0</iOurAttitudeModifier>
<iAttitudeModifier>0</iAttitudeModifier>
<iTheirEnemyAttitudeModifier>0</iTheirEnemyAttitudeModifier>
<iPopulationChange>0</iPopulationChange>
<AdditionalEvents/>
<EventTimes/>
<ClearEvents/>
<PythonCallback/>
<PythonExpireCheck/>
<PythonCanDo/>
<PythonHelp/>
<Button>,Art/Interface/Buttons/Process/Blank.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,5</Button>
<iAIValue>1000</iAIValue>
</EventInfo>
Spoiler PYTHON SCRIPT (Using Fierabras's non-random event script) :
Code:
######## GENERAL_ELECTION ########
def canTriggerGeneralElection(argsList):
kTriggeredData = argsList[0]
turn = kTriggeredData.iTurn
if (turn % 6 == 0):
return true
return false