TheBladeRoden
Deity
me three!!
15.0 Appendix B- Event Guide
15.1 Civ4EventInfos.xml
Assets\XML\Events\Civ4EventInfos.xml is the main file describing all the in-game events. This section will describe the tags in that file, explaining their meaning.
Type- this is the event type identifier. Takes the form of EVENT_NAME
Description- identifier of the text string which contains the event description. Typically takes the form of TXT_KEY_EVENT_NAME, and description text strings can be found in Assets\XML\Text\Civ4GameText_Events_BTS.xml
LocalInfoText- identifier of the text string, if any, to be shown to the affected player.
WorldNewsTexts- specifies text, if any, to be shown to every player in the world (who has met the affected civilization) when the event occurs.
OtherPlayerPopup- specifies text, if any, to show in a popup to the other player affected. In BtS, is used for the Partisans event.
QuestFailText- specifies text, if any, to be displayed if the quest has been failed. Obviously, used for quests.
bQuest- can be either 0 or 1. If set to 1, then the event is actually a quest.
bGlobal- can be either 0 or 1. If set to 1, then the event will apply to all players. That is used for events that complete a quest in order to reset it for every player.
bTeam- can be either 0 or 1. If set to 1, then it will apply to all players on the same team. Its not used in any of the events shipping with BtS.
bPickCity- can be either 0 or 1. If set to 1, then the event affects a city of the player for whom the event was triggered.
bPickOtherPlayerCity- can be either 0 or 1. If set to 1, the event affects a foreign city. For example, you can be given the choice of spending some espionage points to worsen the effects this event deals to the foreign city. Used in conjunction with <bPickCity>, creates an event that affects the players city and a foreign city. Famine is one example of such an event in BtS.
bDeclareWar- can be either 0 or 1. If set to 1, will cause the affected player and the other player to go to war.
iGold- is a number. Specifies the base amount of gold that the affected player gains. If set to a negative number, the player will lose the gold. Can also optionally affect the other player see below.
bGoldToPlayer- can be either 0 or 1. Works in conjunction with <iGold>. If set to 1, then the gold value of <iGold> will be given to the other player. Since it requires another player, its only useful for events that involve another player.
iRandomGold- is a number. Specifies the cap for an extra random amount of gold that is added to iGold to produce the total amount of gold.
iCulture- is a number. Specifies the amount of culture to be added to a city only useful for events targeting a city.
iEspionagePoints- is a number. Specifies the amount of espionage points that the affected player will gain towards the other player.
bGoldenAge- can be either 0 or 1. If set to 1, triggers a golden age for the affected player.
iFreeUnitSupport- is a number. Specifies how many extra free units the player is allowed to support.
iInflationMod- is a number. Specifies by how much the affected players inflation modifier is changed.
iSpaceProductionMod- is a number. Specifies by how much the players spaceship part production modifier is changed. A value of 10, for example, would speed SS production up by 10%.
Tech- is a technology identifier. NONE for no technology. If set, explicitly specifies a technology towards which you can gain beakers.
TechFlavors- if not empty, contains one or more flavor types. For events that result in progress towards a technology, flavors affect which technology will be picked. For example, FLAVOR_RELIGION with a value of 1 will make you more likely to have progress towards a religious technology.
iTechPercent- is a number. Specifies by how many percent closer the player will become to the technology. The technology can be set explicitly (see <Tech>) or chosen randomly. Negative numbers can be used to set research back.
iTechCostPercent- is a number. Specifies how many percent of the technologys beaker cost to convert to a gold value.
iTechMinTurnsLeft- is a number. Specifies that the event may only affect techs for which the player needs at least this many turns to research. For example, setting to 2 for an event that advances research progress would mean that progress wont be advanced for a tech that youre about to complete in 2 turns.
PrereqTech- is a technology identifier. NONE for no technology. If set, then the technology is required for this event. Used to create event choices that the player can not pick unless he has the tech.
UnitClass- is a unit class identifier. NONE for no unit class. Specifies a unit class for receiving free units see below.
iNumFreeUnits- is a number. Specifies how many free units of the class given in <UnitClass> the player should receive. For example, with <UnitClass> set to UNITCLASS_CROSSBOWMAN and <iNumFreeUnits> to 2, the player would get 2 free Crossbowmen, or 2 free Chu-Ko-Nu if Chinese.
bDisbandUnit- can be either 0 or 1. If set to 1, disbands (kills) the affected unit.
iUnitExperience- is a number. Specifies the amount of free XP received by the affected unit.
iUnitImmobileTurns- is a number. Specifies the number of turns that the affected unit will remain immobile. Immobile units can still defend.
UnitPromotion- is a promotion identifier. For events that affect a specific unit (as determined by the trigger), can be used to apply a promotion to that specific unit. Its not used in BtS, however instead, Python callbacks are used (example: the Champion event).
UnitName- is a text string identifier. If specified, will set the affected units name to the specified string.
UnitCombatPromotions- if non-empty, contains free promotions that all units of a selected combat type receive. Format to fill is as follows:
The above would give all archery units a free Combat I promotion.Code:<UnitCombatPromotions> <UnitCombatPromotion> <UnitCombat>UNITCOMBAT_ARCHER</UnitCombat> <UnitPromotion>PROMOTION_COMBAT1</UnitPromotion> </UnitCombatPromotion> </UnitCombatPromotions>
UnitClassPromotions- similar to above. If non-empty, contains free promotions for all units of a selected unit class to receive. Format as follows:
That would give all Axeman-class units Shock.Code:<UnitClassPromotions> <UnitClassPromotion> <UnitClass>UNITCLASS_AXEMAN</UnitClass> <UnitPromotion>PROMOTION_SHOCK</UnitPromotion> </UnitClassPromotion> </UnitClassPromotions>
BuildingClass- is a building class identifier. NONE for no building. Explicitly gives a building class to be affected by the event. Used with <iBuildingChange>, see below.
iBuildingChange- is a number. Specifies how many buildings of the class specified in <BuildingClass> to add. Since a city can only contain 1 of a building, the only useful values are 1 to add a building and -1 to remove it. So, if <BuildingClass> is a BUILDINGCLASS_FORGE and <iBuildingChange> is -1, the event would remove the affected citys Forge.
BuildingExtraYields- if non-empty, contains information that modifies yield given by a building. For example, a building can be made to produce extra food or hammers. Format to fill as follows:
The above would give your Harbours 2 extra commerce. If <bPickCity> is 0, the change will apply to all buildings of the class in your civ. If <bPickCity> is 1, only the building in the affected city will be modified.Code:<BuildingExtraYields> <BuildingExtraYield> <BuildingClass>BUILDINGCLASS_HARBOR</BuildingClass> <YieldType>YIELD_COMMERCE</YieldType> <iExtraYield>2</iExtraYield> </BuildingExtraYield> </BuildingExtraYields>
BuildingExtraCommerces- similar to above, if non-empty, contains information tat modifies commerce outputs given by a building. Note that this is not for pure commerce (to change that, use BuildingExtraYields and YIELD_COMMERCE as per the above example), but rather for commerce types research, culture, gold or espionage. Format to fill as follows:
The above would add 1 gold to the output of your Markets. Just as with the <BuildingExtraYields>, if <bPickCity> is 0, the change will apply to all buildings of the class in your civ. If <bPickCity> is 1, only the building in the affected city will be modified.Code:<BuildingExtraCommerces> <BuildingExtraCommerce> <BuildingClass>BUILDINGCLASS_MARKET</BuildingClass> <CommerceType>COMMERCE_GOLD</CommerceType> <iExtraCommerce>1</iExtraCommerce> </BuildingExtraCommerce> </BuildingExtraCommerces>
BuildingExtraHappies- another similar tag, if non-empty, assigns extra happiness to buildings. Format as follows:
Thats to add 1 happiness to a Theatre. Once again, if <bPickCity> is 0, the change will apply to all buildings of the class in your civ. If <bPickCity> is 1, only the building in the affected city will be modified.Code:<BuildingExtraHappies> <BuildingExtraHappy> <BuildingClass>BUILDINGCLASS_THEATRE</BuildingClass> <iHappy>1</iHappy> </BuildingExtraHappy> </BuildingExtraHappies>
BuildingExtraHealths- works just like <BuildingExtraHappies> above, but adds extra health.
That would give +1 health to your Hospitals. If <bPickCity> is 0, the change will apply to all buildings of the class in your civ. If <bPickCity> is 1, only the building in the affected city will be modified.Code:<BuildingExtraHealths> <BuildingExtraHealth> <BuildingClass>BUILDINGCLASS_HOSPITAL</BuildingClass> <iHealth>1</iHealth> </BuildingExtraHealth> </BuildingExtraHealths>
iHappy- is a number. Specifies extra happiness to give. If <bPickCity> is 0, the change will apply to the entire civ. If bPickCity> is 1, only the affected citys happiness will be modified.
iHealth- is a number. Specifies extra health to give. If <bPickCity> is 0, the change will apply to the entire civ. If <bPickCity> is 1, only the affected citys health will be modified.
iHurryAnger- is a number. Specifies extra whipping unhappiness to give. Unhappy citizens created by events using this variable will have the We can not forget your cruel oppression! unhappiness. You can be extra evil by setting <bPickCity> to 0, which would give the penalty in all cities. Ack!
iHappyTurns- is a number. Specifies the amount of turns to give temporary happiness. The amount of happy faces given is specified in Assets\XML\GlobalAssets.xml as the TEMP_HAPPY variable. It defaults to 1 in BtS. Therefore, setting <iHappyTurns> to 10 would ensure +1 happiness for 10 turns. Once again, if <bPickCity> is 0, the change will apply to the entire civ. If <bPickCity> is 1, only the affected citys happiness will be modified.
iRevoltTurns- is a number. Specifies the amount of turns that the city will spend in revolt (no production, etc., like newly captured cities). Must be city-targeted, that is, used in conjunction with <bPickCity> or <bPickOtherPlayerCity> set to 1.
iMinPillage- is a number. Specifies the minimum amount of terrain improvements that will be pillaged (removed). If used with a city-targeting event, then the pillaged improvement will be in the citys radius. If the event doesnt target a city, the improvement may be anywhere.
iMaxPillage- is a number. Specifies the maximum amount of terrain improvement that will be pillaged(removed). Works in conjunction with <iMinPillage> and must be equal or greater than <iMinPillage>, see above. Setting both variables to an equal value will result in exactly that many improvements getting pillaged.
iFood- is a number. Specifies the amount of stored food to be added in a city. If <bPickCity> is 0, the change will apply to the entire civ. If <bPickCity> is 1, only the affected citys food stores will be modified.
iFoodPercent- is a number. Specifies by how many percent to modify the stored food in a city. You can remove all the stored food by setting this value to -100. If <bPickCity> is 0, the change will apply to the entire civ. If <bPickCity> is 1, only the affected citys food stores will be modified.
FreeSpecialistCounts- if non-empty, describes the free specialists added to a city. Can only be used with events that target a city. Format is as follows:
That would add a free Scientist to the city.Code:<FreeSpecialistCounts> <FreeSpecialistCount> <SpecialistType>SPECIALIST_SCIENTIST</SpecialistType> <iFreeSpecialistCount>1</iFreeSpecialistCount> </FreeSpecialistCount> </FreeSpecialistCounts>
FeatureType- is a feature type identifier, NONE for no feature types. Sets the feature type that the event will add or remove in a plot, used in conjunction with <iFeatureChange>, see below.
iFeatureChange- is a number. If used, should only take the values of 1 or -1. Setting to 1 would add the feature described in <FeatureType> to the affected plot, setting to -1 would remove the feature.
ImprovementType- is an improvement type identifier, NONE for no improvement. Sets the improvement type that the event will add or remove in a plot, used in conjunction with <iImprovementChange>, see below.
iImprovementChange- is a number. If used, should only take the values of 1 or -1. Setting to 1 would add the improvement described in <ImprovementType> to the affected plot, setting to -1 would remove the improvement.
BonusType- is a bonus (resource) type identifier, NONE for no bonus. Sets the bonus type that the event will add or remove in a plot, used in conjunction with <iBonusChange>, see below.
iBonusChange- is a number. If used, should only take the values of 1 or -1. Setting to 1 would add the bonus described in <BonusType> to the affected plot, setting to -1 would remove the bonus.
RouteType- is a route type identifier, NONE for no route. Sets the route type that the event will add or remove in a plot, used in conjunction with <iRouteChange>, see below.
iRouteChange- is a number. If used, should only take the values of 1 or -1. Setting to 1 would add the route described in <RouteType> to the affected plot, setting to -1 would remove the route.
BonusRevealed- is a bonus type identifier, NONE for no bonus. If used, will reveal the specified bonus to the affected player, even if he has no technology to normally see the bonus.
BonusGift- is a bonus type identifier, NONE for no bonus. If used, will make the affected player gift the specified bonus to the other player. As such, it can only be used with events that affect two players.
PlotExtraYields- if non-empty, contains information that modifies the yields of the affected plot. Format is as follows:
The above would add 1 commerce to the affected plot.Code:<PlotExtraYields> <PlotExtraYield> <YieldType>YIELD_COMMERCE</YieldType> <iExtraYield>1</iExtraYield> </PlotExtraYield> </PlotExtraYields>
iConvertOwnCities- is a number. Specifies the number of the players cities that will be converted to the trigger religion, the religion being added to the city if not already present. The religion is determined in event triggers.
iConvertOtherCities- is a number. Specifies the number of foreign cities that will be converted to the trigger religion. The religion is determined in event triggers.
iMaxNumReligions- is a number. Specifies the maximum amount of religions that may be present in a city in order for it to be converted by either <iConvertOwnCities> or <iCnvertOtherCities>. If you wish to ignore the amount of religions already in the city, set this variable to -1.
iOurAttitudeModifier- is a number. Specifies the attitude modifier of the affected player towards the other player.
iAttitudeModifier- is a number. Specifies the attitude modifier of the other player towards the affected player.
iTheirEnemyAttitudeModifier- is a number. Specifies the attitude modifier of the affected player towards the other players worst enemy and vice versa. For example, if set to -1, Civ A is the affected player and Civ B is the other player, then Civ A will have -1 towards Civ Bs worst enemy and Civ Bs worst enemy will also have a -1 modifier towards Civ A.
iPopulationChange- is a number. Specifies the population change in the city negative numbers indicate population loss. If <bPickCity> is 0, the change will apply to the entire civ. If <bPickCity> is 1, only the affected citys population will be modified.
AdditionalEvents- if non-empty, specifies extra events that will have a chance of occuring if that event happens. For example,
means that EVENT_AIRLINER_CRASH_4 will be triggered with a likelihood of 50%.Code:<AdditionalEvents> <EventChance> <Event>EVENT_AIRLINER_CRASH_4</Event> <iEventChance>50</iEventChance> </EventChance> </AdditionalEvents>
EventTimes- if non-empty, it can be used to set up delayed events. Has to be used along with <AdditionalEvents> above. Fill as follows:
In case the event filled in <AdditionalEvents> does not trigger due to the random roll, the event timer will kick in, making it occur later.Code:<EventTimes> <EventTime> <Event>EVENT_MOTOR_OIL_1</Event> <iEventTime>5</iEventTime> </EventTime> </EventTimes>
ClearEvents- if non-empty, specifies the events which get reset and the probability of that happening. For example:
This resets the EVENT_DUSTBOWL_2 unconditionally, which means that the event is considered to not have occurred.Code:<ClearEvents> <EventChance> <Event>EVENT_DUSTBOWL_2</Event> <iEventChance>100</iEventChance> </EventChance> </ClearEvents>
PythonCallback- If non-empty, specifies the Python function that is called when the event occurs. See the section on Python for more information.
PythonExpireCheck- if non-empty, specifies the Python function that is called to check whether the event expires. See the section on Python for more information.
PythonCanDo- If non-empty, specifies the Python function that is called to verify whether the event can be triggered. See the section on Python for more information.
PythonHelp- If non-empty, specifies the Python function that generates the help text for this event. See the section on Python for more information.
Button- Specifies the art file which is displayed as the events button.
iAIValue- is a number. Reflects the AI trigger value for this event.
15.2 CIV4EventTriggers.xml
So that’s it as far as event descriptions go in the XML. However, that is only one side of the event description. The other side are triggers. Triggers are described in Assets\XML\Civ4EventTriggerInfos.xml. In essence, every trigger is a set of conditions. If these conditions are true, then events tied to that particular trigger can occur (some have extra Python checks, that’s in the Python section). Events that are tied to a trigger are also described in this file. Predictably enough, the SDK class for event triggers is CvEventTriggerInfo.
So, here are the tags describing triggers.
Type- this is the trigger type identifier. Takes the form of EVENTTRIGGER_NAME
WorldNewsTexts- is a text string identifier, which spiecifies the text to be displayed to all players when the event occurs.
TriggerTexts- text string identifiers can be specified for additional trigger messages, in particular, texts tied to an era. For instance, the Ruins effect:
Here, separate text is being given for every era, so that the correct text would appear at the appropriate time.Code:<TriggerTexts> <TriggerText> <Text>TXT_KEY_EVENT_TRIGGER_CITY_RUINS_ANCIENT_1</Text> <Era>ERA_ANCIENT</Era> </TriggerText> <TriggerText> <Text>TXT_KEY_EVENT_TRIGGER_CITY_RUINS_ANCIENT_1</Text> <Era>ERA_CLASSICAL</Era> </TriggerText> <TriggerText> <Text>TXT_KEY_EVENT_TRIGGER_CITY_RUINS_ANCIENT_1</Text> <Era>ERA_MEDIEVAL</Era> </TriggerText> <TriggerText> <Text>TXT_KEY_EVENT_TRIGGER_CITY_RUINS_ANCIENT_1</Text> <Era>ERA_RENAISSANCE</Era> </TriggerText> <TriggerText> <Text>TXT_KEY_EVENT_TRIGGER_CITY_RUINS_INDUSTRIAL_1</Text> <Era>ERA_INDUSTRIAL</Era> </TriggerText> <TriggerText> <Text>TXT_KEY_EVENT_TRIGGER_CITY_RUINS_INDUSTRIAL_1</Text> <Era>ERA_MODERN</Era> </TriggerText> <TriggerText> <Text>TXT_KEY_EVENT_TRIGGER_CITY_RUINS_INDUSTRIAL_1</Text> <Era>ERA_FUTURE</Era> </TriggerText> </TriggerTexts>
bSinglePlayer- can be either 0 or 1. If set to 1, the event can only trigger in singleplayer games.
iPercentGamesActive- is a number from 0 to 100. When you start a new game, not all events will be in it. This number determines the probability of this event trigger being included in a new game. Thus you can create events that will be rarely seen – or, on the contrary, be eligible to occur in every game.
iWeight- is a number that affects the probability of this trigger triggering. Applies to events that are active in this game only (as does everything else). Set to -1 if the trigger needs to always occur if the other conditions are met (for example, triggers that determine quest completion should be with -1).
bProbabilityUnitMultiply- can be either 0 or 1. If set to 1, the trigger probability increases as the player builds more units.
bProbabilityBuildingMultiply- can be either 0 or 1. If set to 1, the trigger probability increases as the player builds more buildings.
Civic- is a civic identifier, NONE for no civic. If used, specifies the civic required for the trigger to activate.
iMinTreasury - is a number. Specifies the minimum amount of gold in the player’s treasury for the trigger to activate.
iMinPopulation- is a number. Specifies the minimum total population that a player must have for the trigger to activate.
iMaxPopulation- is a number. Specifies the maximum total population that a player is allowed to have for the trigger to activate.
iMinMapLandmass- is a number. Specifies the minimum amount of land areas that must be on the map for the trigger to activate. Can be used, essentially, to specify the minimum amount of continents required.
iMinOurLandmass- is a number. Specifies the minimum amount of land areas that must be under player’s control (specifically, have cities on them) for the trigger to activate.
iMaxOurLandmass- is a number. Specifies the maximum amount of land areas that the player is allowed to control for the trigger to activate. Use -1 to have no restrictions.
MinDifficulty- is a difficulty level specifier, NONE for no difficulty. If used, specifies the minimum difficulty level required for the event trigger to activate,
iAngry- is a number. Specifies the minimum anger level (unhappiness – happiness) in a city for the trigger to activate. Applies to triggers that target a city.
iUnhealthy- is a number. Specifies the minimum unhealthiness level (bad health – good health) in a city for the trigger to activate. Applies to triggers that target a city.
UnitsRequired- if non-empty, contains information about required units to trigger. So, if specified, events can only be triggered for the listed unit classes. Example:
Such a trigger would make the event only affect the listed naval units.Code:<UnitsRequired> <UnitClass>UNITCLASS_GALLEY</UnitClass> <UnitClass>UNITCLASS_TRIREME</UnitClass> <UnitClass>UNITCLASS_CARAVEL</UnitClass> <UnitClass>UNITCLASS_GALLEON</UnitClass> <UnitClass>UNITCLASS_PRIVATEER</UnitClass> <UnitClass>UNITCLASS_FRIGATE</UnitClass> <UnitClass>UNITCLASS_SHIP_OF_THE_LINE</UnitClass> <UnitClass>UNITCLASS_IRONCLAD</UnitClass> <UnitClass>UNITCLASS_TRANSPORT</UnitClass> <UnitClass>UNITCLASS_DESTROYER</UnitClass> <UnitClass>UNITCLASS_STEALTH_DESTROYER</UnitClass> <UnitClass>UNITCLASS_BATTLESHIP</UnitClass> <UnitClass>UNITCLASS_MISSILE_CRUISER</UnitClass> <UnitClass>UNITCLASS_SUBMARINE</UnitClass> <UnitClass>UNITCLASS_ATTACK_SUBMARINE</UnitClass> <UnitClass>UNITCLASS_CARRIER</UnitClass> </UnitsRequired>
iNumUnits- is a number. Specifies the amount of unts that must be on a plot for the trigger to activate – used for events which pick a plot. If used in conjunction with <UnitsRequired>, only units of the listed classes will be counted.
iNumUnitsGlobal- is a number. Specifies the amount of units that the player must have for the trigger to activate. If used in conjunction with <UnitsRequired>, only units of the listed classes will be counted.
iUnitDamagedWeight- is a number. Denotes the probability of the trigger activating for wounded units. Set to 1 for event triggers that you wish to deal with damaged units.
iUnitDistanceWeight- is a number. For events that affect a plot, increases the probability (if set to 1) of the trigger activating if a unit is far away from the plot.
iUnitExperienceWeight- is a number. When set to 1, increases the probability of triggering for a highly-experienced unit.
bUnitsOnPlot- can be either 0 or 1. When set to 1, means that the trigger checks for the presence of units (listed in <UnitsRequired>) on the affected plot.
BuildingsRequired- if non-empty, contains informations about the buildings required to trigger. Example:
That would denote that a Forge is required for the trigger.Code:<BuildingsRequired> <BuildingClass>BUILDINGCLASS_FORGE</BuildingClass> </BuildingsRequired>
iNumBuildings- is a number used in conjunction with <BuildingsRequired>. Set to 1 to indicate that 1 building of that type is required in a city, for city-picking events.
iNumBuildingsGlobal- is a number. Specifies the minimum amount of buildings listed in <BuildingsRequired> that the player must have in total for the trigger to activate.
iNumPlotsRequired- is a number. Should be set to 1 for triggers that require a plot that meets specific conditions. See below for tags that specify these conditions.
bOwnPlot- can be either 0 or 1. If set to 1, specifies that the plot must be owned by the affected player to meet conditions.
iPlotType- is a number. Specifies the plot type that the plot must have to meet the condition. Set to -1 to ignore plot type. Unless otherwise modded, 0 stands for peaks (PLOT_PEAK), 1 for hills (PLOT_HILLS), 2 for land plots (PLOT_LAND) and 3 for ocean plots (PLOT_OCEAN). The enumeration listing plot types is PlotTypes in the SDK and Python.
FeaturesRequired- if non-empty, specifies the features that the plot must have to meet the condition. For example:
That is to require a plot to have Forest. Note that you can also explicitly require a plot not to have any features as follows:Code:<FeaturesRequired> <FeatureType>FEATURE_FOREST</FeatureType> </FeaturesRequired>
Please note that flood plains also count as a feature and the above example would exclude any floodplain plots.Code:<FeaturesRequired> <FeatureType>NONE</FeatureType> </FeaturesRequired>
TerrainsRequired- if non-empty, specifies the terrain type that the plot must have to meet the condition. For example:
to indicate that Grasslands or Plains plots are eligible for the trigger.Code:<TerrainsRequired> <TerrainType>TERRAIN_GRASS</TerrainType> <TerrainType>TERRAIN_PLAINS</TerrainType> </TerrainsRequired>
ImprovementsRequired- if non-empty, specifies the improvements that the plot must have to meet the condition. As an example:
That is to require a Plantation. Note that you can, just like with Features, set the variable to NONE to explicitly require no improvement to be present.Code:<ImprovementsRequired> <ImprovementType>IMPROVEMENT_PLANTATION</ImprovementType> </ImprovementsRequired>
BonusesRequired- if non-empty, specifies the bonus (resource) types that the plot must have to meet the condition. So,
Requires Incense in the plot. And again, setting the variable to NONE will explicitly require no bonus to be present.Code:<BonusesRequired> <BonusType>BONUS_INCENSE</BonusType> </BonusesRequired>
RoutesRequired- the last variable specifying plot conditions. If non-empty, specifies the route types that the plot must have to meet the condition.
The above requires either a road or a railroad in the plot.Code:<RoutesRequired> <RouteType>ROUTE_ROAD</RouteType> <RouteType>ROUTE_RAILROAD</RouteType> </RoutesRequired>
ReligionsRequired- if non-empty, specifies the religions required for the trigger to activate. For triggers that affect a city, the religions must be present in the city. For triggers not affecting a city, the religion must be present anywhere in the civilization. Hence:
That code would check for the presence of Buddhism, Confucianism and Taoism. It’s used in conjunction with the next variable, see below.Code:<ReligionsRequired> <ReligionType>RELIGION_BUDDHISM</ReligionType> <ReligionType>RELIGION_CONFUCIANISM</ReligionType> <ReligionType>RELIGION_TAOISM</ReligionType> </ReligionsRequired>
iNumReligions- is a number. Specifies how many of the religions listed in <ReligionsRequired> must be present for the trigger to activate. If <ReligionsRequired> has been left empty, then any religions will do. For example, for a trigger that affects a city, if <ReligionsRequired> is empty and <iNumReligions> is 2, then cities with at least different 2 religions in them will be eligible for the trigger.
CorporationsRequired- if non-empty, specifies the corporations required for the trigger to activate. For triggers that affect a city, the religions must be present in the city. For triggers not affecting a city, the religion must be present anywhere in the civilization.
That would require the first corporation, which is Cereal Mills. Just like <ReligionsRequired>, this is used in combination with the next variable.Code:<CorporationsRequired> <CorporationType>CORPORATION_1</CorporationType> <CorporationsRequired>
iNumCorporations- is a number. Works exactly like <iNumReligions>, but for corporations instead of religions. Specifies how many of the corporations listed in <CorporationsRequired> must be present for the trigger to activate. If <CorporationsRequired> has been left empty, then any corporation will do.
bPickReligion- can be either 0 or 1. If set to 1, then the trigger will pick a religion for the events that it activates. Which religion is picked can be further specified by the next variables.
bStateReligion- can be either 0 or 1. If set to 1 and <bPickReligion> is 1, then the affected player’s state religion will be picked.
bHolyCity- can be either 0 or 1. If set to 1 and <bPickReligion> is 1, then the player must own the religion’s holy city in order for it to be picked. If the trigger also picks a city, then the picked city must be the religion’s holy city. For example, if <bPickReligion>, <bStateReligion>, <bHolyCity> are all 1 and the trigger picks a city (<bPickCity> is also 1), then the city picked will be the holy city of the player’s state religion, provided he owns that city.
bPickCorporation- can be either 0 or 1. If set to 1, then a corporation will be picked by the trigger. The corporation must be present in the player’s civilization to be picked.
bHeadquarters- can be either 0 or 1. If set to 1 and <bPickCorporation> is 1 then the player must own the corporation’s headquarters in order for it to be picked. If the trigger also picks a city, then the picked city must be the corporation headquarters. Works like <bHolyCity> does for religions.
Events- this, ladies and gentlemen, is the holy grail of the trigger XML file. Here event identifiers from Civ4EventInfos.xml are listed that denote the events triggered by this particular trigger. Note that each choice is also technically an event – therefore, for events that have choices, multiple identifiers will be listed. Take a look at the slave revolt event example:
The code means that, when the trigger activates, the player will be allowed to choose between three events. So in-game, a popup with three options will appear. The effects of every choice are, of course, specified in Civ4EventInfos.xml. Triggers that do not have a choice associated with them simply list one event:Code:<Events> <Event>EVENT_SLAVE_REVOLT_1</Event> <Event>EVENT_SLAVE_REVOLT_2</Event> <Event>EVENT_SLAVE_REVOLT_3</Event> </Events>
Here the player will have no choice but to accept what happened.Code:<Events> <Event>EVENT_TORNADO_1</Event> <Events>
PrereqEvents- another fun field, this lists the events that must have already happened for this trigger to possibly activate. There are two main uses. One is to simply specify conditional triggers. For example, EVENTTRIGGER_DUSTBOWL_CONT has
That means that the trigger can only activate if the EVENT_DUSTBOWL_2 event has occurred previously.Code:<PrereqEvents> <Event>EVENT_DUSTBOWL_2</Event> </PrereqEvents>
The second use is for quest done triggers. When creating quests, each quest needs a trigger that checks whether its conditions have been fulfilled. However, a quest can only be completed if it’s been given. Therefore, for example, EVENTTRIGGER_HORSE_WHISPERING_DONE, which fires when you complete the Horse Whispering quest, has:
That code makes sure that the trigger only activates if the EVENT_HORSE_WHISPERING_1 event has occurred, that being the event which assigns the Horse Whispering quest.Code:<PrereqEvents> <Event>EVENT_HORSE_WHISPERING_1</Event> </PrereqEvents>
bPrereqEventPlot- can be either 0 or 1. For triggers that have PrereqEvents specified, if set to 1, means that the trigger will fire on the same plot where the prerequisite events fired. This is used with triggers such as continuing slave revolts or dustbowls – if the prerequisite event has fired, dustbowl or revolts will, if triggered, happen again in the same place where they did before.
OrPreReqs- if non-empty, lists technologies that player must have for the trigger to activate. These requirements are Or requirements – that is, only one technology of the listed ones is required. Example:
That allows the trigger to activate if the player has Steam Power or Steel or Scientific Method or Artillery.Code:<OrPreReqs> <PrereqTech>TECH_STEAM_POWER</PrereqTech> <PrereqTech>TECH_STEEL</PrereqTech> <PrereqTech>TECH_SCIENTIFIC_METHOD</PrereqTech> <PrereqTech>TECH_ARTILLERY</PrereqTech> </OrPreReqs>
AndPreReqs- if non-empty, lists technologies that the player must have for the trigger to activate. These are And requirements – the player must have all the listed technologies for the trigger. Example:
This trigger can only fire when the player has both Rifling and Steel technologies.Code:<AndPreReqs> <PrereqTech>TECH_RIFLING</PrereqTech> <PrereqTech>TECH_STEEL</PrereqTech> </AndPreReqs>
ObsoleteTechs- if non-empty, lists technologies that obsolete the trigger, making it ineligible to activate. If multiple technologies are listed, having any of those will invalidate the trigger for that player.
These settings would obsolete the trigger for any player who has Rifling or Railroad or Economics.Code:<ObsoleteTechs> <ObsoleteTech>TECH_RIFLING</ObsoleteTech> <ObsoleteTech>TECH_RAILROAD</ObsoleteTech> <ObsoleteTech>TECH_ECONOMICS</ObsoleteTech> </ObsoleteTechs>
bRecurring- can be either 0 or 1. If set to 1, the trigger can activate multiple times throughout the game for the same player. If set to 0, it can only activate once per player. Note that the <ClearEvents> field in event description can reset events, making the game forget they have occurred.
bTeam- can be either 0 or 1. If set to 1, the trigger applies to all players on the same team. Not used in any of the events shipping in BtS.
bGlobal- can be either 0 or 1. If set to 1, applies to all players. That means that, when triggered for one player, it’s cosidered to have triggered for all players. Combined with <bRecurring> set to 0, it will result in triggers that can only happen once per game.
bPickPlayer- can be either 0 or 1. If set to 1, then the trigger will pick another player to affect by the event. This is how events that give stuff to other players or affect relations with them are created. The specific player who gets selected can be further narrowed down by the next six tags.
bOtherPlayerWar- can be either 0 or 1. If set to 1, then the trigger can activate when the affected player and the other player are at war. When set to 1, the trigger activates for player pairs at peace.
bOtherPlayerHasReligion- can be either 0 or 1. If set to 1, then the other player must have the religion picked by the trigger (see <bPickReligion>). If <bStateReligion> is 0, then the other player must have the religion somewhere in his empire. If <bStateReligion> is 1, then the other player must have the same state religion.
bOtherPlayerHasOtherReligion- can be either 0 or 1. Works opposite to the previous variable. If set to 1, the other player must have a different religion than the picked one. If <bStateReligion> is 1, then the other player’s state religion must be different.
bOtherPlayerAI- can be either 0 or 1. If set to 1, then the other player must be an AI player.
iOtherPlayerShareBorders- is a number. Specifies the minimum amount of land plots that the affected player and the other player must have along the border (adjacent to one another).
OtherPlayerHasTech- is a technology identifier, NONE for no technology. If used, specifies the technology that the other player must have for the trigger to activate.
bPickCity- can be either 0 or 1. If set to 1, then the trigger will pick a city.
bPickOtherPlayerCity- can be either 0 or 1. If set to 1, then the trigger will pick one of the other player’s cities.
bShowPlot- can be either 0 or 1. If set to 1, then the plot in which the event happens will be visually highlighted.
iCityFoodWeight- is a number. Acts as a probability multiplier for the food stored in a city. That is, for triggers that pick a city, cities with more food stored will have a higher probability of being picked as iCityFoodWeight increases. 1 is a sane value to prioritize cities with a lot of food stored.
PythonCanDo- if specified, it’s the name of the Python function which is executed to check whether the trigger can be triggered. See the section on Python for more information.
PythonCanDoCity- if specified, it’s the name of the Python function which checks whether a city is eligible to be picked by the trigger. See the section on Python for more information.
PythonCanDoUnit- if specified, it’s the name of the Python function which checks whether a unit is eligible to be picked by the trigger. See the section on Python for more information.
PythonCallback- if specified, it’s the name of the Python function which is called when the trigger activates. Not used in any of the BtS events. Don’t confuse with <PythonCallback> in event descriptions in Civ4EventInfos.xml, which is the function which gets called when the event happens. See the section on Python for more information.