TC01
Deity
I've been trying to add events to my Star Trek (Final Frontier) modmod. Random events.
I've had some success thus far. I was able to successfully add random events, three of them, one with a generic ability (destroy an improvement unless you pay gold), two with more complicated abilities.
However, my fourth event is driving me crazy while trying to add it. First, some background:
1. This is Final Frontier (Star Trek), so expect some weird things, probably.
2. This is a module. Modular loading is enabled.
3. In this module are four files, the event schema, the event infos, the event trigger infos, and a game text files.
4. After my first trouble with event #4, I removed all other events and event triggers and even text from those other files save one trigger, two events it executed, and a bunch of game text that it referred to.
5. The event trigger needs a Nutrition Facility in the city to trigger. I made it this way because while normally this building would always be in the city, it might not be if the city was conquered.
6. It's like the "Rural Farmers" event, except with an added option that allows you to sell your new technology (for making food) to other civs for gold.
7. With iPercentGamesActive set to 100 and iWeight set to -1, the event should trigger on the first turn the conditions are met- in other words, the second turn, first turn events can trigger. It doesn't.
8. Commenting out everything execpt "return True" in the canDoCity callback (which is the only prereq for the event to trigger) should make it auto-trigger. It doesn't.
9. To make CvRandomEventInterface.py work, I added a import CvSolarSystem to the top of the file.
10. I get no python exceptions. The event simply doesn't trigger.
Below are the (spoilered for size) infos. I also have a python canDoCity included because I found that trying to check if a city had a building via XML wasn't working (no doubt because in FF, buildings are stored via Python).
Event Trigger
Events
Python CanDoCity
I'm new at modding random events, but I don't see anything wrong here at first glance. (For instance, the game read my code when I put a purposeful syntax error in the code). What could be causing an event to misbehave as I described above? It might be something incredibly stupid... something in the XML that I missed? Or it might not be...
I've had some success thus far. I was able to successfully add random events, three of them, one with a generic ability (destroy an improvement unless you pay gold), two with more complicated abilities.
However, my fourth event is driving me crazy while trying to add it. First, some background:
1. This is Final Frontier (Star Trek), so expect some weird things, probably.
2. This is a module. Modular loading is enabled.
3. In this module are four files, the event schema, the event infos, the event trigger infos, and a game text files.
4. After my first trouble with event #4, I removed all other events and event triggers and even text from those other files save one trigger, two events it executed, and a bunch of game text that it referred to.
5. The event trigger needs a Nutrition Facility in the city to trigger. I made it this way because while normally this building would always be in the city, it might not be if the city was conquered.
6. It's like the "Rural Farmers" event, except with an added option that allows you to sell your new technology (for making food) to other civs for gold.
7. With iPercentGamesActive set to 100 and iWeight set to -1, the event should trigger on the first turn the conditions are met- in other words, the second turn, first turn events can trigger. It doesn't.
8. Commenting out everything execpt "return True" in the canDoCity callback (which is the only prereq for the event to trigger) should make it auto-trigger. It doesn't.
9. To make CvRandomEventInterface.py work, I added a import CvSolarSystem to the top of the file.
10. I get no python exceptions. The event simply doesn't trigger.
Below are the (spoilered for size) infos. I also have a python canDoCity included because I found that trying to check if a city had a building via XML wasn't working (no doubt because in FF, buildings are stored via Python).
Event Trigger
Spoiler :
Code:
<EventTriggerInfo>
<Type>EVENTTRIGGER_REPLICATORS</Type>
<WorldNewsTexts>
<Text>TXT_KEY_EVENTTRIGGER_REPLICATORS</Text>
</WorldNewsTexts>
<TriggerTexts>
<TriggerText>
<Text>TXT_KEY_EVENT_TRIGGER_REPLICATORS_ENT</Text>
<Era>ERA_ENT</Era>
</TriggerText>
<TriggerText>
<Text>TXT_KEY_EVENT_TRIGGER_REPLICATORS_TOS</Text>
<Era>ERA_TOS</Era>
</TriggerText>
<TriggerText>
<Text>TXT_KEY_EVENT_TRIGGER_REPLICATORS</Text>
<Era>ERA_MOVIES</Era>
</TriggerText>
<TriggerText>
<Text>TXT_KEY_EVENT_TRIGGER_REPLICATORS</Text>
<Era>ERA_TNG</Era>
</TriggerText>
<TriggerText>
<Text>TXT_KEY_EVENT_TRIGGER_REPLICATORS</Text>
<Era>ERA_DS9</Era>
</TriggerText>
<TriggerText>
<Text>TXT_KEY_EVENT_TRIGGER_REPLICATORS</Text>
<Era>ERA_VOY</Era>
</TriggerText>
<TriggerText>
<Text>TXT_KEY_EVENT_TRIGGER_REPLICATORS</Text>
<Era>ERA_FUTURE</Era>
</TriggerText>
</TriggerTexts>
<bSinglePlayer>0</bSinglePlayer>
<iPercentGamesActive>100</iPercentGamesActive>
<iWeight>-1</iWeight>
<bProbabilityUnitMultiply>0</bProbabilityUnitMultiply>
<bProbabilityBuildingMultiply>0</bProbabilityBuildingMultiply>
<Civic>NONE</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>1</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_REPLICATORS_1</Event>
<Event>EVENT_REPLICATORS_2</Event>
</Events>
<PrereqEvents/>
<bPrereqEventPlot>0</bPrereqEventPlot>
<OrPreReqs/>
<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>1</bPickCity>
<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
<bShowPlot>1</bShowPlot>
<iCityFoodWeight>0</iCityFoodWeight>
<PythonCanDo/>
<PythonCanDoCity>canTriggerReplicators</PythonCanDoCity>
<PythonCanDoUnit/>
<PythonCallback/>
</EventTriggerInfo>
Events
Spoiler :
Code:
<EventInfo>
<Type>EVENT_REPLICATORS_1</Type>
<Description>TXT_KEY_EVENT_REPLICATORS_1</Description>
<LocalInfoText/>
<WorldNewsTexts/>
<OtherPlayerPopup/>
<QuestFailText/>
<bQuest>0</bQuest>
<bGlobal>0</bGlobal>
<bTeam>0</bTeam>
<bPickCity>1</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_NUTRITION_FACILITY</BuildingClass>
<YieldType>YIELD_FOOD</YieldType>
<iExtraYield>1</iExtraYield>
</BuildingExtraYield>
</BuildingExtraYields>
<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>-1</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_REPLICATORS_2</Type>
<Description>TXT_KEY_EVENT_REPLICATORS_2</Description>
<LocalInfoText/>
<WorldNewsTexts/>
<OtherPlayerPopup/>
<QuestFailText/>
<bQuest>0</bQuest>
<bGlobal>0</bGlobal>
<bTeam>0</bTeam>
<bPickCity>1</bPickCity>
<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
<bDeclareWar>0</bDeclareWar>
<iGold>50</iGold>
<bGoldToPlayer>0</bGoldToPlayer>
<iRandomGold>150</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/>
<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>-1</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>
Python CanDoCity
Code:
def canTriggerReplicators(argsList):
eTrigger = argsList[0]
ePlayer = argsList[1]
iCity = argsList[2]
pPlayer = gc.getPlayer(ePlayer)
pCity = pPlayer.getCity(iCity)
iNutrition = CvUtil.findInfoTypeNum(gc.getBuildingInfo,gc.getNumBuildingInfos(),'BUILDING_NUTRITION_FACILITY')
if pCity.isNone():
return false
if not pCity.isHasBuilding(iNutrition):
return false
return true
I'm new at modding random events, but I don't see anything wrong here at first glance. (For instance, the game read my code when I put a purposeful syntax error in the code). What could be causing an event to misbehave as I described above? It might be something incredibly stupid... something in the XML that I missed? Or it might not be...