Documentation of xml tags for buildings

RobO

King
Joined
Jan 3, 2001
Messages
836
Location
Slangerup, Denmark
I can see from CuteUnit's changes that CIV4BuildingInfos.xml is the file I'd need to work with to change the buildings (in case I find the time). But this file has a ton of xml tags, and they aren't all obvious. And there may be ways to do things (like give one happy face for the precense of either gold, gems or silver, not one for each) that aren't obvious either. Is there a document describing how these xml tags work?

Or other tags for that matter (units, resources, whatnot)?
 
my guess is that the infos.txt is the tags and what values go into them, the schemas are what define the tags and the order they are in, while either python or sdk (not into those, so idk which is for what) defines what the tags do, and is the guts of the code that you can create new tags.
 
check: http://forums.civfanatics.com/showthread.php?t=236836

Schema files define what tags xml files have, you can't add new tags to schemas unless you also add them to SDK files which means you need custom built DLL. But you can use all those tags that are defined in schemas by default. :)
 
OK, so CIV4BuildingsSchema.xml contains the schema definition, but few (if any) explanations.

For example, this schema definition
Code:
<ElementType name="BonusHappinessChange" content="eltOnly">
	<element type="BonusType"/>
	<element type="iHappinessChange"/>
</ElementType>
<ElementType name="BonusHappinessChanges" content="eltOnly">
	<element type="BonusHappinessChange" minOccurs="0" maxOccurs="*"/>
</ElementType>
is used as
Code:
<BonusHappinessChanges>
	<BonusHappinessChange>
		<BonusType>BONUS_GEMS</BonusType>
		<iHappinessChange>1</iHappinessChange>
	</BonusHappinessChange>
	<BonusHappinessChange>
		<BonusType>BONUS_GOLD</BonusType>
		<iHappinessChange>1</iHappinessChange>
	</BonusHappinessChange>
	<BonusHappinessChange>
		<BonusType>BONUS_SILVER</BonusType>
		<iHappinessChange>1</iHappinessChange>
	</BonusHappinessChange>
</BonusHappinessChanges>
in the definition of the properties of the Jewellery.

I get the drift - BonusHappinessChanges contains 0 or more of BonusHappinessChange and this is defined previously.

Now, Bonustype and iHappinessChange are defined as
Code:
<ElementType name="BonusType" content="textOnly"/>
<ElementType name="iHappinessChange" content="textOnly" dt:type="int"/>
The latter is an integer, obviously, but how does it know how to interpret a BonusType when it gets a text?

Is there an explanation of the intricacies of the schema definitions somewhere?
 
then it takes that string match, and checks with the python (or SDK, im not sure) and sees how to apply it to the game.
 
then it takes that string match, and checks with the python (or SDK, im not sure) and sees how to apply it to the game.
Yes, BONUS_GEMS (for example) has to be defined somewhere as a valid BonusType. I've written compilers myself a long time ago.

Who knows, there might be a bonus type categorisation, or the possibility of making one, e.g. defining Gold, Gems or Silver as a specific bonus type.

I guess it's a matter of experimentation and looking for examples.
 
I can see from CuteUnit's changes that CIV4BuildingInfos.xml is the file I'd need to work with to change the buildings (in case I find the time). But this file has a ton of xml tags, and they aren't all obvious. And there may be ways to do things (like give one happy face for the precense of either gold, gems or silver, not one for each) that aren't obvious either. Is there a document describing how these xml tags work?

Or other tags for that matter (units, resources, whatnot)?

There is actually a way to make the building give only one happy face if either of the three or more resources are present. You just make the building gives 1 happy face on its own and make it require either of the resources. The building won't be built unless one of the resources is there and it will only give one happy face rather than one for each resource.

On the other side, reading through schema files might be educational but I doubt it may help explain what an xml tag actually does. Schema files govern the formal structure of xml files regardless the purpose of actual values that tags in these files may have.

There used to be a Civ4 Wiki with a section for modding reference. Some good information were there for xml tags. Unfortunately AFAIK the wiki has been down since a long time and up till now.
 
learn by reverse engineering. You know that the Pyramids normally build faster with Stone, so look in the XML at the pyramids junk in between <buildinginfo> </buildinginfo> for the mention of BONUS_STONE and you will see what script section determines building faster with bonuses.
 
If the amount of jibberjabber in the base files is overwhelming try look at modular civilizations; there are many for download and I posted a denmark one in this forum. those files are much smaller, containing infos for only a few things rather than everything.
 
There is actually a way to make the building give only one happy face if either of the three or more resources are present. You just make the building gives 1 happy face on its own and make it require either of the resources. The building won't be built unless one of the resources is there and it will only give one happy face rather than one for each resource.
Kalimakhus, you're a genius :king:
Thinking of the obvious is sometime very difficult.

Cuteunit, I can certainly find my way through the different examples. I was just looking for something easier.
 
Top Bottom