Trouble adding a random event.

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
So I read and understood most of Solver's post about Modding and adding random events, So I decided to try one out for myself. I wanted to add a random event that added the Olympics. So here is what my CIV4EventInfos looks like:
Spoiler :

Code:
<EventInfo>
			<Type>EVENT_OLYMPIC_GAMES_1</Type>
			<Description>TXT_KEY_EVENT_OLYMPIC_GAMES_1</Description>
			<LocalInfoText/>
			<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>500</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>1</iHappy>
			<iHealth>0</iHealth>
			<iHurryAnger>0</iHurryAnger>
			<iHappyTurns>10</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_OLYMPIC_GAMES_2</Type>
			<Description>TXT_KEY_EVENT_OLYMPIC_GAMES_2</Description>
			<LocalInfoText/>
			<WorldNewsTexts/>
			<OtherPlayerPopup/>
			<QuestFailText/>
			<bQuest>0</bQuest>
			<bGlobal>0</bGlobal>
			<bTeam>0</bTeam>
			<bPickCity>0</bPickCity>
			<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
			<bDeclareWar>0</bDeclareWar>
			<iGold>-300</iGold>
			<bGoldToPlayer>0</bGoldToPlayer>
			<iRandomGold>0</iRandomGold>
			<iCulture>2000</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>3</iHappy>
			<iHealth>0</iHealth>
			<iHurryAnger>0</iHurryAnger>
			<iHappyTurns>15</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_OLYMPIC_GAMES_3</Type>
			<Description>TXT_KEY_EVENT_OLYMPIC_GAMES_3</Description>
			<LocalInfoText/>
			<WorldNewsTexts/>
			<OtherPlayerPopup/>
			<QuestFailText/>
			<bQuest>0</bQuest>
			<bGlobal>0</bGlobal>
			<bTeam>0</bTeam>
			<bPickCity>0</bPickCity>
			<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
			<bDeclareWar>0</bDeclareWar>
			<iGold>-650</iGold>
			<bGoldToPlayer>0</bGoldToPlayer>
			<iRandomGold>0</iRandomGold>
			<iCulture>250</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>5</iHappy>
			<iHealth>0</iHealth>
			<iHurryAnger>0</iHurryAnger>
			<iHappyTurns>30</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>-3</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>

And here is my CIV4EventTriggerInfos:

Spoiler :
Code:
<EventTriggerInfos>
		<EventTriggerInfo>
			<Type>EVENTTRIGGER_OLYMPIC_GAMES</Type>
			<WorldNewsTexts>
				<Text>TXT_KEY_EVENTTRIGGER_OLYMPIC_GAMES</Text>
			</WorldNewsTexts>
			<TriggerTexts>
				<TriggerText>
					<Text>TXT_KEY_EVENT_TRIGGER_OLYMPIC_GAMES</Text>
					<Era>NONE</Era>
				</TriggerText>
				
			</TriggerTexts>
			<bSinglePlayer>0</bSinglePlayer>
			<iPercentGamesActive>100</iPercentGamesActive>
			<iWeight>100</iWeight>
			<bProbabilityUnitMultiply>0</bProbabilityUnitMultiply>
			<bProbabilityBuildingMultiply>1</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>
	<BuildingClass>BUILDINGCLASS_COLOSSEUM</BuildingClass> 
			</BuildingsRequired>
			<iNumBuildings>1</iNumBuildings>
			<iNumBuildingsGlobal>0</iNumBuildingsGlobal>
			<iNumPlotsRequired>1</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_OLYMPIC_GAMES_1</Event>
				<Event>EVENT_OLYMPIC_GAMES_2</Event>
				<Event>EVENT_OLYMPIC_GAMES_3</Event>
			</Events>
			<PrereqEvents/>
			<bPrereqEventPlot>0</bPrereqEventPlot>
			<OrPreReqs/>
			<AndPreReqs/>
			<ObsoleteTechs/>
			<bRecurring>1</bRecurring>
			<bTeam>0</bTeam>
			<bGlobal>0</bGlobal>
			<bPickPlayer>1</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>1</bShowPlot>
			<iCityFoodWeight>0</iCityFoodWeight>
			<PythonCanDo/>
			<PythonCanDoCity/>
			<PythonCanDoUnit/>
			<PythonCallback/>
		</EventTriggerInfo>
	</EventTriggerInfos>


It all looks good to me, but the random event only happens to the AI. I tested it by backing up the files and removing every other random event. It happens
only to the AI. What did I miss?


EDIT: I updated the code. I fixed the bug I mentioned but now have a few more. The Olympic Games give me +1 happy and then a second +1. Also, it picks only 1 AI civ to give the relations hit to. What do I do to make it affect all civ's attitude toward me?


EDIT 2:
FINISHED. I have completed this random event.
 
This is probably going to sound stupid, but I see that AI Value is set to 1000 - does this reflect the odds of the event happening to the AI players, or something else? (Just a targeted guess based on modding I've done with other games in languages other than XML.)

Also, shouldn't SinglePlayer be set to 1 rather than 0?

Great idea, let us know when it's done!
 
bSinglePlayer- can be either 0 or 1. If set to 1, the event can only trigger in singleplayer games.
- Solver's guide

I am not sure what the AI value really means. Solver says this about it:
iAIValue- is a number. Reflects the AI trigger value for this event.
But I really don't know what that means.
 
As I understand it iAIValue makes the AI more or less likely to choose which event is to happen. When an AI-player has a choice of events, it will choose the one with the highest iAIValue.
 
Back
Top Bottom