XML (Advanced) Guide to Adding Buildings and Wonders to Brave New World

Wall-type buildings all grant the same four attributes to a city, and as the walls-type buildings become more advanced, the power of the city to fight off invaders is increased. I've shown all of the walls-type buildings' capabilities here in a chart to make it a little easier to understand how these upgrades work. The definition of the walls-type building levels I am including is my own invention I created to help myself understand how all the walls-type buildings interact and work with each other.

The commands related to defensive buildings are:

"AllowsRangeStrike"
always set to "true" the exact function is still a bit unlcear to me​

"Defense"
is a whole number such as "500". This is the "strength" number defensive buildings add. "500" translates to a defensive "strength" number of "5". "Defense" is cumulative, so the more buildings or wonders that directly add "Defense", the greater the total defense strength of the city.​

"ExtraCityHitPoints"
is a whole number such as "25". Adds more hit points that have to be eroded-away in combat in order to conquer the city​

"CityWall"
always set to "true" for WALLS and WALLS_OF_BABYLON​


........................................................................


Chart of Defensive Building Attributes:


Level BUILDTYPE RANGESTRIKE DEFENSE XTRA HIT-PTS CityWall
LEVEL 1: WALLS of BAB TRUE 600 100 TRUE
LEVEL 1: WALLS TRUE 500 50 TRUE
LEVEL 2: CASTLE TRUE 700 25
LEVEL 3: ARSENAL TRUE 900 25
LEVEL 4: MILITARY BASE TRUE 1200 25​



After you build WALLS or WALLS_OF_BABYLON in a city, the city is considered by the game to always afterward have the "CityWall" attribute, so the level 2, 3, and 4 buildings do not include "<CityWall>true</CityWall>". The higher building levels simply add to the strength of the original walls. So if a city has a MILITARY BASE, it has city walls, a total Defense strength of 3300 (33 "strength"), and a total of 125 "ExtraCityHitPoints" as compared to a city without any defensive wall-type buildings. If you are playing as BABYLON, of course, these total defensive values will be different because your initial "WALLS CLASS" building has slightly higher values than the norm.

If your building is to be a walls-type building it needs to fit as closely as possible into the existing "scheme" for defensive buildings, and needs to grant "Defense" and "ExtraCityHitPoints" that are reasonable as compared to the standard game buildings for each level of defensive building.

The reasoning for the attribute "<AllowsRangeStrike>" is a bit murky to me. Obviously there is some additional ability added to a city's ability to fight off invaders, but I haven't seen any obvious mechanics of this when comparing a city without walls to one with walls. Regardless, if you add a defensive-type building to the game, you should include "<AllowsRangeStrike>true</AllowsRangeStrike>" in your XML code for the building.

If your new building is a WALLS replacement, you need to include "<AllowsRangeStrike>true</AllowsRangeStrike>", "<CityWall>true</CityWall>", and values for "Defense" and "ExtraCityHitPoints".

If your new building fits into Level 2 or higher (CASTLE or better), you should OMIT "<CityWall>true</CityWall>", but INCLUDE "<AllowsRangeStrike>true</AllowsRangeStrike>" as well as values for "Defense" and "ExtraCityHitPoints".

All of these defensive-type buildings are also tagged with the "<NeverCapture>" attribute, which will be discussed later.

ADDING INDIVIDUAL ATTRIBUTES

You can add individual defensive attributes to your building, and this is fairly common with mods that add new world wonders. The Red Fort world wonder as supplied by FIRAXIS adds a "Defense" of "1200" to the city, but doesn't include any commands for the other defensive attributes. You should probably only add "Defense" and "ExtraCityHitPoints" to your buildings as extra side-benefits to your building.

CODE USED IN-GAME FOR DEFENSIVE BUILDINGS

Following are the values given in the FIRAXIS-supplied XML for the various types of city defensive buildings:

Spoiler :
WALLS​

Code:
<AllowsRangeStrike>true</AllowsRangeStrike>
<Defense>500</Defense>
<ExtraCityHitPoints>50</ExtraCityHitPoints>
<CityWall>true</CityWall>

WALLS OF BABYLON​

Code:
<AllowsRangeStrike>true</AllowsRangeStrike>
<ExtraCityHitPoints>100</ExtraCityHitPoints>
<Defense>600</Defense>
<CityWall>true</CityWall>

CASTLE and MUGHAL_FORT​

Code:
<AllowsRangeStrike>true</AllowsRangeStrike>
<Defense>700</Defense>
<ExtraCityHitPoints>25</ExtraCityHitPoints>

ARSENAL​

Code:
<AllowsRangeStrike>true</AllowsRangeStrike>
<Defense>900</Defense>
<ExtraCityHitPoints>25</ExtraCityHitPoints>

MILITARY BASE​

Code:
<AllowsRangeStrike>true</AllowsRangeStrike>
<Defense>1200</Defense>
<ExtraCityHitPoints>25</ExtraCityHitPoints>

You can omit commands for "<AllowsRangeStrike>", "<Defense>", "<ExtraCityHitPoints>", and "<CityWall>" when not desired or needed for your mod.
 
These attributes determine how likely it is that the building will survive the city being captured by an enemy.

NeverCapture:

"<NeverCapture>" does what it sounds like. When set to "true" this building will never survive the city being captured. Walls, Castles, Arsenals, Military Bases, Monuments, Barracks, Armories, Military Academies, many unique buildings, and national wonders are all "NeverCapture" buildings.

ConquestProb:

"<ConquestProb>" sets a percentage likelihood that the building will survive the city being captured by an enemy. The higher the value set, the more likely the building will survive.

Setting "<ConquestProb>100</ConquestProb>" means the building will always survive the city being captured by an enemy. World Wonders should always have a 100% probability of surviving the city being captured by an enemy. This allows a player to "capture" a world wonder that was built by another player, and also allows the player to "rescue" a city from an enemy, and thereby regain control of a world wonder.

Setting "<ConquestProb>0</ConquestProb>" is essentially the same thing as setting "<NeverCapture>" to "true".

Choose between NeverCapture and ConquestProb:

You should choose between "<NeverCapture>" and "<ConquestProb>" for your building, and should not include both.

Note to self: MUGHAL_FORT has no designation for this one way or another.

NEVER CAPTURE FORMAT

Here is the properly-formatted code to give a building the "NeverCapture" attribute. You will want to use this attribute with national wonders, and buildings such as walls. It is probably also not a bad idea to make unique buildings un-capturable:

Code:
<NeverCapture>true</NeverCapture>

CONQUEST PROBABILITY FORMAT

Here is the properly-formatted code to give a building a "conquest probability" of 66% :

Code:
<ConquestProb>66</ConquestProb>

Here is the properly-formatted code to give a building a "conquest probability" of 100%. You will want to use this code for world wonders:

Code:
<ConquestProb>100</ConquestProb>

NOTE:

Nearly every mod I've seen so far has included a command for "<NeverCapture>" or "<ConquestProb>", and as a general rule you should do likewise, but it is not strictly required.

.....................................................................................................................................................................

EXECUTABLE CODE REVIEW​

To review the executable code that might be added to my building "definition" so far, if I choose to add two (2) MERCHANT specialist slots and one (1) GREAT MERCHANT spawn-point, and give my building a conquest probability of 66%, my code would look like this:

Spoiler :
Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			[COLOR="Red"][B]<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>[/B][/COLOR]

If I don't want my building to survive the city being captured, I replace "ConquestProb" with "NeverCapture":

Spoiler :
Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			[B][COLOR="Red"]<NeverCapture>true</NeverCapture>[/COLOR][/B]

If my building is a replacement for, say, city walls, I would also add-in the defensive building attributes. Here I have added the same commands as are used by the standard WALLS building. The difference is that in addition to acting as City Walls, my building would also include the specialist slots for MERCHANTS and the great person points toward generation of the next GREAT MERCHANT. I would change the "BuildingClass" to that for Walls, and I would also alter my "ArtDefineTag" to the designation for WALLS:

Spoiler :
Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			[B][COLOR="red"]<BuildingClass>BUILDINGCLASS_WALLS</BuildingClass>[/COLOR][/B]
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			[B][COLOR="red"]<ArtDefineTag>ART_DEF_BUILDING_WALLS</ArtDefineTag>[/COLOR][/B]
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<NeverCapture>true</NeverCapture>
			[B][COLOR="red"]<AllowsRangeStrike>true</AllowsRangeStrike>
			<Defense>500</Defense>
			<ExtraCityHitPoints>50</ExtraCityHitPoints>
			<CityWall>true</CityWall>[/COLOR][/B]

If I decide I'd rather not have my building be a replacement for city walls, but I did want it to add a small amount of defensive capability, I could restructure my code to add "25" extra city hit-points, but to include none of the other defensive-building attributes. I would go back to "NONE" as my "ArtDefineTag", and I would revert to a "ConquestProb" of 66%. I wouldn't HAVE TO revert to using "ConquestProb" instead of "NeverCapture", I just most likely would for personal-aesthetic-y reasons:

Spoiler :
Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			[B][COLOR="red"]<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>[/COLOR][/B]
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			[B][COLOR="red"]<ArtDefineTag>NONE</ArtDefineTag>[/COLOR][/B]
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			[B][COLOR="red"]<ConquestProb>66</ConquestProb>
			<ExtraCityHitPoints>25</ExtraCityHitPoints>[/COLOR][/B]
 
You can specify a tech that will later-on in the game add more yields to your building. A TECH that comes later in the game than the tech specified in the building's PrereqTech is usually specified. This specification is done by entering a technology name in the EnhancedYieldTech column.

Any yield enhancements specified in the table Building_TechEnhancedYieldChanges become effective after the TECH defined in EnhancedYieldTech is researched.

For purposes of directly attaching tourism to a building, this tech can be the same as that specified in the building's PrereqTech. If you omit the column EnhancedYieldTech the tourism effect will be an immediate and inherent preperty of the building, but this omission of EnhancedYieldTech will interfere with trying to add additional add-on yields in the table Building_TechEnhancedYieldChanges

Any ONE tech can be specified for EnhancedYieldTech. Two examples that appear under different buildings in the game are TECH_RADIO and TECH_FLIGHT.

TOURISM DIRECT ATTACHMENT TO BUILDINGS

TechEnhancedTourism states a "tourism" yield that is directly generated by the building. No great works need to be "pasted-into" great works slots in order for the tourism to kick in. The tourism effect starts after the TECH defined in EnhancedYieldTech is researched. The tech defined in EnhancedYieldTech can be the same as the one defined in the building's PrereqTech. Alternately, the EnhancedYieldTech can be omitted and the Tourism effect will be imediate upon completion of the building.

You can specify a TechEnhancedTourism value here in the basic building attributes and also state enhancements to other types of yields in the <Building_TechEnhancedYieldChanges> table that comes later. You should only create additional yield enhancements to the building under the <Building_TechEnhancedYieldChanges> table if the EnhancedYieldTech specfied is different than the building's PrereqTech.

.....................................................................................................................................................................


SOME FURTHER DISCUSSION ON <EnhancedYieldTech> AND <TechEnhancedTourism>


Probably the best way to demonstrate how the pair of commands can be used is to look at three buildings in the FIRAXIS-supplied XML that use the two commands.

THE MUGHAL FORT

The MUGHAL_FORT building uses <EnhancedYieldTech>TECH_FLIGHT</EnhancedYieldTech> combined with <TechEnhancedTourism>2</TechEnhancedTourism> to make the MUGHAL_FORT building start generating 2 Tourism per turn when the player discovers the FLIGHT tech. Since the MUGHAL_FORT is a unique building replacement for CASTLES, the building can be BUILT starting with TECH_CHIVALRY, but the tourism bump doesn't occur until later in the game.

Here are the three relevant lines of code as they appear in the MUGHAL_FORT <Buildings> XML:

Code:
[INDENT]<PrereqTech>TECH_CHIVALRY</PrereqTech>
<EnhancedYieldTech>TECH_FLIGHT</EnhancedYieldTech>
<TechEnhancedTourism>2</TechEnhancedTourism>[/INDENT]


THE PETRA WORLD WONDER

The PETRA world wonder is buildable when a player discovers TECH_CURRENCY. Later, on the discovery of TECH_ARCHAEOLOGY, the wonder adds +6 Culture. Prior to the discovery of TECH_ARCHAEOLOGY, the PETRA only generates +1 Culture. This is all done in the XML by adding <EnhancedYieldTech>TECH_ARCHAEOLOGY</EnhancedYieldTech> to the PETRA wonder under <Buildings> and later on in the XML adding-in the following:

Code:
<Building_TechEnhancedYieldChanges>
	<Row>
		<BuildingType>BUILDING_PETRA</BuildingType>
		<YieldType>YIELD_CULTURE</YieldType>
		<Yield>6</Yield>
	</Row>
</Building_TechEnhancedYieldChanges>


In the <Building_YieldChanges> table the PETRA world wonder adds-in the following:

Code:
<Building_YieldChanges>
	<Row>
		<BuildingType>BUILDING_PETRA</BuildingType>
		<YieldType>YIELD_CULTURE</YieldType>
		<Yield>1</Yield>
	</Row>
</Building_YieldChanges>



Note that the PETRA world wonder does NOT contain a statement for <TechEnhancedTourism> directly as a part of its <Buildings> definitions. The PETRA doesn't, therefore, start generating tourism when the player discovers the tech ARCHAEOLOGY. All the player gets is the Culture bump.

Here are the relevant lines of code as they appear in the PETRA "<Buildings>" table:

Code:
[INDENT]<PrereqTech>TECH_CURRENCY</PrereqTech>
<EnhancedYieldTech>TECH_ARCHAEOLOGY</EnhancedYieldTech>[/INDENT]


THE EIFFEL TOWER WORLD WONDER

The EIFFEL TOWER world wonder is buildable when a player discovers TECH_RADIO. In addition to everything else the Eiffel Tower does, it immediately begins to generate +12 tourism. This is done by adding both a <EnhancedYieldTech> and a <TechEnhancedTourism> statement directly to the Eiffel Tower's <Buildings> table. The <EnhancedYieldTech> is set to the same tech as the Eiffel Tower's <PrereqTech>, so there is no delay between building the Eiffel Tower and getting all its benefits, including the tourism bump.

Here are the three relevant lines of code as they appear in the EIFFEL_TOWER <Buildings> table:


Code:
[INDENT]<PrereqTech>TECH_RADIO</PrereqTech>
<EnhancedYieldTech>TECH_RADIO</EnhancedYieldTech>
<TechEnhancedTourism>12</TechEnhancedTourism>[/INDENT]
Firaxis could have done it this way, and the effects would have been identical:
Code:
[INDENT]<PrereqTech>TECH_RADIO</PrereqTech>
<TechEnhancedTourism>12</TechEnhancedTourism>[/INDENT]

NOTE:

You do not need a command for <EnhancedYieldTech> or <TechEnhancedTourism> if they do not apply to your MOD.


.....................................................................................................................................................................


EXECUTABLE CODE REVIEW​


ONLY TOURISM ADDED EXAMPLE

Spoiler :
I want to show a more practical example of how I can add tourism-yield directly to my example building. So, I have added commands to specify that "TECH_ARCHAEOLOGY" will enhance my building "yields". In this case, the only "yield" I want to enhance is "tourism", and I only want to add one (1) tourism to my building. The code would be:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			[B][COLOR="red"]<PrereqTech>TECH_POTTERY</PrereqTech>[/COLOR][/B]
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<ExtraCityHitPoints>25</ExtraCityHitPoints>
			[B][COLOR="Red"]<EnhancedYieldTech>TECH_ARCHAEOLOGY</EnhancedYieldTech>
			<TechEnhancedTourism>1</TechEnhancedTourism>[/COLOR][/B]
		</Row>
	</Buildings>
</GameData>

In this example I can start having cities build the building after the discovery of Pottery, and anything I specify under any follow-on building yield tables will kick-in as soon as the building is constructed in a city, EXCEPT the tourism yield. The tourism will only kick-in after the player discovers the Archaeology tech. If I wanted to make my building be a world wonder I would probably have it give more than one (1) tourism. But since I've been structuring this building example as a "regular" building, adding much more than the one (1) tourism point to the building would most likely break game balance.



NO TOURISM ADDED EXAMPLE

Spoiler :
If I don't want my building to add tourism, but I do want to have additional yields kick-in after the discovery of archaeology, I would eliminate the "TechEnhancedTourism" command, as shown below:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			[B][COLOR="red"]<PrereqTech>TECH_POTTERY</PrereqTech>[/COLOR][/B]
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<ExtraCityHitPoints>25</ExtraCityHitPoints>
			[B][COLOR="red"]<EnhancedYieldTech>TECH_ARCHAEOLOGY</EnhancedYieldTech>[/COLOR][/B]
		</Row>
	</Buildings>
</GameData>


And then in the "Building_TechEnhancedYieldChanges" table I would have to tell the XML what "enhanced yields" apply to my building after the discovery of Archaeology. If I wanted that "yield" to be one (1) gold, I would add code as follows:

Code:
<Building_TechEnhancedYieldChanges>
	<Row>
		<BuildingType>BUILDING_EXAMPLE</BuildingType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Building_TechEnhancedYieldChanges>

Since my original gold maintenance per turn is one (1) gold per turn, my building would become maintenance-cost-free after the discovery of Archaeology.

Note that in this example as shown in the "<Buildings>" table there a few more commands than are shown that are necessary to a properly-structured building, but I haven't shown them because they haven't been discussed as yet.


EXAMPLE SHOWING BOTH THE TOURISM AND THE GOLD "KICK-IN" AFTER ARCHAEOLOGY

Spoiler :
Here's what the code would look like without any intermediary comments in-between the two tables if I want BOTH the tourism and the gold effect:


Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			[B][COLOR="red"]<PrereqTech>TECH_POTTERY</PrereqTech>[/COLOR][/B]
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<ExtraCityHitPoints>25</ExtraCityHitPoints>
			[B][COLOR="red"]<EnhancedYieldTech>TECH_ARCHAEOLOGY</EnhancedYieldTech>
			<TechEnhancedTourism>1</TechEnhancedTourism>[/COLOR][/B]
		</Row>
	</Buildings>

	[B][COLOR="red"]<Building_TechEnhancedYieldChanges>
		<Row>
			<BuildingType>BUILDING_EXAMPLE</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_TechEnhancedYieldChanges>[/COLOR][/B]
</GameData>
 
"GLOBAL" AND "LOCAL" COMMANDS​


Many of the commands that follow from this point onwards can have a Global effect. If there is a Global command for something, there is generally also what is best thought of as a "local" command that does the same sort of thing. I will discuss each set of "Global/Local" commands in turn as you read through the remainder of this document, but for now I only want to discuss the difference between a "Global" command and a "local" command.

GLOBAL EFFECTS

Commands that start with the word "Global" are Global Effects Commands. This does NOT mean that the effect kicks in for every city of every civilization everywhere on the map. It means the effect kicks in for every city built by THE ONE AND ONLY PLAYER that builds the building. It is not too far wrong to think of Global effects as being WORLD WONDER effects as opposed to regular BUILDING effects.

You CAN attach Global effects to regular buildings, but as a general rule game-play is more balanced when these effects are restricted to World Wonders or National Wonders.

All of the following are GLOBAL effects commands:

GlobalPlotCultureCostModifier
GlobalPlotBuyCostModifier
GlobalCultureRateModifier
GlobalGreatPeopleRateModifier
GlobalSpaceProductionModifier
GlobalExperience (this command does not appear to have ANY effect)
GlobalPopulationChange
GlobalDefenseMod
GlobalEspionageModifier
HappinessPerCity
GreatGeneralRateModifier
CityConnectionTradeRouteModifier​

  • "HappinessPerCity" is shown as a "Global" effect in my list since it effects every city, and is in that sense not "local" to where the building was built.

  • "GreatGeneralRateModifier" is shown as a "Global" effect in my list since it effects great general appearance througout the empire, and is in that sense not "local" to where the building was built.

  • "CityConnectionTradeRouteModifier" is global because it adjusts the gold yield of road-connection routes from cities to the capital by a percentage for every city in the empire that is "connected" to the capital. Sea connections that connect via harbors, and then via roads to the capital are also affected.

LOCAL EFFECTS

Local effects only kick in for the city where a building is built. Other cities of the same empire that have not built the building do not get the benefits. If a command doesn't start with the word "Global", it is usually a local effect.

All of the following are LOCAL effects commands:

PlotCultureCostModifier
PlotBuyCostModifier
CultureRateModifier
GreatPeopleRateModifier
SpaceProductionModifier
Experience (this command does not appear to have ANY effect)
EspionageModifier​
 
There are two sets of map tile-acquisition-cost modifiers. One is a Global set, and one is a "local" set of modifiers. These commands adjust the cost in gold or culture of acquiring tiles for your city by a PERCENTAGE change.

GlobalPlotCultureCostModifier adjusts the cost of acquiring new tiles with CULTURE by whatever PERCENTAGE is stated. Affects EVERY city in the empire. You will generally want to make tile-acquisition cheaper, so you will want to put in a NEGATIVE whole number.

PlotCultureCostModifier adjusts the cost of acquiring new tiles with CULTURE by whatever PERCENTAGE is stated. Affects only the city where the building is built. You will generally want to make tile-acquisition cheaper, so you will want to put in a NEGATIVE whole number.

GlobalPlotBuyCostModifier adjusts the cost of acquiring new tiles with GOLD by whatever PERCENTAGE is stated. Affects EVERY city in the empire. You will generally want to make tile-acquisition cheaper, so you will want to put in a NEGATIVE whole number.

PlotBuyCostModifier adjusts the cost of acquiring new tiles with GOLD by whatever PERCENTAGE is stated. Affects only the city where the building is built. You will generally want to make tile-acquisition cheaper, so you will want to put in a NEGATIVE whole number.

Some Examples:

This is what the ANGOR WAT world wonder uses to REDUCE tile-acquisition costs by 25% everywhere in the empire. Shown EXACTLY as it appears in the Firaxis-supplied XML:

Code:
<GlobalPlotCultureCostModifier>-25</GlobalPlotCultureCostModifier>
<GlobalPlotBuyCostModifier>-25</GlobalPlotBuyCostModifier>

This is what the Russian KREPOST building uses to REDUCE tile-acquisition costs by 25% in the city that built a KREPOST. Shown EXACTLY as it appears in the Firaxis-supplied XML:

Code:
<PlotCultureCostModifier>-25</PlotCultureCostModifier>
<PlotBuyCostModifier>-25</PlotBuyCostModifier>

Here are all four commands presented together, properly-formatted for each command to reduce tile-acquisition costs in culture or gold by 25 %

Code:
<GlobalPlotCultureCostModifier>-25</GlobalPlotCultureCostModifier>
<GlobalPlotBuyCostModifier>-25</GlobalPlotBuyCostModifier>
<PlotCultureCostModifier>-25</PlotCultureCostModifier>
<PlotBuyCostModifier>-25</PlotBuyCostModifier>

You can omit commands for "<GlobalPlotCultureCostModifier>", "<GlobalPlotBuyCostModifier>", "<PlotCultureCostModifier>", and "<PlotBuyCostModifier>".
 
NOTE: choose one of the three methods discussed here for the "HurryCostModifier" of your building.

NOTE: "HurryCostModifier" of your building is different than and separate from the special ability of the BIG BEN world wonder.

METHOD 1: MODIFY WITH A POSITIVE NUMBER (or "0")
Positive numbers INCREASE the cost of buying the building with gold. "50" as shown below would make the gold cost 50 % higher than the game would otherwise calculate is needed to buy the building. Bear in mind that it is nearly impossible to "pre-figure" what the end result gold cost of your building will be because there are several modifiers that are taken into account by the game to determine the actual cost in terms of gold for purchasing a building. Values of "0", "10", "15", "25", and "40" are common through the buildings XML for "HurryCostModifier". You can put anything you want so long as it is a positive whole number, or "0".​
METHOD 2: DISABLE HURRYING WITH GOLD
Setting "HurryCostModifier" to "-1" disables buying the building with gold. This is how world and national wonders force you to "build" the building instead of "buying" it. The building can still be "Hurried" by a Great Engineer, you just can't do it with GOLD. Regular buildings can also use this designation, and the effect will be the same as for national and world wonders in that the player will be forced to build rather than buy.​
METHOD 3: MODIFY WITH A NEGATIVE NUMBER
So long as you state a negative number that is not "-1", this decreases by the stated percentage the cost of purchasing the building with gold. Other than the need to be careful to avoid "-1", the effect is the same as for positive values for "HurryCostModifier" except that you will be decreasing the gold cost of the building.​
PROPER CODE FORMATS
Properly-formatted command to disable hurrying the building with gold:
Code:
<HurryCostModifier>-1</HurryCostModifier>
Properly-formatted command to adjust the hurrying cost upward by "50" percent:
Code:
<HurryCostModifier>50</HurryCostModifier>
Properly-formatted command to adjust the hurrying cost downward by "25" percent:
Code:
<HurryCostModifier>-25</HurryCostModifier>
OMITTING A HURRY COST MODIFIER
When you omit the "<HurryCostModifier>" command, it is the same as stating "<HurryCostModifier>0</HurryCostModifier>".​
 
Terrain requirements allow you to specify what terrain the CITY must be built ON or NEAR TO in order for that city to build your building. The FIRAXIS-supplied XML uses this set of attributes to keep Lighthouses, for example, from being built inland. Terrain attributes are used to ensure that only cities located next to rivers can build certain buildings, such as Watermills and Hydro Plants. There are nine (9) commands available in the "<Building>" table that all fit within this description of "Terrain Requirements".

You can entirely omit any or all of the terrain requirment commands.

SET TO "TRUE" TERRAIN ATTRIBUTES

The following seven (7) attributes all work in the same way, and follow the same code format:

Water 1 city must be built NEXT TO a COAST tile or LAKE tile
River city must be built NEXT TO a RIVER
FreshWater city must be built next to a RIVER or adjacent to a LAKE or OASIS tile
Mountain city must be built NEXT TO a MOUNTAIN tile
NearbyMountainRequired city must be built WITHIN 2 TILES OF a MOUNTAIN tile
Hill city must be built ON a HILL tile
Flat city MUST NOT be built ON a HILL tile
1see also the additional <MinAreaSize> that must be specified​

The code format these seven attributes follow is:

Code:
<Water>true</Water>

To change from a "Water" requirement to a "River" requirement you would simply replace the word "Water" with the word "River" in both places.

SPECIFY THE TERRAIN-TYPE TERRAIN ATTRIBUTES

The following two (2) attributes work in a manner similar to each other, but different from the previous seven. The code format for these two commands is:

Code:
<NearbyTerrainRequired>TERRAIN_GRASS</NearbyTerrainRequired>

and​

Code:
<ProhibitedCityTerrain>TERRAIN_GRASS</ProhibitedCityTerrain>


<NearbyTerrainRequired> means that the CITY must be built ON or NEXT TO the terrain-type specified.
<ProhibitedCityTerrain> means that the CITY must NOT be built ON the terrain-type specified.

Any of the following terrain specifications would work with these two commands:

TERRAIN_GRASS grasslands tiles, whether flatlands, hills, or mountains
TERRAIN_PLAINS plains tiles, whether flatlands, hills, or mountains
TERRAIN_DESERT desert tiles, whether flatlands, hills, or mountains
TERRAIN_TUNDRA tundra tiles, whether flatlands, hills, or mountains
TERRAIN_SNOW snowy waste tiles, whether flatlands, hills, or mountains

Attempts to use the <NearbyTerrainRequired> command with TERRAIN_HILL do not work. The game does not implement such commands. Buildings that have TERRAIN_HILL specified for nearby terrain never become buildable, regardless of the terrain in which a city has been placed. Nor will the game properly recognize a terrain restriction with <ProhibitedCityTerrain> and TERRAIN_HILL. Similarly, attempts to use TERRAIN_MOUNTAIN for <NearbyTerrainRequired> or <ProhibitedCityTerrain> simply do not work.

FEATURES like Flood Plains, Forest, Jungle or Oasis DO NOT APPLY to these two terrain attributes because they aren't "terrain types" as defined in the "CIV5Terrains.XML" file.

"TERRAIN_COAST" and "TERRAIN_OCEAN" do not really apply either, since the <Water> attribute is intended to take care of that specification in place of <NearbyTerrainRequired> and because cities cannot be built on COAST or OCEAN tiles the <ProhibitedCityTerrain> wouldn't seem to accomplish anything with TERRAIN_COAST or TERRAIN_OCEAN.


ATTRIBUTE STACKING

You can "stack" these attributes to make your building require a more selective set of terrain criteria. You would generally try to reserve these stacked terrain requirements to World Wonders, as adding multiple terrain requirements to a "regular" building would tend to make such a building trend toward being an exercise in pointlessness. After all, no matter how awesome and cool you make your building, if no one can ever build it, it's really not very awesome and cool after all is said and done.

If you want to make a building require that a city be not only on a coastline, but also adjacent to a river, you could do the following as part of your building's XML:

Code:
<Water>true</Water>
<River>true</River>

If you wanted to require that your building is built only in a city that is on the coast, adjacent to a river, and is within two tiles of a mountain, you could do the following as part of your building's XML:

Code:
<Water>true</Water>
<River>true</River>
<NearbyMountainRequired>true</NearbyMountainRequired>

If you wanted to require that your building can only be built in a city that is on or next to a desert tile, and that there is a river adjacent to the city, you could do the following as part of your building's XML:

Code:
<River>true</River>
<NearbyTerrainRequired>TERRAIN_DESERT</NearbyTerrainRequired>

If you wanted to require that your building can only be built in a city that is NOT located ON a desert tile, but is next to a mountain, you could do the following as part of your building's XML:

Code:
<Mountain>true</Mountain>
<ProhibitedCityTerrain>TERRAIN_DESERT</ProhibitedCityTerrain>

As a general rule for stacking these terrain requirements, keep in mind how likely such a terrain combination is going to be on the game's main map, and therefore how likely it is any player will ever be able to build the building.

PROPERLY-FORMATTED LIST OF ALL TERRAIN REQUIREMENT SETTINGS


Shown in the Spoiler:


Spoiler :
Trues:
<Water>true</Water>
<River>true</River>
<FreshWater>true</FreshWater>
<Mountain>true</Mountain>
<NearbyMountainRequired>true</NearbyMountainRequired>
<Hill>true</Hill>
<Flat>true</Flat>

Nearby's:

<NearbyTerrainRequired>TERRAIN_GRASS</NearbyTerrainRequired>
<NearbyTerrainRequired>TERRAIN_PLAINS</NearbyTerrainRequired>
<NearbyTerrainRequired>TERRAIN_DESERT</NearbyTerrainRequired>
<NearbyTerrainRequired>TERRAIN_TUNDRA</NearbyTerrainRequired>
<NearbyTerrainRequired>TERRAIN_SNOW</NearbyTerrainRequired>

Prohibited's:

<ProhibitedCityTerrain>TERRAIN_GRASS</ProhibitedCityTerrain>
<ProhibitedCityTerrain>TERRAIN_PLAINS</ProhibitedCityTerrain>
<ProhibitedCityTerrain>TERRAIN_DESERT</ProhibitedCityTerrain>
<ProhibitedCityTerrain>TERRAIN_TUNDRA</ProhibitedCityTerrain>
<ProhibitedCityTerrain>TERRAIN_SNOW</ProhibitedCityTerrain>​


NOTE:

When you do not want any terrain requirement for your building, you simply omit the commands for city-placement terrain limitations.


EXECUTABLE CODE REVIEW​


Spoiler :
I have deleted some of the attribute entries that were shown earlier simply to keep these code examples from becoming too difficult to read. I dropped anything I had shown earlier that was below the "ConquestProb" line. None of the code-lines I dropped are required for the game to "accept" a building definition under the "<Buildings>" table.

For the continuation of these code reviews, I have chosen a "HurryCostModifier" of "25", and I have added the ability to the building of lowering plot gold-purchase costs by 10%.

Note that I have also added a properly-formatted comment that says "NEW STUFF" to make it a little easier for you to find what is new. My comment does not have to be in ALL CAPS, I just did it that way to make it stand out a little better. I will be including this comment line in all following "CODE REVIEWS", and the comment will always appear directly above whatever new lines of XML have been added.


Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			[B][COLOR="Red"]<!-- NEW STUFF -->
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>[/COLOR][/B]


If I wish to add to this, and require that my building is only available in cities that are built on flatlands (no hills allowed), I would change my code to:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>
			[B][COLOR="red"]<Flat>true</Flat>[/COLOR][/B]

If I wished to restrict where my building can be built even further, I could add a requirement that it be built on or next to grasslands, as so:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>
			[B][COLOR="red"]<Flat>true</Flat>
			<NearbyTerrainRequired>TERRAIN_GRASS</NearbyTerrainRequired>[/COLOR][/B]

BOTH terrain requirements would affect my building, and only cities that were built on flat terrain that is also a grassland tile, or cities that are built on flat tiles that are NEXT TO a grasslands tile would be able to construct my building.

I won't be including the terrain restrictions shown here in future "CODE REVIEWS" in order to keep the amount of stuff you have to read through to a minimum.
 
You can completely omit any or all of the commands discussed in this section.

I will only discuss the commands that directly relate to <Buildings> XML in relation to the new trade-route system. The simplest method I can think of to do this is to first discuss the XML commands that have been added to various buildings in the FIRAXIS-supplied XML files.

For the purposes of this discussion the words or phrases like "owner", "owned", or "foriegn-owned" refer to the CIV that built the Caravan or Cargo-Ship unit.

Any or all of the Caravan and Cargo-Ship Trade Route Commands can be omitted.

CIVILOPEDIA ERRATA NOTES:

  1. There appears to me to be an error in the Civilopedia entry for the Harbor building, which I will note in detail below. I believe it may have been fixed by the Fall 2013 Update Patch, but I haven't remembered to take the time to check.
  2. The XML does not include a building called anything like BUILDING_EAST_INDIA_COMPANY. Instead, the in-game name of the building was changed from "National Treasury" to "East India Company". The FIRAXIS-supplied XML code all still refers to BUILDING_NATIONAL_TREASURY

XML CONFUSIONS:

I have placed the following in a spoiler because a read-through makes me now realize it may all have been fixed in the Fall 2013 Update Patch.

Spoiler :
To me, "TradeRouteRecipientBonus" and "TradeRouteTargetBonus" would seem to refer to the same thing. I spent a fair amount of time comparing civilopedia entries for what a building is said to do to what is actually in the XML when I prepared this section of this guide. Now that I've discovered this possible berf in the civilopedia vis-a-vis the code, I'll be paying much closer attention my trade routes with foriegn cities to see what is correct and what is not. This is an obvious area where this guide may need to be updated. All we can do at this point is trust FIRAXIS that the code-commands do what is stated.


BAZAARS and MARKETS

Bazaars and Markets now boost the gold that a city generates when a foriegn-owned trade-route is connected to a city containing either the Market building or the Bazaar building. The owner of the trade route recieves +1 GOLD more than they would otherwise get, and the city that contains the Bazaar or Market building generates +2 GOLD more than it normally would get. The way this is done in the <Buildings> table is by inclusion of the following two lines of code:

Code:
<TradeRouteRecipientBonus>2</TradeRouteRecipientBonus>
<TradeRouteTargetBonus>1</TradeRouteTargetBonus>

EAST INDIA COMPANY


The East India Company national wonder has taken the place of the old National Treasury national wonder and now boosts the gold that a city containing the East India Company generates when a foriegn-owned trade-route is connected to the city. The owner of the trade route recieves +2 GOLD more than they would otherwise get, and the city that contains the East India Company generates +4 GOLD more than it normally would get. The way this is done in the <Buildings> table is by inclusion of the following two lines of code:

Code:
<TradeRouteRecipientBonus>4</TradeRouteRecipientBonus>
<TradeRouteTargetBonus>2</TradeRouteTargetBonus>

CARAVANSARY

The Caravansary building extends the range of land trade routes originating in the city that built a caravansary by 50% and adds +2 GOLD to every land trade route originating in the city that built the caravansary that connects to a city in a Foriegn Civilization . The way this is done in the <Buildings> table is by inclusion of the following two lines of code:

Code:
<TradeRouteLandDistanceModifier>50</TradeRouteLandDistanceModifier>
<TradeRouteLandGoldBonus>200</TradeRouteLandGoldBonus>

"50" in "TradeRouteLandDistanceModifier" translates to 50% greater range.
"200" in "TradeRouteLandGoldBonus" translates to 2 GOLD.

HARBORS

The Civilopedia entry for the Harbor building states that a Harbor extends the range of sea trade routes originating in the city that built a harbor by 50% and adds +2 GOLD to every trade route originating in the city that built the harbor THAT CONNECTS TO A CITY IN A FORIEGN CIVILIZATION. The way this is done in the <Buildings> table is by inclusion of the following two lines of code:

Code:
<TradeRouteSeaDistanceModifier>50</TradeRouteSeaDistanceModifier>
<TradeRouteSeaGoldBonus>100</TradeRouteSeaGoldBonus>

following is in a spoiler until I can check whether it was fixed in the Fall 2013 Update Patch

Spoiler :
I believe there may be an error in the Civilopedia relating to Harbors, and that the gold bonus may only be +1 GOLD instead of the +2 GOLD that is stated.

"50" in "TradeRouteSeaDistanceModifier" translates to 50% greater range.
"100" in "TradeRouteSeaGoldBonus" would seem to translate to 1 GOLD and not 2.


The Harbor building also contains the XML code:

Code:
<AllowsWaterRoutes>true</AllowsWaterRoutes>

This has nothing at all to do with cargo-ship trade routes, but is the carry-over from the previous expansions of the game that allow Harbors to act as a "connection" to the capital.

COLOSSUS

The Colossus world wonder adds +1 trade routes to the empire and boosts the gold that a city generates when a foriegn-owned trade-route is connected to the city containing the Colossus. The owner of the trade route recieves +1 GOLD more than they would otherwise get, and the CITY that contains the Colossus generates +2 GOLD more than it normally would get. The way this is done in the <Buildings> table is by inclusion of the following lines of code:

Code:
<TradeRouteRecipientBonus>2</TradeRouteRecipientBonus>
<TradeRouteTargetBonus>1</TradeRouteTargetBonus>
<NumTradeRouteBonus>1</NumTradeRouteBonus>

"<NumTradeRouteBonus>1</NumTradeRouteBonus>" adds the extra trade route.

PETRA

The Petra world wonder adds +1 trade routes but does not contain any gold boosts for the city owner or for a trade-route owner when a foriegn-originating trade-route connects to the city. Nor does any gold boost apply to a trade route that originates in the city that built the PETRA world wonder. The PETRA world wonder does give a free caravan unit to the builder of the wonder, but the XML code for that is handled later on under the <Building_FreeUnits> table. The code that appears in the Petra world wonder <Buildings> table relating to trade routes is simply the inclusion of the following line of code:

Code:
<NumTradeRouteBonus>1</NumTradeRouteBonus>

Just like with the Colossus, "<NumTradeRouteBonus>1</NumTradeRouteBonus>" adds the extra trade route.


WORKSHOPS and GRANARIES

Workshops allow internal trade-routes to "transfer" Production between one city and another. The XML code that allows this is:

Code:
<AllowsProductionTradeRoutes>true</AllowsProductionTradeRoutes>

Granaries allow internal trade-routes to "transfer" Food between one city and another. The XML code that allows this is:

Code:
<AllowsFoodTradeRoutes>true</AllowsFoodTradeRoutes>


Actually, neither Production or Food is ever deducted from the originating city. So the trade route just magically deposits mysteriously-generated production and food in the target city of the trade route.

PROPERLY-FORMATTED TRADE-ROUTE COMMANDS

Internal trade route enablers:

Code:
<AllowsProductionTradeRoutes>true</AllowsProductionTradeRoutes>
<AllowsFoodTradeRoutes>true</AllowsFoodTradeRoutes>

Trade-route distance modifiers. Affects both INTERNAL and EXTERNAL trade-route:

Code:
<TradeRouteLandDistanceModifier>50</TradeRouteLandDistanceModifier>
<TradeRouteSeaDistanceModifier>50</TradeRouteSeaDistanceModifier>

City owner gets a +2 gold bonus when a foriegn-origin trade-route connects to the city the building is in:

Code:
<TradeRouteRecipientBonus>2</TradeRouteRecipientBonus>
Caravan or cargo-ship owner gets a +1 gold bonus when their foriegn-origin trade-route connects to the city the building is in:

Code:
<TradeRouteTargetBonus>1</TradeRouteTargetBonus>

The building adds +2 gold to any foriegn-destination LAND trade route ORIGINATING from the city where the building is built:

Code:
<TradeRouteLandGoldBonus>200</TradeRouteLandGoldBonus>

The building adds +1 gold to any foriegn-destination SEA trade route ORIGINATING from the city where the building is built:

Code:
<TradeRouteSeaGoldBonus>100</TradeRouteSeaGoldBonus>

Number of trade-routes increaser. As shown would add +1 trade routes to the empire where the building is built:

Code:
<NumTradeRouteBonus>1</NumTradeRouteBonus>


THESE COMMANDS AFFECT TRADE ROUTES STARTING IN THE CITY WHERE A WONDER OR BUILDING IS CONSTRUCTED

Code:
<TradeRouteSeaGoldBonus>100</TradeRouteSeaGoldBonus>
<TradeRouteLandGoldBonus>200</TradeRouteLandGoldBonus>
<TradeRouteLandDistanceModifier>50</TradeRouteLandDistanceModifier>
<TradeRouteSeaDistanceModifier>50</TradeRouteSeaDistanceModifier>
<AllowsProductionTradeRoutes>true</AllowsProductionTradeRoutes>
<AllowsFoodTradeRoutes>true</AllowsFoodTradeRoutes>
<AllowsWaterRoutes>true</AllowsWaterRoutes>

THESE COMMANDS AFFECT TRADE ROUTES STARTING IN ANOTHER CIV AND TERMINATING IN THE CITY WHERE A WONDER OR BUILDING IS CONSTRUCTED

Code:
<TradeRouteTargetBonus>1</TradeRouteTargetBonus>
<TradeRouteRecipientBonus>2</TradeRouteRecipientBonus>

.....................................................................................................................................................................

ROAD AND HARBOR CAPITAL-CONNECTION TRADE ROUTES​

HARBOR connection command used by the HARBOR to allow sea and coastal water city-connections to the capital:

Code:
<AllowsWaterRoutes>true</AllowsWaterRoutes>

CAPITAL-CONNECTED TRADE-ROUTE "VALUE" INCREASER used by the BUILDING_MACHU_PICHU to increase the value of city-connection trade routes to the capital. This has a global effect on all cities connected to the capital by road networks or by harbor-connection networks. The number stated is a percentage change, so "25" increases the gold generated by these connections empire-wide by 25 percent.

Following is the code EXACTLY as shown in the MACHU PICHU world wonder:

Code:
<CityConnectionTradeRouteModifier>25</CityConnectionTradeRouteModifier>

For the purposes of adding this command to new buildings, you should generally limit its use to world or national wonders.


NOTE:

In the Gods and Kings expansion, and in the "vanilla" version of the game, the command was:

Code:
<TradeRouteModifier>25</TradeRouteModifier>

You can omit <AllowsWaterRoutes> and <CityConnectionTradeRouteModifier> when they do not apply. If you include the command <AllowsWaterRoutes>true</AllowsWaterRoutes>, you should also force the building to be constructable only in coastal cities by including the <Water>true</Water> line.
 
MUTUALLY EXCLUSIVE GROUP

The <MutuallyExclusiveGroup>1</MutuallyExclusiveGroup> command is used by all buildings that fall into the "Power Plant" group of buildings. A city is only allowed to build one of the buildings from this group, hence they are "Mutually Exclusive".

You should only use this command when:

  1. you are adding a new type of power-plant building, in which case you will set "1" for "MutuallyExclusiveGroup",
  2. you are adding a series of buildings all of which will be mutually exclusive to each other. Just like the power plant buildings, once a city has built one of these buildings, it can never build another from within the group. In this case you should pick an exclusion group number that is never much likely to also be chosen by another contributor to the workshop. Something like "256".

Proper format for adding a new power-plant building:

Code:
<MutuallyExclusiveGroup>1</MutuallyExclusiveGroup>

Proper format for adding a new series of buildings, where "256" is assigned as the exclusive group number:

Code:
<MutuallyExclusiveGroup>256</MutuallyExclusiveGroup>

You can and generally should omit the command for <MutuallyExclusiveGroup>.

.....................................................................................................................................................................


TOURISM MODIFIERS


The two tourism modifiers effect the tourism generated in the city where the building is built. They are, therefore, local effects. These modifiers are used by the National Visitor Center national wonder.

<LandmarksTourismPercent> modifies tourism by "collecting" all of the culture produced from World Wonders, plus all the culture from Landmarks (the ones that can be built on the main map by archaeologists), from culture-producing improvements like Moai Statues and Chateaus, and all the culture from any Natural Wonders being worked by the city, multiplying that total culture number by the percentage stated for <LandmarksTourismPercent> and adding the result to the city tourism amount.

<LandmarksTourismPercent>100</LandmarksTourismPercent> which is the command as used by the National Visitor Center, directly transforms 100% of that calculated culture into tourism for the city.

<GreatWorksTourismModifier> adjusts the tourism generated by any great works present in the city by the percentage amount entered.
So, <GreatWorksTourismModifier>100</GreatWorksTourismModifier> increases the tourism from great works in the same city by 100%. Generally you will want to enter values for this modifier that seem fairly large, such as "50", "100", or "200", because the amoount of tourism being generated in an individual city from great works is usually a total number such as "2", or "4". Adjusting such a small total number of tourism by 10% wouldn't have much affect.

Properly-formatted code for these commands to both "increase" tourism by 100%:

Code:
<LandmarksTourismPercent>100</LandmarksTourismPercent>
<GreatWorksTourismModifier>100</GreatWorksTourismModifier>

You can omit the commands for <LandmarksTourismPercent> and <GreatWorksTourismModifier> when they do not apply to your building.

.....................................................................................................................................................................


GREAT WORK SLOTS and GREAT WORKS COUNT

<GreatWorkSlotType> defines the TYPE of great work slot that is added to a building. Since there isn't room to display more regular buildings or National Wonders that contain great work slots in the Culture Overview display, inclusion of great work slots should be limited to World Wonders. World Wonder great work slots are displayed in the Culture Overview directly below the city name where the World Wonder was built, so there is no downside to getting the great works slots to display properly. Adding Great Works slots to National Wonders will not work properly because while the National Wonder will show the great works slots in the city view, they will not be added properly to the Culture Overview panel.

You can only specify one of the three types of great works for your wonder.

<GreatWorkCount> defines how many great work slots of the chosen type are to be included in the wonder. The maximum number of great works slots that appears for a single World Wonder in the FIRAXIS-supplied game XML is four (4), so you should probably not try to include any more great works than that in your building.

Pick only one of the following three great works types:

GREAT_WORK_SLOT_ART_ARTIFACT (works of art or artifacts)
GREAT_WORK_SLOT_MUSIC (works of music)
GREAT_WORK_SLOT_LITERATURE (works of writing)


GreatWorkCount
Designate how many great works fit into the wonder:
A "GreatWorkCount" command is always paired with a GreatWorkSlotType command. You cannot have the one without the other.

PROPER CODE FORMATS

Properly-formatted commands to add 1 great work of MUSIC slot to your wonder:

Code:
<GreatWorkSlotType>GREAT_WORK_SLOT_MUSIC</GreatWorkSlotType>
<GreatWorkCount>1</GreatWorkCount>

Properly-formatted commands to add 2 great works of MUSIC slots to your wonder:

Code:
<GreatWorkSlotType>GREAT_WORK_SLOT_MUSIC</GreatWorkSlotType>
<GreatWorkCount>2</GreatWorkCount>

Properly-formatted commands to add 1 great works of WRITING slots to your wonder:

Code:
<GreatWorkSlotType>GREAT_WORK_SLOT_LITERATURE</GreatWorkSlotType>
<GreatWorkCount>1</GreatWorkCount>

Properly-formatted commands to add 1 slot for a great work of ART or an ARTIFACT to your wonder:

Code:
<GreatWorkSlotType>GREAT_WORK_SLOT_ART_ARTIFACT</GreatWorkSlotType>
<GreatWorkCount>1</GreatWorkCount>

NOTE:

A World Wonder should NOT include BOTH Great-Works slots AND Citizen-Specialist slots within the same Wonder.

NOTE:

the <GreatWorkSlotType> and <GreatWorkCount> commands can be omitted.


.....................................................................................................................................................................

EXECUTABLE CODE REVIEW​


Spoiler :
If I wanted my building to allow internal land PRODUCTION trade-routes originating from the city, and if I wanted my building to increase the value empire-wide of capital-connection trade-routes by 10%, I would change my buildings table code to be:


Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>
			[B][COLOR="Red"]<!-- NEW STUFF -->
			<AllowsProductionTradeRoutes>true</AllowsProductionTradeRoutes>
			<CityConnectionTradeRouteModifier>10</CityConnectionTradeRouteModifier>[/COLOR][/B]

The "CityConnectionTradeRouteModifier" command is really only appropriate to world wonders, and since the example building as I have assembled the code so far looks more like a "regular" building, I don't think I'd keep the <CityConnectionTradeRouteModifier>. I might instead make my building allow the city to establish internal trade-routes for BOTH food and production points. To do so I would change my buildings table code to be:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>
			[B][COLOR="red"]<!-- NEW STUFF -->
			<AllowsProductionTradeRoutes>true</AllowsProductionTradeRoutes>
			<AllowsFoodTradeRoutes>true</AllowsFoodTradeRoutes>[/COLOR][/B]


If I decide at this point I want my building to also have one (1) great work of writing slot, I would alter my buildings table code to be:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>
			[B][COLOR="red"]<!-- NEW STUFF -->
			<AllowsProductionTradeRoutes>true</AllowsProductionTradeRoutes>
			<AllowsFoodTradeRoutes>true</AllowsFoodTradeRoutes>
			<GreatWorkSlotType>GREAT_WORK_SLOT_LITERATURE</GreatWorkSlotType>
			<GreatWorkCount>1</GreatWorkCount>[/COLOR][/B]

If I decide at this point I want my building to also collect all the "Landmark" culture produced around the city, and add 10% of that to my city as tourism, I would alter my buildings table code to be:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>
			[B][COLOR="red"]<!-- NEW STUFF -->
			<AllowsProductionTradeRoutes>true</AllowsProductionTradeRoutes>
			<AllowsFoodTradeRoutes>true</AllowsFoodTradeRoutes>
			<GreatWorkSlotType>GREAT_WORK_SLOT_LITERATURE</GreatWorkSlotType>
			<GreatWorkCount>1</GreatWorkCount>
			<LandmarksTourismPercent>10</LandmarksTourismPercent>[/COLOR][/B]

I won't be including any of the entries for Internal Trade Routes, Great Works slots, or the Landmark Tourism shown here in future "CODE REVIEWS" in order to keep the amount of stuff you have to read through to a minimum.
 
I haven't played around much with these commands, so bear in mind that my understanding of how some of them function might not be quite correct or complete.

Espionage Attributes and functions:​

AffectSpiesNow
Spy effects are immediate. The Great Firewall wonder uses this command. I think this tells the game that foriegn spying activity in the city is affected immediately.​

GlobalEspionageModifier
Adjusts the rate at which foriegn spies steal technology in all cities. The National Intelligence Agency and the Great Firewall wonders both use this command.​

EspionageModifier
Adjusts the rate at which foriegn spies steal technology only in the city where the building was built. Constabularies and Police Stations use this command. The Great Firewall also uses this command with a "-100" value to essentially eliminate spying in the city where it was built.​

SpyRankChange
As near as I can tell this command "promotes" by one level a free "ExtraSpy" given out by a building.​

InstantSpyRankChange
As near as I can tell this command grants +1 spy level to all existing spies of the empire that built the building.​

Espionage
Is used to tell the game that a building will have some kind of espionage effect. When espionage is disabled for a game, any building (including Wonders) with this attribute set to "true" will be deleted from the normal list of available buildings. Having this attribute set to "true" is not strictly required in order for any of the other espionage commands to be included in a building. The other espionage commands will still function. In games where espionage has been turned off via the "No Espionage" gameplay option, the other espionage commands will be ignored for a building that does NOT contain the "Espionage" command set to "true".​


note: it is quite possible I misunderstand "SpyRankChange" And "InstantSpyRankChange" or that I have reversed their effects.

CONSTABULARY and POLICE STATIONS

Constabularies and Police Stations both contain the following two espionage commands. The rest of the commands for the CONSTABULARY and POLICE STATION buildings are there, really, so these two commands can be included in a new "counter-espionage" building:

Code:
<EspionageModifier>-25</EspionageModifier>
<Espionage>true</Espionage>


GREAT FIREWALL

The Great Firewall world wonder contains the following espionage commands:

Code:
<Espionage>true</Espionage>
<EspionageModifier>-100</EspionageModifier>
<GlobalEspionageModifier>-25</GlobalEspionageModifier>
<AffectSpiesNow>true</AffectSpiesNow>

INTELLIGENCE AGENCY

The National Intelligence Agency national wonder contains the following espionage commands:

Code:
<GlobalEspionageModifier>-15</GlobalEspionageModifier>
<ExtraSpies>1</ExtraSpies>
<Espionage>true</Espionage>
<SpyRankChange>1</SpyRankChange>
<InstantSpyRankChange>1</InstantSpyRankChange>

EXTRA SPIES

A related attribute that is not strictly an "espionage attribute" in the sense that it has no direct effect on enemy spying is "ExtraSpies". The extra spy can be used to fight foriegn espionage, but the command to give the spy for free has no direct effect. A building can grant extra spies without having any other effects that are "espionagy". In order to have your building add an extra spy to the empire that builds the building, add the following line to your building:

Code:
<ExtraSpies>1</ExtraSpies>

Be careful how many spies you add. Remember there are a limited number of spy "names" for each CIV: I'm not sure what happens if a CIV has reached the end of that list and a building wants to add another spy to the empire.


PROPERLY-FORMATTED COMMANDS

Here are the espionage commands, properly-formatted, with two different examples of "EspionageModifier":

Code:
<Espionage>true</Espionage>
<EspionageModifier>-100</EspionageModifier>
<EspionageModifier>-25</EspionageModifier>
<GlobalEspionageModifier>-25</GlobalEspionageModifier>
<AffectSpiesNow>true</AffectSpiesNow>
<ExtraSpies>1</ExtraSpies>
<SpyRankChange>1</SpyRankChange>
<InstantSpyRankChange>1</InstantSpyRankChange>

Any or all of these commands can be omitted.
 
GREAT WALL WONDER ABILITY​

<BorderObstacle> is used in the Great Wall world wonder XML to add the wonder ability that slows invaders when they traverse a player's territory. Since the Great Wall effect expires with the discovery of Dynamite, code had to be added that allows XML to specify when a building becomes obsolete. The code <ObsoleteTech> accomplishes this expiration.

You should probably not attempt to use the <BorderObstacle> command since it is intrinsically tied-into the Great Wall's invader-slowing effect, but may also be tied-into the logic that tells the game when to start animating the great wall art within the game main map. I haven't tried using <BorderObstacle> with a new building to see if this is the case or not, but if you do add <BorderObstacle> to your new building, don't be suprised if the game starts trying to treat your new building (from the point of view of main-map animations) as if it were the Great Wall.

The Great Wall world wonder also uses ObsoleteTech to make the Border Obstacle effect expire when the player that built the Great Wall discovers the Dynamite technology. Here are the properly-formatted commands for BorderObstacle and ObsoleteTech, EXACTLY as they appear in the <Buildings> table, for the Great Wall world wonder:

Code:
<ObsoleteTech>TECH_DYNAMITE</ObsoleteTech>
<BorderObstacle>true</BorderObstacle>

<ObsoleteTech> and <BorderObstacle> can be omitted.


.....................................................................................................................................................................


OBSOLETE TECH​

<ObsoleteTech> is safe to use if you want to add a new world wonder (or a regular building) that expires at some point during the game. To do this, you would have to fill in the tech name of the technology you want to have expire your wonder. I wouldn't advise including <ObsoleteTech> with a regular building, such as a unique building that replaces barracks, even though it is possible, because this would make all the effects of your new barracks building expire when the player reached the technology you specified.

<ObsoleteTech> affects these commands (among others):

Spoiler :
The Following Under <Buildings>:

Code:
<BorderObstacle>
<TrainedFreePromotion>
<FreePromotion>
<FreeBuilding>
<CultureRateModifier>
<GlobalCultureRateModifier>
<CityConnectionTradeRouteModifier>
<UnhappinessModifier>
<BuildingProductionModifier>
<WonderProductionModifier>
<GreatPeopleRateModifier>
<GreatPersonExpendGold>

It Will Not Affect these commands under <Buildings> table:
(since they are treated by the game as an inherent part of the building's structure, as opposed to something the building does on a continuing basis)

Code:
<FreeBuildingThisCity>
<SpecialistCount>
<GreatWorkSlots>
<GreatWorksSlotsCounts> i need to check for typos on the command


I Believe it affects the following under <Buildings> but have never had a chance to verify:

Code:
<GoldenAgeModifier>
<GlobalGreatPeopleRateModifier>
<PolicyCostModifier>
<Defense>
<UnitUpgradeCostMod>

It Affects The Following Tables (among others):

Code:
<Building_GlobalYieldModifiers>
<Building_YieldModifiers>
<Building_YieldChangesPerPop>
<Building_TerrainYieldChanges>
<Building_DomainFreeExperiences>
<Building_HurryModifiers>
<Building_AreaYieldModifiers>

It Does Not Affect the Following Tables:

Code:
<Building_BuildingClassYieldChanges>
<Building_BuildingClassHappiness>
<Building_YieldChanges>

Not Sure Tables(But I Believe it Will)

Code:
<Building_ResourceYieldChanges>
<Building_SeaPlotYieldChanges>
<Building_UnitCombatProductionModifiers>
<Building_UnitCombatFreeExperiences>
<Building_SpecialistYieldChanges>

I never have tried to see how the game will react if a wonder that has great works and a theming bonus is made obsolete. The researching of the tech may or may not invalidate the theming bonus.

Any command that is "instantaneous" to the construction of the Wonder does not become obsolete since those types of commands only have an affect on game-play during the turn when the wonder is completed. By "instantaneous" commands I mean such things as Free Great People, Free Units, Gold, Free Policies, Free Techs.


Note on the Zulu Ikanda:

Spoiler :
It may seem like the new Zulu building the Ikanda would use <ObsoleteTech> to make it stop giving its special promotion when the Zulu player reaches gunpowder, but this is not how it is handled. The "PROMOTION_BUFFALO_HORNS" is limited to melee units, and is not available to gunpowder-and-better ground-pounder units. The IKANDA BUILDING grants the promotion "PROMOTION_BUFFALO_HORNS" to units built in the city, and the PROMOTION determines which kinds of units can actually accept the promotion. Gunpowder and later units can't use "PROMOTION_BUFFALO_HORNS", so the promotion is not added to them when they are built in a city with an IKANDA.


.....................................................................................................................................................................

PORCELAIN TOWER WONDER ABILITY​



The Porcelain Tower wonder ability increases the value of research agreements. When you build the Porcelain Tower, research agreements yield 50% more science. In terms of XML code this is done through the command "MedianTechPercentChange". The way this command works is that you input 1/2 of the total-percent-improvement in research-agreement-yields. The command for this function can be omitted.

If you want research agreements to yield 50% more science, the code should be:

Code:
<MedianTechPercentChange>25</MedianTechPercentChange>

If you want research agreements to give 25% more science, the code should be:

Code:
<MedianTechPercentChange>13</MedianTechPercentChange>

If you want research agreements to give 10% more science, the code should be:

Code:
<MedianTechPercentChange>5</MedianTechPercentChange>

Since you can only have whole numbers in "MedianTechPercentChange", you may have to round up or down depending on how much science yield you want to improve research agreements by. For example, since "12.5" is not allowed, you would have to decide whether to put "12" or "13" into "MedianTechPercentChange" when you really want to increase the value of research agreements by 25%.

My personal opinion on the mechanics of this ability: BRRRRRR......what a way to do that!

Here is the properly-formatted code used in the Porcelain Tower world wonder "<Buildings>" table:

Code:
<MedianTechPercentChange>25</MedianTechPercentChange>

Remember that the Porcelain Tower increases the science output of research agreements by 50%.

.....................................................................................................................................................................


FORBIDDEN PALACE WONDER ABILITY​


The Forbidden palace has two effects. It grants +2 delegates to the World Congress (League of Nations, United Nations, depending on how you like to think of it). It also reduces Unhappiness by "10" percent, but the effect does not carry into cities that have been conquered and are experiencing the "occupation unhappiness" effect.

You can add the "UnhappinessModifier" to any building, but unless your building is a world wonder, you should keep this to a low number. I will talk more about the "UnhappinessModifier" later, when I discuss Happiness and Unhappiness commands.

You should limit "ExtraLeagueVotes" to world wonders, otherwise game balance would be quickly overrun by players having more "extra" votes in the World Congress than are required to win the game, even before the diplomatic victory voting becomes available.

Here is the properly-formatted code used in the Forbidden Palace world wonder "<Buildings>" table:

Code:
<UnhappinessModifier>-10</UnhappinessModifier>
<ExtraLeagueVotes>2</ExtraLeagueVotes>


Either of these commands can be omitted.
 
FREE BUILDING THIS CITY​

FreeBuildingThisCity gives the building described only where the wonder was built. This is the XML code that is used by Hagia Sophia, Great Lighthouse, Great Wall, and Himeji Castle to grant free buildings of the appropriate type. As soon as the wonder is completed, the free building is added to the city's list of buildings. You MUST enter the building CLASS for the building. That way, if the free building is a Castle, the Mughal Fort would be properly inserted instead when the game sees that it is supposed to give a free Castle-Class building. This is the code the Great Lighthouse uses to give a free Lighthouse in the city:

Code:
<FreeBuildingThisCity>BUILDINGCLASS_LIGHTHOUSE</FreeBuildingThisCity>

<FreeBuildingThisCity> is not affected by the ObsoleteTech command.

................................................................................................................................................................................................

FREE BUILDING​


FreeBuilding gives the building described IN EVERY CITY. This is the XML code that is used by CN Tower to grant a free Broadcast Tower in every city. As soon as the wonder is completed, the free building is added to every city's list of buildings. You MUST enter the building CLASS for the building. That way, if the free building is a Barracks, the Krepost or Ikanda would be properly inserted instead when the game sees that it is supposed to give a free Barracks-Class building. This is the code the CN Tower uses to give out the free Broadcast Towers:

Code:
<FreeBuilding>BUILDINGCLASS_BROADCAST_TOWER</FreeBuilding>

Note:

FreeBuilding continues to give out the free building when new cities are added to the empire. If you built the CN Tower, and then later created a new city, or conquered another player's city, the Broadcast Tower will show up in the new or conquered city's buildings list.

PROPERLY-FORMATTED code for FreeBuilding and FreeBuildingThisCity:

Code:
<FreeBuildingThisCity>BUILDINGCLASS_LIGHTHOUSE</FreeBuildingThisCity>
<FreeBuilding>BUILDINGCLASS_BROADCAST_TOWER</FreeBuilding>


Affect of ObsoleteTech:

<FreeBuilding> is affected by the ObsoleteTech command. If you make your wonder become obsolete at some point in the game, any buildings that were provided for free in all cities will be "disappeared" from all those cities.

FreeBuilding and FreeBuildingThisCity can be omitted.
These abilities should be limited to National or World Wonders.

..................................................................................................................................................................................................


FREE PROMOTIONS​

Free promotions that are granted by buildings are normally selected from the list that FIRAXIS supplied in the game XML for unit promotions. But you can select a "new" promotion you intend to create as part of your mod. You just have to follow-thru and add XML under the appropriate "tables" to tell the game what your promotion does, which units can use it, etc. None of the "<Building_SomethingSomething>" tables that are part of the BUILDINGS XML-structure will work for creating a NEW PROMOTION, even though you might think so since the "building" is referencing a "promotion". It's just not the way the overall structure of the game XML works. All the "buildings" tables can do is reference a promotion name, and then only as part of the "free promotion" commands.

Any of the three promotion commands can be omitted.

TRAINED FREE PROMOTION

TrainedFreePromotion grants a free promotion to any unit BUILT or PURCHASED in the city where the BUILDING is located. You have to specify which promotion is to be granted to the units "trained" there. Only that promotion is given, and then only to those units which are supposed to have such a promotion available to them. A promotion that is not normally "choosable" as a unit gains experience can be specified, or a promotion that units can normally "choose" as they gain experience can be specified. TrainedFreePromotion statements used by buildings in the FIRAXIS-supplied XML files:

HEROIC EPIC

Code:
<TrainedFreePromotion>PROMOTION_MORALE</TrainedFreePromotion>

ALHAMBRA

Code:
<TrainedFreePromotion>PROMOTION_DRILL_1</TrainedFreePromotion>

IKANDA

Code:
<TrainedFreePromotion>PROMOTION_BUFFALO_HORNS</TrainedFreePromotion>

As a game-mechanics note, you should make your promotion choice based on the nature of the building you are creating. If the promotion you want to choose is only available to naval units, then your building should be one which can only be built on a coastline.

TrainedFreePromotion does not effect the XP's a unit would otherwise "appear" with, nor does it affect the "experience level" of the unit. The unit still appears as an "unpromoted" experience-level unit, and the number of XP's the unit normally would recieve from Barracks, Kreposts, Ikandas, Armories, Military Academies, Ducal Stables, Royal Libraries, and the Brandenburg Gate will still apply.

TrainedFreePromotion ignores all the normal pre-requisite promotions and experience levels required for a particular promotion. If the unit is able to accept the promotion, then the promotion will be applied. Archery units, for example, do not get the DRILL_1 promotion granted by the Alhambra wonder. Mounted units and melee units DO get the promotion. This is because Archery units cannot use the DRILL_1 promotion, but the other two type units can. If I changed the promotion granted by the Alhambra to "BARRAGE_1" then Archery units would start to accept the promotion, but mounted and melee units would not. Even though the icons for "DRILL_1" and "BARRAGE_1" look similar, they are not the same promotion.

TrainedFreePromotion can be stacked. You cannot have more than one TrainedFreePromotion statement within the same building, but multiple buildings or wonders that each grant a different "TrainedFreePromotion" can be built in the same city. Units trained in such a city will be given ALL of these TrainedFreePromotions so long as the individual "free" promotions are correct for that type of unit.

FREE PROMOTION

FreePromotion grants a free promotion to any unit anywhere on the game board that is able to use the promotion. Himeji Castle, Great Lighthouse, and Statue of Zues all use the "FreePromotion" command to grant their respective special promotions. A promotion that is not normally "choosable" as a unit gains experience can be specified, or a promotion that units can normally "choose" as they gain experience can be specified. The code the Himeji Castle uses is as follows:

Code:
<FreePromotion>PROMOTION_HIMEJI_CASTLE</FreePromotion>

When you add a FreePromotion to a building the game ignores all the normal requirements for pre-requisite promotions and gives the promotion to all units of the correct unit-type for that promotion. Units are not "penalized" for recieving a free promotion in this way. Their amounts of accumulated XP's is not effected, nor is their "unit level" for determining how many more XP's are required to choose the next level of promotion.

I once created a "Naval Academy" national wonder and attached the navy-unit "supply" promotion to it as a "FreePromotion". This immediately allowed my navy units to heal outside of my territorial waters. The "supply" promotion is normally only "choosable" by navy units after they gain sufficient experience, and after they select the appropriate pre-requisite promotions. By creating a wonder that gave out the "supply" promotion, I by-passed all the normal requirements needed to get to the "supply" promotion.

NOTE:

There was a "Navy Academy" mod available on the Steam Workshop for the Gods and Kings expansion that granted the "supply" promotion, but I think in that mod the author made it a promotion that had to be "trained" instead of how I did it in my private mod.

FREE PROMOTION REMOVED

Spoiler :
FreePromotionRemoved appears in the definitions of what can be added to <Buildings> XML but does not appear to be actually used anywhere.

The format would be:

Code:
<FreePromotionRemoved>PROMOTION_PROMO_NAME_HERE</FreePromotionRemoved>

This is not the only command that appears in the definitions of what can and cannot be added to buildings, but which is not used anywhere in the FIRAXIS-supplied game XML. I have not seen any mods that use this command, and I have not tried to use it myself. You can try it but don't be suprised if it doesn't work, or works in a way that's seriously odd. My GUESS would be that FreePromotionRemoved would work in the same way as FreePromotion, but it would REMOVE a promotion from all appropriate units instead of ADDING one. This might be useful to "get rid of" nasty or disadvantageous promotions.

I have not included FreePromotionRemoved anywhere in this guide but here, and only in this comment.


PROPERLY-FORMATTED code for TrainedFreePromotion and FreePromotion:

The code shown here is EXACTLY the same code as used by the Zulu IKANDA building:

Code:
<TrainedFreePromotion>PROMOTION_BUFFALO_HORNS</TrainedFreePromotion>

The code shown here is EXACTLY the same code as used by the Himeji Castle world wonder:

Code:
<FreePromotion>PROMOTION_HIMEJI_CASTLE</FreePromotion>
 
CULTURE RATE MODIFIERS​

Culture rate modifiers adjust the amount of culture produced in cities by a percentage. "50" in these commands would increase the culture generated by cities by 50 percent.

CultureRateModifier adjusts the amount of culture generated only in the city where the building is built. It should be used with "regular" buildings and with wonders where you only want the city that built the wonder to get the culture boost.

GlobalCultureRateModifier adjusts the amount of culture generated in all cities for the player that built the building. It should normally be limited to wonders.

PROPERLY-FORMATTED code for CultureRateModifier and GlobalCultureRateModifier:

Code:
<CultureRateModifier>50</CultureRateModifier>
<GlobalCultureRateModifier>50</GlobalCultureRateModifier>

These commands can be omitted.


.....................................................................................................................................................................

HAPPINESS AND UNHAPPINESS​



DIFFERENCE BETWEEN "UNMODDED HAPPINESS" AND "HAPPINESS"

UnmoddedHappiness will go directly to your empire-level happiness-score, whereas Happiness is a local effect that only counts in the city where the building was built, and thus cannot be used to combat unhappiness in other cities that aren't producing much happiness. If a city already has enough happiness being generated inside it to overcome the UNHAPPINESS in that city, any extra buildings that add <Happiness> will increase the happiness of that city, but not the overall happiness of the empire. Only when a city is generating more UNHAPPINESS than Happiness will the addition of another building that gives <Happiness> affect the overall empire happiness score. In other words, the city needs to borrow less happiness from the empire, so the empire happiness score is increased.

UnmoddedHappiness
UnmoddedHappiness is used by numerous national and world wonder buildings to add happiness to the empire. My understanding is that UnmoddedHappiness is immediately "shared-out" thru the empire and therefore is a direct adjustment to your empire's overall happiness "score". The format to add "10" UnmoddedHappiness is:

Code:
<UnmoddedHappiness>10</UnmoddedHappiness>

Happiness
Happiness appears in many buildings, whether "regular" buildings or wonders. The plain Happiness statement affects the happiness of the city where the building is built, rather than being directly added to the empire's overall happiness "score". The format to add "4" Happiness is:

Code:
<Happiness>4</Happiness>

Important note: you cannot specify negative numbers for UnmoddedHappiness or Happiness. Negative numbers are simply ignored by the game.

UnhappinessModifier

Adjusts Unhappiness by a percentage. Only affects cities that are not "occupied". "Occupied" has nothing to do with whether or not a military unit is standing on the city-tile. "Occupied" means "conquered". Until you build a Courthouse in a conquered city, it will remain "occupied", and won't recieve the UnhappinessModifier. The format to reduce unhappiness by 10% in non-conquered cities is:

Code:
<UnhappinessModifier>-10</UnhappinessModifier>

You need the "-" sign, otherwise you would make your building INCREASE unhappiness.

NoOccupiedUnhappiness
Eliminates the extra unhappiness penalty from a city that has been conquered. Since this is the only thing NoOccupiedUnhappiness does, and the Courthouse building is available to give this effect, you would not really have much of a need to create a new building that includes this command. The format is:

Code:
<NoOccupiedUnhappiness>true</NoOccupiedUnhappiness>

HappinessPerCity
This is a global effect that adds happiness to every city. The number of happiness to be added per city is determined by the number you enter. The format is:

Code:
<HappinessPerCity>1</HappinessPerCity>

HappinessPerCity should generally be used only with world wonders or national wonders.

HappinessPerCity is used in the FIRAXIS-supplied <Buildings> XML as part of the CN Tower world wonder, and is included because the wonder also increases population by "1" in every city. Otherwise, all the extra population would do is screw your empire happiness level. The two lines of code used by the CN Tower world wonder are:

Code:
<HappinessPerCity>1</HappinessPerCity>
<GlobalPopulationChange>1</GlobalPopulationChange>

The hint here is that anytime you use the GlobalPopulationChange command you should consider pairing it with the HappinessPerCity command.

HappinessPerXPolicies
Gives Happiness based on how many Social Policies have been adopted by the player who built the building. The command should be limited to wonders. The Prora Resort world wonder gives out 1 happiness for every two (2) social policies adopted by the player. The code included in with the Prora Resort world wonder for this is:

Code:
<HappinessPerXPolicies>2</HappinessPerXPolicies>

Side Note about PerX commands:

Spoiler :
anytime you see an XML command that has "PerX" as part of its name, it means that it is going to add or give 1 of something for every "X" of something. The "X" in these cases refers to the number value you fill in for the command. So what HappinessPerXPolicies is really saying is:

1 Happiness added Per "X" of Social Policies adopted

<HappinessPerXPolicies>2</HappinessPerXPolicies> is telling the game to add 1 Happiness Per "2" of Social Policies adopted.

"Per" means the same as "for every".



CityCountUnhappinessMod
Adjusts unhappiness from the number of cities in an empire. It is entered as a percentage adjustment, but the number entered does not make a direct "percentile" change. The unhappiness modification works like an "exponented" adjustment. To make a 50% reduction in the unhappines coming from number of cities, the command would be:

Code:
<CityCountUnhappinessMod>-50</CityCountUnhappinessMod>

The last time I tested this function I did so using the 50% as shown, and the change in unhappiness created by the number of cities adjusted from "10.8" before the command went into effect to "3.6" on the turn after the command went into effect, whereas I was expecting it to change to "5.4".

PROPERLY-FORMATTED code for UnmoddedHappiness, Happiness, UnhappinessModifier, NoOccupiedUnhappiness, HappinessPerCity, HappinessPerXPolicies, and CityCountUnhappinessMod:

Code:
<UnmoddedHappiness>10</UnmoddedHappiness>
<Happiness>4</Happiness>
<UnhappinessModifier>-10</UnhappinessModifier>
<NoOccupiedUnhappiness>true</NoOccupiedUnhappiness>
<HappinessPerCity>1</HappinessPerCity>
<HappinessPerXPolicies>2</HappinessPerXPolicies>
<CityCountUnhappinessMod>-50</CityCountUnhappinessMod>

Any of these commands can be omitted.


.....................................................................................................................................................................

GOLDEN AGES​


GoldenAgeModifier

GoldenAgeModifier adjusts the lengths of golden ages. It is entered as a percentage. The Chichen Itza world wonder adds 50% to the length of golden ages by using this command. The percentage adjustment is calculated against the standard 10-turn-length of golden ages, so "50" really translates to "5 turns". Format to add +50% to the length of golden ages is:

Code:
<GoldenAgeModifier>50</GoldenAgeModifier>

The GoldenAgeModifier does not stack in the sense that it acts as a compound-interest kind of modifier. If a player built a wonder that lengthens golden ages by 50%, the player's new golden-age-length will be 15-turns-long. Later if the same player builds another wonder that adds +50% to golden age length, the second wonder will still add the original 5-turn-long extension, increasing the length of the player's golden ages to 20-turns-long. (not the 22 or 23 turn-long golden ages that would result if the game "compounded" with this modifier).

The modifier does stack in the sense that multiple buildings or wonders can all add to the length of golden ages, and every time one of these buildings is built by the same player the game will add additional "golden-age-length" to all subsequent golden ages for that player.

You should generally limit this modifier to World or National wonders. If you add it to a new unique building, for example, you should enter a relatively-low number, something like "3", so that every city that builds the unique building will only result in a 3% extension of golden age lengths. Since the modifier is additive, or "stacks", and is a global effect, constructing a unique building with a modifier of "3" in 20 cities would have the same effect as building one world or national wonder that had a modifier of "60".

Note that player Game Speed adjusts the "stanard" length of Golden Ages, so a game set to Marathon will have a different length of Golden Age than one set to a game speed of Standard. But since the length-modifier is a percentage rather than a fixed number of turns, the slower or faster game speeds will adjust based on the unmodified length of a golden age for that game speed.

GoldenAge

GoldenAge is pretty simple. It starts a golden age, or extends one if the player is already in the middle of a golden age. You should limit this command to world or national wonders. The format is:

Code:
<GoldenAge>true</GoldenAge>

PROPERLY-FORMATTED code for GoldenAgeModifier to extend all FUTURE golden ages by 50%:

Code:
<GoldenAgeModifier>50</GoldenAgeModifier>

PROPERLY-FORMATTED code for GoldenAge to immediately start (or extend) a golden age:

Code:
<GoldenAge>true</GoldenAge>


Either <GoldenAgeModifier> or <GoldenAge> , or both, can be omitted. They can be used independantly of each other. You do not need both commands to make them work.
 
PRODUCTION MODIFIERS​


MilitaryProductionModifier

MilitaryProductionModifier speeds the production of all combat units in the city. The attribute is stated as a percentage adjustment to city production. It works in a slightly different manner than the two unit production modifier tables discussed later in this guide. Whereas the <Building_DomainProductionModifiers> and <Building_UnitCombatProductionModifiers> tables modify production speed of specific types of units, MilitaryProductionModifier adjusts production of any unit that has the <MilitaryProduction>true</MilitaryProduction> attribute. The effects are local to the city where the building was constructed. To increase unit production speeds by 15%, the command would be:

Code:
<MilitaryProductionModifier>15</MilitaryProductionModifier>

WonderProductionModifier

WonderProductionModifier has been provided for the <Buildings> table since the original release of the game, and I haven't seen it used by FIRAXIS anywhere, but I have seen it used by modders. It works as you would think it would. Wonder production is boosted in a city where there is a building built that contains the WonderProductionModifier command. I have not included any reference to this modifier anywhere in this guide but here. Properly-formatted code for this modifier would be as follows, to bump up Wonder Production in the city by 15%:

Code:
<WonderProductionModifier>15</WonderProductionModifier>

BuildingProductionModifier

BuildingProductionModifier boosts production in the city when Buildings are being constructed.

SpaceProductionModifier

SpaceProductionModifier boosts production in the city when spaceship parts are being constructed.

GlobalSpaceProductionModifier

GlobalSpaceProductionModifier boosts production in EVERY city that is constructing spaceship parts.


Format for Production Modifiers:

All production modifiers use the same format. The production percentage boost is stated in whole numbers in the command.

<BuildingProductionModifier>10</BuildingProductionModifier>

[TAB]would add 10% production in the city towards new buildings.

<SpaceProductionModifier>50</SpaceProductionModifier>

[TAB]would add 50% production in the city towards spaceship parts.

<GlobalSpaceProductionModifier>25</GlobalSpaceProductionModifier>

[TAB]would add 25% production in every city towards spaceship parts.

PROPERLY-FORMATTED code for BuildingProductionModifier, SpaceProductionModifier, and GlobalSpaceProductionModifier:

Code:
<BuildingProductionModifier>10</BuildingProductionModifier>
<SpaceProductionModifier>50</SpaceProductionModifier>
<GlobalSpaceProductionModifier>25</GlobalSpaceProductionModifier>

Any of the <MilitaryProductionModifier>, <WonderProductionModifier>, <BuildingProductionModifier>, <SpaceProductionModifier>, or <GlobalSpaceProductionModifier> commands can be omitted.

.....................................................................................................................................................................

GREAT PEOPLE ACQUISITION-RATE MODIFIERS​


Like it says on the outside of the tin, these commands modify the rate at which great people appear in the empire. They are percentage modifiers of the normal rate. Multiple buildings can add modifiers to the rate at which great people occur, and these modifiers seem to stack. Any of these great people acquisition-rate modifiers can be omitted.

GreatGeneralRateModifier

Adjusts the rate at which great generals appear by a percentage. To make great generals appear 10% faster, the code would be:

Code:
<GreatGeneralRateModifier>10</GreatGeneralRateModifier>

Great General appearance is not tied to cities the way other great people appearance is, so this modifier is a "global" modifier, even though the word "global" does not appear in the command.

GlobalGreatPeopleRateModifier

Adjusts the rate at which all great people appear by a percentage. To make great people appear 10% faster, the code would be:

Code:
<GlobalGreatPeopleRateModifier>10</GlobalGreatPeopleRateModifier>

GlobalGreatPeopleRateModifier is a GLOBAL effect, and thus adjusts the rate of great people emergence throughout the empire. The command would normally be limited to world wonders and national wonders.

GreatPeopleRateModifier

Adjusts the rate at which great people appear by a percentage. To make great people appear 10% faster, the code would be:

Code:
<GreatPeopleRateModifier>10</GreatPeopleRateModifier>

GreatPeopleRateModifier is a LOCAL effect, and thus adjusts the rate of great people emergence ONLY in the city where the building is constructed. The command would normally be added only to "regular" buildings. Gardens is a good example of the type of building this command is appropriate to.

The Great People that are affected:

GlobalGreatPeopleRateModifier and GreatPeopleRateModifier affect the following types of Great People:

Great Scientists
Great Engineers
Great Artists
Great Writers
Great Musicians
Great Merchants​

Will not affect Great Generals, Great Admirals, or Great Prophets. Great Generals have their own emergence rate modifier, while Great Prophet emergence is handled by the game through an entirely different mechanic.

Great Admirals

Great Admiral emergence RATE cannot currently be adjusted by any command in the Buildings XML-structure. There is a mechanic in the Social Policies XML that affects Great Admiral emergence rate, but not one for use with buildings. You can "immediately pump out" a Great Admiral using the <Building_FreeUnits> table shown later on in this guide, but that table just gives immediate free units. Giving out one or more Great Admirals using the <Building_FreeUnits> table would have no effect whatever on the speed at which further great admirals are acquired.
 
WONDER BUILD REQUIREMENTS​


I refer to these commands as being "wonder" requirements, but really any building could have the "HolyCity" requirement or the "PolicyBranchType" requirement. These commands only appear in the FIRAXIS-supplied XML for national or world wonders, hence my refering to them as "wonder" requirements. These commands can be omitted.

HolyCity

HolyCity designates that the building can only be built in a city where a religion was founded. For the most part this requirement will trend toward the building only being buildable in an empire's capital. The format is:

Code:
<HolyCity>true</HolyCity>

This is used in the FIRAXIS-supplied XML by the Grand Temple national wonder to make the grand temple only buildable in a holy city. You could create a special but "regular" type of building that could only be built in a Holy City, and by not adding the usual "national wonders need 1 of X building in every city" requirement, you would add a much more "buildable" special building.

PolicyBranchType

PolicyBranchType designates that the building can only be built if a player has chosen to "unlock" a specific Social Policy Branch. In the Brave New World expansion, several World Wonders now require adoption of a specific policy branch. This command is the XML-mechanic that does this. The Pyramids, for example, now require the LIBERTY social policy branch. The format of the command that is now included in the <Buildings> table for The Pyramids is:

Code:
<PolicyBranchType>POLICY_BRANCH_LIBERTY</PolicyBranchType>

For purposes of the XML-commands there is no difference between "Ideology" Branches and "Social Policy" Branches. The Policy Branches that can be used with this command are:

Spoiler :
POLICY_BRANCH_LIBERTY
POLICY_BRANCH_TRADITION
POLICY_BRANCH_RATIONALISM
POLICY_BRANCH_PATRONAGE
POLICY_BRANCH_COMMERCE
POLICY_BRANCH_EXPLORATION
POLICY_BRANCH_FREEDOM
POLICY_BRANCH_AESTHETICS
POLICY_BRANCH_ORDER
POLICY_BRANCH_AUTOCRACY
POLICY_BRANCH_PIETY
POLICY_BRANCH_HONOR​

One way you might make use of this command is by creating three new "regular" but rather special buildings, each of which is unlocked by a different "ideology" branch. Then, when a player selects, say, FREEDOM as their Ideology, the building you made "unlockable" by FREEDOM would become available to build in all the player's cities. If the player were to choose ORDER, then the building you made unlockable with the ORDER ideology would become available to build. If the player were to choose AUTOCRACY, then the building you made unlockable with the AUTOCRACY ideology would become available to build.


.....................................................................................................................................................................

SOCIAL POLICY COST COMMANDS​


These commands adjust the culture cost of social policies. "Free" in this sense is a cost, it's just a cost of zero (0). These commands can be omitted.

PolicyCostModifier

Adjusts the costs of all future social policies by the percentage entered. You should always show this as a negative whole number. Omitting the "-" sign would INCREASE the cost of future social policies. You should limit this command to world and national wonders. To reduce future social policy costs by 10%, the format for the command is:

Code:
<PolicyCostModifier>-10</PolicyCostModifier>

FreePolicies

FreePolicies gives a specified number of social policies for FREE for the player to choose. The policies are free, and there is no effect on the player's current progress towards gaining the next social policy in the usual manner. Any positive whole number greater than zero (0) can be entered in this command, but you should not "overwhelm" the social policy system by giving out too many free social policies with any one building. One, maybe two, social policies should be the limit of what you have your new building grant the player. This command should be limited to national and world wonders, so as also not to break the game-balance of the social policy system. The following command would grant one (1) free social policy:

Code:
<FreePolicies>1</FreePolicies>

Entering zero (0) as the number of social policies granted is the same as omitting the command, so you should just not even include the command if you do not want your building to grant free social policies.
 
The following commands are either used EXCLUSIVELY with national wonders, or are NORMALLY only used with National Wonders. These commands can be omitted.

Capital

Used only in the PALACE national wonder to designate that the city is the capital of the empire.

ONLY USE THIS if you are creationg a unique building to replace the usual PALACE that is given out to every player. In such case, you MUST use this with your PALACE replacement building.

Any Building that has this column set to "true" (<Capital>true</Capital>) will move the empire capital to the city where the building is constructed, instantly upon completion of the building.

NumCityCostMod

Used exclusively with National Wonders to increase the hammers cost of the building by +30 hammers (on standard game speed) for every city in the empire. Puppeted cities don't count, but cities that you have annexed or are RAZING do. FIRAXIS always uses "30" in this command. You can enter any number you want, but bear in mind that players using large or huge maps are affected to the same degree per-city-they-build as players playing on standard or smaller maps. There is no modifier of this command for game-map-size, but it is modified based on a player's game speed selection (Quick, Marathon, etc.).

The way this command works is that EVERY city added to the empire raises the cost of the National Wonder by +30 hammers on Standard Game Speed. A player that only has one city (ie, their capital) will have a hammers build cost of 155 for National Wonders (125 + (30*1)). A player that has three total cities will have National Wonder costs of 215 (125 + (30*3)).

You can omit this command altogether and still have your building successfully register with the game as a National Wonder.


ReligiousPressureModifier

Adjusts the religious pressure from the city by a percentage value. This is used by FIRAXIS only with the GRAND TEMPLE national wonder. Since the GRAND TEMPLE also requires a Holy City, the command not does affect play in the FIRAXIS-supplied version of the game unless the player has first founded a religion.

Other than HolyCity, there is no command in the <Buildings> table to disallow a building to be built unless the player has first founded a religion. You could use ReligiousPressureModifier in a "regular" building, but there would be no effect unless the city also has a religion. I have included this command here because it is only used by FIRAXIS in connection with a national wonder, but I have seen several mods on the steam workshop that include this command with world wonders.

I am not entirely convinced this command works with any building other than the Grand Temple national wonder. There isn't any obvious increase in religious pressure from a city that builds a wonder having this command.

Command Formats

PROPERLY-FORMATTED code for Capital, NumCityCostMod, and ReligiousPressureModifier:

Code:
<Capital>true</Capital>
<NumCityCostMod>30</NumCityCostMod>
<ReligiousPressureModifier>100</ReligiousPressureModifier>
 
The following are commands that don't really fit into any handy category with other commands and are thus discussed on a case-by-case basis.

......................................................................................................................................

NULLIFY INFLUENCE MODIFIER​

Nullifies the Tourism effects of other CIVS granted from the INTERNET tech. This command can be omitted.

Code:
<NullifyInfluenceModifier>true</NullifyInfluenceModifier>

......................................................................................................................................

EXTRA LUXURIES​

Grants an extra copy of every luxury in the city workable range. This is one of the primary extra effects of the Bazaar. This command can be omtted.

Code:
<ExtraLuxuries>true</ExtraLuxuries>
......................................................................................................................................


AIRPORT COMMANDS​

Airlift

Allows "Airlifting" of units. This is included in the airport building, which is new in the Brave New World expansion.

AirModifier

Increases the allowed number of air units that can be stationed within the same city. Since this is a direct additive change to the allowed numbers of units, this command does not function similar to other "modifier" commands.

Code:
<Airlift>true</Airlift>
<AirModifier>4</AirModifier>

These commands can be omitted.

......................................................................................................................................

NUKE IMMUNE​

The building is never destroyed as a result of a nuclear attack on a city.

The Military Base and all World and National Wonders are "NukeImmune".

This command can be omitted.

Code:
<NukeImmune>true</NukeImmune>


......................................................................................................................................

NUKE POPULATION-LOST MODIFIER​

Reduces population-loss from nuclear-attack in the city that built the building. The Bomb Shelter building uses this command as shown:

Code:
<NukeModifier>-75</NukeModifier>

This command can be omitted.

......................................................................................................................................

FREE TECHS​

Gives out a number of free technologies once the building is constructed. This command should be limited to national or world wonders. The command can be omitted.

"1" in this command gives one (1) free technology.
"2" in this command would give two (2) free technologies.

Code:
<FreeTechs>1</FreeTechs>

......................................................................................................................................

WORKER SPEED MODIFIER​

Adjusts the speed at which workers work. This is how the Pyramid world wonder increases the speed of workers. The entry in this command is a percentage of the "base" speed the worker usually works at, so "25" makes workers work 25% faster. This effect "stacks" with the social policy effect that does the same thing, so if a player selects that social policy and builds the Pyramids, that player's workers will be more efficient by a total improvement of 50%. This command can be omitted.

Code:
<WorkerSpeedModifier>25</WorkerSpeedModifier>

......................................................................................................................................

GLOBAL POPULATION CHANGE​

GlobalPopulationChange

Adds citizens in every city in the empire. You should limit this to world wonders or national wonders. You should also normally pair the command with a "HappinessPerCity" with the same amount of happiness added per city as entered for the population per city change. These commands can be omitted.

Code:
<GlobalPopulationChange>1</GlobalPopulationChange>
<HappinessPerCity>1</HappinessPerCity>

......................................................................................................................................

"X" NUMBER OF THIS BUILDING TRIGGERS IDEOLOGY CHOICE​

XBuiltTriggersIdeologyChoice is used in the factory building to trigger selection of an ideology. A positive whole number should be used with this command. This command can be omitted.

You would not normally use this command with a new building because there would be little point.

You might wish to change the number of factories required before an ideology choice is triggered. You would use an <Update> of the factory to do so.

Code:
<XBuiltTriggersIdeologyChoice>3</XBuiltTriggersIdeologyChoice>

......................................................................................................................................

GOLD PLUNDER MODIFIER​

CapturePlunderModifier

Alters by a percentage the amount of plunder a conqueror recieves when they capture a city. I haven't tried it, but I assume a negative value would LOWER plunder gold if the city is captured. This command can be omitted.

The Egyptian "Burial Tomb" building uses the CapturePlunderModifier as shown, with a 100% increase in plunder:

Code:
<CapturePlunderModifier>100</CapturePlunderModifier>

......................................................................................................................................

UNIT UPGRADING-COST MODIFIER​

UnitUpgradeCostMod

Adjusts the empire-wide gold cost of UPGRADING military units. This is the primary efffect of the Pentagon world wonder. The effect is "stackable" when multiple custom world wonders write to this modifier. This command can be omitted.

Normally, you will want to enter a negative number in this command.

Code:
<UnitUpgradeCostMod>-33</UnitUpgradeCostMod>

......................................................................................................................................

FOOD KEPT ON POPULATION INCREASE​

FoodKept

keeps a percentage of the "food score" in a city that would usually be lost when city population increases. Since cities don't really "store" food in granaries anymore, food kept lowers the deduction made to the amount of food accumulated when a new citizen is born in the city. This command can be omitted.

Expressed as a percentage, and needs to be a positive whole number, such as:

Code:
<FoodKept>40</FoodKept>

FOOTNOTE:

Spoiler :
when you add "FoodKept" to a regular building, finishing the TRADITION policy branch may result in the new building being given out for free in a player's 1st four cities rather than the Aqueduct.



......................................................................................................................................

GREAT SCIENTIST "DISCOVER TECHNOLOGY" MODIFIER​

GreatScientistBeakerModifier

Great Scientists create more science "beakers" when you use them to discover technologies. The modifier is entered as a percentage. The international space station uses this command to generate the 33% increase in science research gained from "bulbing" a great scientist.

Code:
<GreatScientistBeakerModifier>33</GreatScientistBeakerModifier>

This command can be omitted.

......................................................................................................................................

GREAT PERSON EXPENDED GOLD​

GreatPersonExpendGold

Gives gold whenever a great person is expended. The amount of gold gained is entered in the command. This is one of the primary effects of the Mausolleum of Helicarnasus world wonder. "Expended" in this sense means used up and removed from the game, so this command adds an extra benefit to the ones normally recieved whenever a great person is used to do their great person "thing". This command can be omitted.

You can enter pretty much any reasonable value you want so long as you limit this command to world wonders.

Code:
<GreatPersonExpendGold>100</GreatPersonExpendGold>

......................................................................................................................................

FREE GREAT PEOPLE​

FreeGreatPeople

Gives out a free GREAT PERSON of the player's choice. This was used in the Gods & Kings expansion in (as I recall) the Hagia Sophia world wonder, but was removed in the Brave New World expansion and hard-changed to always give a Great Prophet. The command "FreeGreatPeople" still works in the BNW expansion, however, and you can add it to buildings. This command can be omitted.

You should limit it to world and national wonders. The number of great persons given out is decided by what you enter in the "FreeGreatPeople" command. The example as shown would add one (1) free great person of the player's choice:

Code:
<FreeGreatPeople>1</FreeGreatPeople>

Great People 'Cost' Effects:

When Great People are given using <FreeGreatPeople> as a reward for constructing a wonder or building, the 'cost' for nearly all Great People is incremented.
  1. The increment is applied to all Great People of the same 'Great People Group' based on the choice of Great Person the player makes.
  2. Choosing a Great Artist increments the cost in Great People Points for the next Great Artist, Great Writer, and Great Musician. The same effect applies when choosing a Great Writer or a Great Musician.
  3. Choosing a Great Engineer increments the cost in Great People Points for the next Great Engineer, Great Scientist, and Great Merchant. The same effect applies when choosing a Great Scientist or a Great Merchant.
  4. Great Prophets are affected but the effect is applied to the Faith Cost of the next Great Prophet.
  5. Great Generals and Great Admirals are not affected so far as I have been able to determine. The 'experience' cost of the next Great General or Great Admiral is not changed.

FOOTNOTE:

Spoiler :
You can also select a specific type of Great Person your wonder will give, but since this is done under a different game table than <Buildings> I will show how to do that later.


......................................................................................................................................

GLOBAL DEFENSIVE-BUILDING MODIFIER​

GlobalDefenseMod

Increases defensive building strength by a percentage in every city in the empire. This is the primary attribute of the Red Fort world wonder. This command can be omitted.

Code:
<GlobalDefenseMod>25</GlobalDefenseMod>


......................................................................................................................................

CITY-STATE INFLUENCE CHANGE​

MinorFriendshipChange

Adjusts influence with city-states for the player that constructs the building. The adjustment is a percentage of current influence. This command can be omitted.

Code:
<MinorFriendshipChange>25</MinorFriendshipChange>

......................................................................................................................................

CITY-STATE TRADE-ROUTES PRODUCTION MODIFIER​

CityStateTradeRouteProductionModifier

Modifies (changes by a percentage) Production in a city that constructs the building based on the number of trade-routes the player has with City-States. The city that constructs the building gets the production boost for EACH and EVERY active land (caravan) or sea (cargo-ship) trade route the player has with a City-State. It does not matter whether the CITY has an active trade-route with a City-State; all City-State trade routes of the EMPIRE count for any city that constructs the building. This command can be omitted.

Code:
<CityStateTradeRouteProductionModifier>5</CityStateTradeRouteProductionModifier>

"5" is a 5% bump in production for each qualifying trade-route. So if a player has six trade-routes active with City-States, the total production boost is 30%.

......................................................................................................................................

EXTRA MISSIONARY RELIGION SPREADS​

ExtraMissionarySpreads

Increases the number of religion spreads a missionary can conduct before being "used up". Only affects missionaries purchased in the city where the building is built, and is not therefore a "global" command. The Great Mosque of Djenne world wonder uses this as a primary effect. This command can be omitted.

The command can be used on any number of wonders or buildings within the same game play-through, and multiple builldings or wonders that are built within the same city, each with "ExtraMissionarySpreads", will "stack" thier effects on missionaries purchased within the city.

Code:
<ExtraMissionarySpreads>1</ExtraMissionarySpreads>

The effects will only become active after the wonder is constructed. If you also have the same wonder give a free missionary, the number of religion spreads will not be increased for that free missionary.

......................................................................................................................................

INSTANT MILITARY LAND-UNITS INCREASE​

InstantMilitaryIncrease

Used in the new version of the Terracotta Army world wonder to accomplish the free instant units-copies creation of land units. Enter "1" for this command to mimic the Terracotta Army world wonder effect, or omit the command entirely from any world or national wonder. Any number besides "1" will not create additional copies of the units. I've tried setting "2" for this command, but there was no difference in the number of "copies" of units recieved. This command can be omitted.

Code:
<InstantMilitaryIncrease>1</InstantMilitaryIncrease>

......................................................................................................................................


FREE GREAT WORK​

FreeGreatWork

Used by the Parthenon world wonder to add the free great work to the wonder. To add this capability to a new world wonder you would need to set ALL of the following to get it to work properly:

Code:
<GreatWorkSlotType>GREAT_WORK_SLOT_ART_ARTIFACT</GreatWorkSlotType>
<GreatWorkCount>1</GreatWorkCount>
<FreeGreatWork>GREAT_WORK_PARTHENON_FRIEZE</FreeGreatWork>

These are the EXACT commands used in the Parthenon <Buildings> XML. You could select a different TYPE of great work, but probably not a different GreatWorkCount. You have to select a great work of the appropriate type (from the available list of great works) for placement into the wonder. You will also have to specify a different great work from the available list than the one being used by the Parthenon.

<FreeGreatWork> can be omitted.

......................................................................................................................................

GOLD​

Gold adds gold to the empire treasury. It is a one-shot command, and only adds the stated amount of gold upon construction of the building. So long as the amount entered for the gold "gifting" is reasonable, any amoount can be used. World Wonders might have as their primary effect granting largish amounts of gold, say something on the order of "1500", but in general the amount given should be fairly small, as in, say, "25", or "50", or "100". To allow a building to grant the player 100 gold, the format is:

Code:
<Gold>100</Gold>

To be more clear:The command DOES NOT add the stated amount of gold every turn. It adds the stated amount ONLY ONCE.

This command can be omitted.

......................................................................................................................................

EXPERIENCE​

Experience adds experience to every combat unit built or purchased in the city. It pays no attention to whether the unit is a land unit, an air unit, or a sea unit. This command should be safe to use with regular buildings, National Wonders, or World Wonders since the effect occurs only in the city where the building is constructed. To allow a building to grant a unit 15 XP, the format is:

Code:
<Experience>15</Experience>

This command can be omitted.

Note that Lua methods that reference Domain-Linked unit experience being granted within a city or from a building do not account for unit XPs given in a city by the <Experience> column.

......................................................................................................................................

VICTORY CONDITIONS​

DiplomaticVoting and VictoryPrereq

These two commands were used with the now-defunct United Nations wonder to allow the Diplomatic victory. Since the Diplomatic victory is now controlled in-game by the World Congress mechanics, these two commands are not used in Brave New World. You should generally omit them from your mods.

Code:
<VictoryPrereq>VICTORY_DIPLOMATIC</VictoryPrereq>
<DiplomaticVoting>true</DiplomaticVoting>

......................................................................................................................................

TEAM COMMANDS​

Teamshare

I believe this allows a wonder's or building's benefits to be shared throughout all team members in a team when game options use teams for play, or in a scenario where "teams" are assigned. I have seen this used in a few world wonder mods. I have not played using any of the "team" scenario or multiplayer mechanics, so I can give no further guidance on this command. The proper format is:

Code:
<Teamshare>true</Teamshare>

TechShare

Would seem to be a multiplayer or team function, but I am not sure exactly how it would function.

Code:
<TechShare>true</TechShare>

Either or both of these two commands can be omitted.

......................................................................................................................................

UNIT HEALING​

HealRateChange
  • Increases a unit's heal rate while stationed within a city. It is expressed as a direct extra number of health-points to be given to the unit in addition to the city's usual healing effect.
  • So "10" is a direct 10 extra health points, not an extra 10% healing of the unit.

......................................................................................................................................

NON-FUNCTIONAL COMMANDS

(I HAVE tested the following commands)​

There are several commands that don't appear to actually have any effect on the game. I am assuming these are "orphan" commands that were never implimented with the release of the original game. All of these commands should be omitted.

GlobalExperience
appears to not have any effect. tried this and cannot see that anything happened.

CitiesPrereq
appears not to have any effect. tried this and cannot see that anything happened.

LevelPrereq
appears not to have any effect. tried this and cannot see that anything happened.

......................................................................................................................................

UNKNOWN OR NON-FUNCTIONAL COMMANDS

(I have NOT tested the following commands)​

The following commands may or may not be functional. All of these commands should be omitted.

NukeExplosionRand
absolutely no idea.

VictoryPoints
don't know how this would work but it was likely included so there could be a victory-points system.

ReplacementBuildingClass
The command does work and I will be adding a supplimental write-up on it's efffects and possible methods of usage.

FoundsReligion
no idea -- this command was present in "Vanilla" Civ5, but as I remember was never used for anything.

IsReligious
no idea -- this command was present in "Vanilla" Civ5, but as I remember was never used for anything.

PlayerBorderObstacle
no idea -- this command was present in "Vanilla" Civ5, but as I remember was never used for anything.

MapCentering
no idea -- this command was present in "Vanilla" Civ5, but as I remember was never used for anything. In earlier versions of Civ, as I recall, there were wonders or buildings or tech achievements that had "MapCentering", but so far as I know nothing like this was ever implemented in CIV5 so far as buildings is concerned.
 
The in-game art used to render cities changes somewhat as the player progresses through the eras of the tech tree. It also varies somewhat based on the "culture group" to which a civilization belongs. For the game to know which buildings should affect this main-map art rendering variation, the commands ArtInfoEraVariation, ArtInfoRandomVariation and ArtInfoCulturalVariation are used. No building in the FIRAXIS-supplied XML uses more than one of these three commands. Whenever one of these commands is used, there is also a "DisplayPosition" command.

DisplayPosition is always a numerical value, and is generally a different value for each building that uses one of the "ArtInfo..." commands. Stadiums and Colosseums share the same "DisplayPosition" number.

MOD usage:

  1. As a general rule you should not attempt to include these commands in your building. I present them here so that you know what they are.
  2. If your building is a unique replacement building for a standard building in the game you can probably safely include these commands if they appear in the XML for the standard building. In such cases you need to EXACTLY COPY the commands as presented in the standard building, and you need to include the "ArtDefineTag" EXACTLY as it appears for the standard building. Be prepared to eliminate these commands from your mod if "wonky stuff" happens after you try-out your mod in actual play testing.

Here is a sampling of the commands as actually used in FIRAXIS-supplied buildings. I've also included the "ArtDefineTag" associated with each of these buildings. The sampling is not exhaustive:


Spoiler :
Taken from the XML of BUILDING_LIGHTHOUSE

Code:
<ArtDefineTag>LIGHTHOUSE</ArtDefineTag>
<ArtInfoEraVariation>true</ArtInfoEraVariation>
<DisplayPosition>8</DisplayPosition>

Taken from the XML of BUILDING_HARBOR

Code:
<ArtDefineTag>HARBOR</ArtDefineTag>
<ArtInfoEraVariation>true</ArtInfoEraVariation>
<DisplayPosition>16</DisplayPosition>

Taken from the XML of BUILDING_COLOSSEUM

Code:
<ArtDefineTag>COLESSEUM</ArtDefineTag>
<DisplayPosition>2</DisplayPosition>
<ArtInfoCulturalVariation>true</ArtInfoCulturalVariation>

Taken from the XML of BUILDING_STADIUM

Code:
<ArtDefineTag>STADIUM</ArtDefineTag>
<DisplayPosition>2</DisplayPosition>
<ArtInfoRandomVariation>true</ArtInfoRandomVariation>


Here are the commands, properly-formatted, including the "DisplayPosition" command from the Lighthouse building. Remember that no building ever has more than one of the "ArtInfo...." commands:

Code:
<ArtInfoEraVariation>true</ArtInfoEraVariation>
<ArtInfoRandomVariation>true</ArtInfoRandomVariation>
<ArtInfoCulturalVariation>true</ArtInfoCulturalVariation>
<DisplayPosition>8</DisplayPosition>

IMPORTANT CLARIFICATION:

You can use safely the "ArtDefineTag" from any building that has one of the "ArtInfo...." commands, but as a general rule you just shouldn't use any of the three "ArtInfo...." commands UNLESS your building is a unique replacement for a standard building that uses these commands.
 
BECAUSE I SUCK AT ARTWORK I will not attempt to discuss how to draw artwork, how to store it correctly in "art atlas files", or anything else directly-connected to the creation of artwork. I will only cover how to make the game XML use artwork once it is made.

You must have an entry for both <IconAtlas> and <PortraitIndex> in your building definition.

ICON ATLAS​


In order for the game to know where to find the icons it should display in the tech tree, in the civilopedia, and in the city displays, it needs a reference to the correct atlas of icons, and it needs to know which "picture" within that atlas to use for the building.

IconAtlas tells the game which icon atlas to use.

  1. The name of the icon atlas usually is presented ALL IN CAPS, and numbers are allowed. But you do not HAVE TO enter the name of your Icon Atlas all in caps.
  2. Elsewhere in the XML you have to tell the game which art files are associated with the IconAtlas. This is done using the <IconTextureAtlases> table, since Icon Atlases are not strictly "buildings-related".


PORTRAIT INDEX

PortraitIndex tells the game which "picture" within the icon atlas applies to the building.

NOTE:

If you suck at artwork as much as I do, you can also use the existing artwork icons supplied by FIRAXIS. If you decide that the in-game icons for the barracks building is good enough, you can use the same entries for IconAtlas and PortraitIndex as are used for the barracks. When you "borrow" this artwork for your new building it is not necessary to define any information under the <IconTextureAtlases> table, since the game already has all this information at hand. The game does not care how many times the same icons are used for different buildings.

HINTS:

Spoiler :
If you are just starting out with making new building MODS, start with a "regular" building before you tackle a world wonder. Create the XML for your regular building first, and use an existing building artwork "set". Trouble-shoot with game-play to ensure your building is functioning the way you want it to, THEN go back and tackle the artwork. In this way you at least know that everything in your XML that is not directly-related to artwork definitions is functioning properly, so any difficulties you may encounter with the artwork is related to the art files themselves, or something you did wrong in telling the XML how to find and use your artwork. When you get a new regular building to function properly including new artwork you may have added, you're ready to tackle a world wonder. This way, you will at least be confident that it is not your XML commands that are barfing-up on your world wonder.

If your ultimate goal is to create a new world wonder, you can still use the icons you have created for that world wonder in a regular building. The game does not know or care that the icons you have created are intended to be used with a new world wonder. This allows you to verify you have your icons done correctly and that your IconAtlas reference is good, AS WELL AS your entries in the <IconTextureAtlases> table.




EXAMPLES OF IconAtlas AND PortraitIndex
(open the spoiler below)

Spoiler :
Here are a few of the artwork IconAtlas and PortraitIndex commands used in the FIRAXIS-supplied XML:

Barracks

Code:
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>5</PortraitIndex>

Colosseum

Code:
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>23</PortraitIndex>

Longhouse

Code:
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>57</PortraitIndex>

Workshop

Code:
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>28</PortraitIndex>

Factory

Code:
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>3</PortraitIndex>


THE <IconTextureAtlases> TABLE​

Let's divert from buildings for a while, and talk about the <IconTextureAtlases> table. The <IconTextureAtlases> table is exclusively meant for defining what art files are included within an "IconAtlas". The <IconTextureAtlases> table is not exclusively for use with art related to buildings and wonders. It is also used for defining the art files used with unit promotion icons, for example. The rule-of-thumb is that anywhere there is a requirement for an in-game icon, there is an "IconAtlas" reference and an entry in the <IconTextureAtlases> table to tell the game which artwork files are associated with the "IconAtlas".

When you enter a reference to an "IconAtlas" under the <Buildings> table, you are ONLY telling the game to refer to the <IconTextureAtlases> table to find the atlas name and all the files associated with that atlas name. You define a NEW Icon Atlas by the entries you make under the <IconTextureAtlases> table.

So, if I've completed the necessary artwork files and saved them to my mod, I can define my new atlas of icons using the <IconTextureAtlases> table. Multiple <Row> entries are required in the <IconTextureAtlases> table, one each for every Size of Icon that is needed for the sort of Atlas you are making. (for example, the Icon Size requirements for Buildings is different from that required for Unit Promotions).

Commands for the <IconTextureAtlases> table:

Atlas

Specifies the name of the new icon atlas. ALL CAPS is general but not required. You can also use numbers in the name of the atlas, just as FIRAXIS did, such as "BW_ATLAS_1". The name you use here in the "Atlas" name must be copied EXACTLY into the <Buildings> table for IconAtlas. It must also be EXACTLY THE SAME for every Icon Size entry in the <IconTextureAtlases> table. You should also pick an icon atlas name that is fairly unique, so there will be little chance that a different mod from yours will be using the same name of icon atlas. Simply naming your icon atlas "IconAtlas" is a REALLY bad idea.

IconSize

Tells the game which icon size the current <Row> entry is supplying information for. The <Buildings> table requires entries in the <IconTextureAtlases> table for Icon Sizes of "256", "128", "64", and "45". World Wonders can also have an entry in the <IconTextureAtlases> table for icon size "80" but it is not strictly required. I've seen World Wonders done both with and without entries for Icon Size "80".

Filename

Tells the game the filename to use for this size icon. There must be a file for each required Icon Size, with a different filename for each Size of Icon. The convention is to add the Icon Size to the end of the file name, as I have shown, but I am not sure if it is strictly necessary to have "256" or "128", etc., in the filename. The files must be of the ".dds" format. Since I suck at artwork I'm not really sure what all the differences are between a ".dds" file and, say, a ".jpg" file.

You can enter the "full" file plus file-path name in this field, including the file-folder name(s) that apply to the way your artwork is stored within the MOD, such as "ART/MyNewAtlas256.dds" instead of simply stating "MyNewAtlas256.dds". I haven't had any difficulty with MODbuddy or the actual game finding an artwork file when I've left off the folder portion (the "ART/") of the full file and path name and used only the simple file name.

You should pick a file name to use that is fairly unique. Avoid a file name group such as "ART256.dds", "ART128.dds", "ART80.dds", "ART64.dds", and "ART45.dds"

IconsPerRow

Tells the game how many icons to look for in the art file for every "row" in the art file. Since I suck at artwork, I have no idea what the MIN-MAX or other requirements are for "IconsPerRow". I think max is 8 and min is 1, but I am not sure. Refer to one of the other tutorials and guides I pointed you to for further information.

IconsPerColumn

Tells the game how many icons to look for in the art file for every "column" in the art file. Since I suck at artwork, I have no idea what the MIN-MAX or other requirements are for "IconsPerColumn". I think max is 8 and min is 1, but I am not sure. Refer to one of the other tutorials and guides I pointed you to for further information.

Table Structure:
(open the spoiler)

Spoiler :
Here's what I would have to add to my mod for the <IconTextureAtlases> table, assuming I've named all my artwork files with a name-format of "MyNewAtlas" + icon size + ".dds" :

(note that the FORMAT of the commands in this code box is correct, but the numbers I stuck into the example for IconsPerRow and IconsPerColumn are just a generic number I stuck in to show the correct format. There might not be such an animal as a 8x8 grid allowed by the game)
Code:
<GameData>
	<IconTextureAtlases>
		<Row>
			<Atlas>MY_NEW_ICON_ATLAS</Atlas>
			<IconSize>256</IconSize>
			<Filename>MyNewAtlas256.dds</Filename>
			<IconsPerRow>8</IconsPerRow>
			<IconsPerColumn>8</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>MY_NEW_ICON_ATLAS</Atlas>
			<IconSize>128</IconSize>
			<Filename>MyNewAtlas128.dds</Filename>
			<IconsPerRow>8</IconsPerRow>
			<IconsPerColumn>8</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>MY_NEW_ICON_ATLAS</Atlas>
			<IconSize>64</IconSize>
			<Filename>MyNewAtlas64.dds</Filename>
			<IconsPerRow>8</IconsPerRow>
			<IconsPerColumn>8</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>MY_NEW_ICON_ATLAS</Atlas>
			<IconSize>45</IconSize>
			<Filename>MyNewAtlas45.dds</Filename>
			<IconsPerRow>8</IconsPerRow>
			<IconsPerColumn>8</IconsPerColumn>
		</Row>
	</IconTextureAtlases>
</GameData>

To use one of the NEW icons that might appear in "MY_NEW_ICON_ATLAS" as defined in this example, my entry under the <Buildings> table might look like the following:

Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_EXAMPLE</Type>
			<BuildingClass>BUILDINGCLASS_EXAMPLE</BuildingClass>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>100</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<Help>TXT_KEY_BUILDING_EXAMPLE_HELP</Help>
			<Description>TXT_KEY_BUILDING_EXAMPLE</Description>
			<Civilopedia>TXT_KEY_BUILDING_EXAMPLE_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_EXAMPLE_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<HurryCostModifier>25</HurryCostModifier>
			<PlotBuyCostModifier>-10</PlotBuyCostModifier>
			[B][COLOR="Red"]<!-- NEW STUFF -->
			<IconAtlas>MY_NEW_ICON_ATLAS</IconAtlas>
			<PortraitIndex>0</PortraitIndex>[/COLOR][/B]
		</Row>
	</Buildings>
</GameData>

Note that "0" is a valid entry for "PortraitIndex". If your new building artwork only has one icon, it will usually be placed in the "0" position.
 
When your mod adds a NEW world wonder to the game, you need to add the information the <Buildings> table needs in order to make a wonder splash screen show up when the wonder is constructed.

You will also need to create a wonder splash-screen art file, and include it in your mod. All I know about creating wonder splash screen artwork is that the file needs to be saved as a ".dds" file.

NATIONAL WONDERS do not use these commands. There is no wonder splash screen for national wonders.

.........................................................................................................................................................

WONDER SPLASH SCREEN ART FILE​

The command WonderSplashImage tells the XML what art file goes with your wonder for the wonder splash screen. This is the entry for the Great Lighthouse world wonder:

Code:
<WonderSplashImage>WonderConceptGreatLighthouse.dds</WonderSplashImage>

Your NEW world wonder will have a different file name, of course, but all you have to do is replace the Great Lighthouse art file name with the name of the art file for your new world wonder.

If I am adding a new world wonder to the game, and I have created an artfile for the wonder splash screen called "MyNewWonder.dds", I would alter the WonderSplashImage line to read as follows:

Code:
<WonderSplashImage>MyNewWonder.dds</WonderSplashImage>

In terms of XML-commands, that's all there is to telling the game how to find your new world wonder splash-screen art.

.........................................................................................................................................................

WONDER SPLASH SCREEN PAN-IN CONTROL​

You can control how the game "zooms-in" on your world wonder artwork when the splash-screen comes up in-game. This is done with the WonderSplashAnchor line. The format for this command is as shown here:

Code:
<WonderSplashAnchor>L,B</WonderSplashAnchor>

The letters on either side of the comma (",") tell the game where to pan-in FROM. These letters can appear BEFORE the comma:

C[TAB]Centered Left to Right
R[TAB]Start from Right
L[TAB]Start from Left​

These letters can appear AFTER the comma:

C[TAB]Centered Vertically
T[TAB]Start from Top
B[TAB]Start from Bottom​

So the command <WonderSplashAnchor>L,B</WonderSplashAnchor> is read by the game as "start pan-in from the Left and the Bottom".

The game does not REQUIRE an entry for WonderSplashAnchor. You can omit it from World Wonders if you choose.

.........................................................................................................................................................

WONDER SPLASH AUDIO​

Since you can now add audio files to the game for use with your world wonder, you can use a command that tells the game which wonder speech audio "atlas" to look for. You can still also include the following command when you are not adding a custom audio speech to your wonder:

Code:
<WonderSplashAudio>NONE</WonderSplashAudio>

The game does not REQUIRE an entry for WonderSplashAudio. You can omit it from World Wonders if you choose. The effect will be the same as if you state "NONE" in the command.

For detailed information on how to enter your command for WonderSplashAudio when you wish to add a custom speech to your wonder, refer to the Supplement on Adding Audio. [[note to self. check with forum moderators if a link to the appropriate section of this tutorial is acceptable forum etiquette]]

.........................................................................................................................................................

WONDER SPLASH QUOTE​

Many modders will include the look-up reference for their wonder splash screen "quote" here in their <Buildings> table rather than higher up with the other "TXT_KEY_" look-up references. You can do it either way, but you should include a wonder splash-screen quote. Remember that with "TXT_KEY_" look-up references, you are only telling the game WHERE TO LOOK to find the text that will be displayed, you are not entering the text itself.

If I'm adding a new wonder to the game, I might have a "Quote" command that looks like this:

Code:
<Quote>TXT_KEY_WONDER_MYNEWWONDER_QUOTE</Quote>
 
Top Bottom