BuildingInfos - Continued
Pass 2: Adding our New Values
If we recall from the OP, we want these values
Town Well
Cost: 50
Health: +1
Requires: Pottery, Masonry
Obsolete: Invention
Special Abilities
- 5% Maintenance
- +1 Health with Public Works.
- Double production speed for Agricultural leaders.
- Upgraded by Artesian Well
- Provides Fresh Water
We already have the cost changed.
Next, to add the +1 health. Let's assume you have no idea what the tags do. In the
Modiki, look up the tag for health.
If you look, it's called "iHealth". This tells us it takes integer values. Change the value to 1. This will make the building give +1 health to the city that builds it.
Next Up, The Prerequisite Technologies.
Technologies are a bit confusing. Firaxis gives us a list, and a single tech tag. Since we have 2 technology prerequisites, we will need to use both. The single tech tag is used to show which technology on the Tech tree unlocks the building, the list is used to list the total techs required.
If we think, Masonry generally comes after Pottery, so listing the single tag with Masonry makes more sense. So we go to the <PrereqTech> tag. But what do we put in it? We could guess, and get it wrong. So, this is where our searching skills come in handy.
Looking Up Technologies
Go back to the Rise of Mankind/Assets/XML folder. Find the Technologies folder. Open the Civ4TechInfos. Now we have a massive list of all the technology information. Fortuantly, we are only looking for two names. It's best to first look for obvious matches. Open up the Search Field (CONTROL-F) and type in "Masonry".
We're in luck, we score a
"TECH_MASONRY" hit right away. Copy that name, and head back to the BuildingInfos.
Change this
Code:
<PrereqTech>NONE</PrereqTech>
to this
Code:
<PrereqTech>TECH_MASONRY</PrereqTech>
Great, now we have Masonry as a prequsite. Now, since this tag only holds one name, we need to add one in the list, located right below this tag, indicated by this name:
Dang. Another roadblock. The Forward slash at the end of the name means that this is a
CLOSED list. It has no values in it. We need to open it first to add values.
Opening the List:
Now, if you've noticed other
OPEN lists, like the YieldChanges, we noticed that the starting tag had no forward slash in it, it meant that it was the start of the list. So we copy the <TechTypes/> tag and remove the forward slash, so it looks like this: <TechTypes>. Now, the YieldChanges tag end is marked by a forward slash at the beginning of the word, so change the second tag to look like this:
</TechTypes>.
When you are done, it should look like this:
Great, we opened the list for new values. Copy and paste the Masony Prereq tag inside of the list, and indent it once. The indent doesn't matter, but it makes it conform to standard programming style, improving readability. So now, it should look like this:
Code:
<TechTypes>
<PrereqTech>TECH_MASONRY</PrereqTech>
</TechTypes/>
This is where Notepad++ is handy, because of color coding end and start tags. A properly created tag will show the start and stop, while an wrong tag will not:
Right:
Wrong:
Great, now we need to find the name of pottery. Back in the Civ4TechInfos, search (CONTROL-F) for "Pottery". We're in luck again,
TECH_POTTERY is the correct name. Update the list with the correct tech.
Now, for the Obsolete Tech. Use your Searching Skillz again to look up the tech name for Invention.
(Warning: This one is NOT Easy. This is what I was talking about when I said programmers got lazy and didn't update tags.)
Try finding it out on your own. Seriously. If all else fails, scroll to the bottom and cheat and look at the answer. But you should be able to find it. (Hint: Look at the techs that require Invention to be researched for a clue)
Simply Change NONE in the Obsolete Tag into the name you find.
Now for the maintenance costs. Looking up in the Modiki for maintenance, we find the tag is called <iMaintenanceModifier>. Change the value to 5.
I'm skipping the Civic Health change for now, we'll come back to that near the end.
Next up is the double production for Agricultural Leaders. Looking up the tag for production changes, we find it's called <ProductionTraits>.
Unfortuanty, this is another closed tag. We open it up like the last one. Now, what to put inside it? This time, it's not as easy to copy and paste the tag above it. It's nearly impossible to guess right. The easiest way to find out it to open up the main BuildingInfos.xml in the RoM XML folder. Then, search for "<ProductionTraits>", so we can see it used on another building.
A quick search reveals this for the walls:
Code:
<ProductionTraits>
[COLOR="Cyan"]<ProductionTrait>
<ProductionTraitType>TRAIT_PROTECTIVE</ProductionTraitType>
<iProductionTrait>100</iProductionTrait>
</ProductionTrait>[/COLOR]
</ProductionTraits>
Perfect. Copy and paste the middle section (indicated by the light blue area) into your nearly opened tag.
Now, another condudrum. What is the XML name for "Agricultural"? Time to use our vast searching skills again.

Find the Civ4TraitInfos in the XML/Civilizations folder. Open it up and search for anything that matches Agricultural. Luckily, it's named sensibly;
TRAIT_AGRICULTURAL.
Replace the protective trait with TRAIT_AGRICULTURAL. Now, double production is indicated by a 100 value in the <iProductionTrait> tag. (zero means no production speed increase).
Uncharted Waters Ahead!:
Now, the next two features are not Civ4 BTS normal tags, we are heading into new and uncharted territory. It's easiest to add these by example. I have an example package where I show all my new tags in one convenient place. You can
download it here. Unarchive it, and open the Example_Civ4BuildingInfos. If you scroll down a bit, you'll see a comment that marks the start of my changes.
The change you are looking for first is the "ReplaceBuildings" tag, this code:
Code:
<ReplaceBuildings>
<ReplaceBuilding>
<BuildingClassType>BUILDINGCLASS_KNIGHT_STABLE</BuildingClassType>
<bReplace>1</bReplace>
</ReplaceBuilding>
</ReplaceBuildings>
This tag lists all the possible building classes that this building upgrades to. Copy this section of code into the very bottom section of the building information, the line after this one:
Code:
<iHotKeyPriority>0</iHotKeyPriority>
Notes about lists:
You can list as many building classes to upgrade this one as you want, because this is a list. Integer tags only can hold one value, but list can hold as many as you need. They are much more useful in that respect.
Our spec's call for an upgrade to the Artesian Well, but we will actually need 2 upgrades. The Artesian Well is upgraded by the Cannery, and if we don't make the Cannery a possible upgrade as well, players could use this as an exploit, and get a town well and Cannery.
Note: Note that the inner tag is asking for a
BUILDINGCLASSTYPE, not a
BUILDINGTYPE. Putting a building name instead of a Building Class name will cause very strange things to happen.
Using your search-fu skills, look up the BuildingClass name in the Civ4BuildingClassInfo, you will find the artesian well is named:
BUILDINGCLASS_ARTESIAN_WELL. Replace the Knight Stable entry with that.
Adding a second entry is easy, once you have the first. Copy the inner information, to list for a second building, so it should look like this:
Code:
<ReplaceBuildings>
[COLOR="Cyan"]<ReplaceBuilding>
<BuildingClassType>BUILDINGCLASS_ARTESIAN_WELL</BuildingClassType>
<bReplace>1</bReplace>
</ReplaceBuilding>[/COLOR]
[COLOR="SandyBrown"]<ReplaceBuilding>
<BuildingClassType>BUILDINGCLASS_ARTESIAN_WELL</BuildingClassType>
<bReplace>1</bReplace>
</ReplaceBuilding>[/COLOR]
</ReplaceBuildings>
Now, using your search skills again, find out that the name of the Building Class of the Cannery is called the
BUILDINGCLASS_CANNERY. Replace the second entry with that name.
SideNote:
The <bReplace> tag simply indicates that this is true that the building class replaces this one. All non-listed building classes are defaulted to false.
The Last Tag (Kinda):
The last tag needs to provide the surrounding tiles with fresh water. Luckily this is an easy one, copied right from my Example_Civ4BuildingInfos
Code:
<bProvidesFreshWater>0</bProvidesFreshWater>
Copy this below the ReplaceBuildings code, and set the value to true (1).
And Another Thing...:
Because we are using tags created by A New Dawn, we need to update our buildings schema. The one included in the
Example Folder is layed out to include information for the new tags. Without it, the game will be unable to parse the new information. Updating the Schema is an easy 2 step process:
1.) Copy the Example_CIV4BuildingsSchema into your working folder.
2.) In the header of the files with the new tag (In our case, just the Civ4BuildingInfos), where it says this:
Code:
<Civ4BuildingInfos xmlns="x-schema:[COLOR="Green"]CIV4BuildingsSchema[/COLOR].xml">
Change the name of the schema to the one you just copied over.
Final Review:
When you think you've done this all correctly, compare this against my copy so far.