View Full Version : Documentation of xml tags for buildings
RobO May 25, 2008, 12:57 AM 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)?
Civ Fuehrer May 25, 2008, 01:56 AM 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.
zappara May 25, 2008, 02:40 AM 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. :)
RobO May 25, 2008, 04:06 AM OK, so CIV4BuildingsSchema.xml contains the schema definition, but few (if any) explanations.
For example, this schema definition
<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
<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
<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?
zappara May 25, 2008, 04:19 AM It compares those text values on the values in the xml file where bonuses are defined in similar way ie. it's like string = string match.
Civ Fuehrer May 25, 2008, 04:46 AM 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.
RobO May 25, 2008, 12:33 PM 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.
Kalimakhus May 25, 2008, 02:18 PM 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.
Cuteunit May 25, 2008, 06:46 PM 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.
Cuteunit May 25, 2008, 06:52 PM 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.
RobO May 25, 2008, 11:04 PM 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.
Cuteunit May 26, 2008, 01:48 AM modular civs are as easy as it comes, I think.
|
|