Using <Update> for buildingclass overrides

mrmcduff

Chieftain
Joined
Oct 11, 2010
Messages
8
Hello CivModding Gurus! I've read through Kael's guide and there is one type of XML database update that I'm not clear on doing. I love being able to just update a tiny thing with the <Set attrib="X" /> <Where actortype="BLAH"/> format, but I'm having a hard time figuring out how to use the update attribute to allow an existing civilization to have a new building upgrade.

My goal is to eventually have a fair amount more civilization differences by adding four or five unique buildings and/or units to each civ, but for right now I'm just learning the ropes.

In Civ5Civilizations.XML, the buildingclass overrides are written as follows:

Code:
	<Civilization_BuildingClassOverrides>
	...
		<Row>
			<CivilizationType>CIVILIZATION_ARABIA</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_MARKET</BuildingClassType>
			<BuildingType>BUILDING_BAZAAR</BuildingType>
		</Row>
        ...
        </Civilization_BuildingClassOverrides>

Suppose I wanted to allow America to also have a Bazaar instead of a Market? Can I use updates to do that?

Code:
	<Civilization_BuildingClassOverrides>
                <Update>
                        <Set BuildingType="BUILDING_BAZAAR">
                        <Where CivilizationType="CIVILIZATION_AMERICA" BuildingClass="BUILDINGCLASS_MARKET">
                </Update>
	</Civilization_BuildingClassOverrides>

This doesn't seem to look quite right, and I'm getting rather funny results. Is there a preferred way to do this?

-- edit -- Verified that this type of "updating" doesn't work. Any hints for a minimalist modder?

Thanks!
 
Ok, I've only been playing around with ModBuddy for a day, and being pretty new to all of this myself, but I think you wouldn't want to use <update> at all here. Since you're adding something, just use <row>.

Code:
        <Civilization_BuildingClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_MARKET</BuildingClassType>
			<BuildingType>BUILDING_BAZAAR</BuildingType>
		</Row>
        </Civilization_BuildingClassOverrides>

This is only a guess though, I'm not sure. And my girlfriend is behind me telling me to get off the computer, so go try it yourself ;) Let me know how it works!
 
You can only <Update><Where><Set> something if an entry already exists (modifying the existing entry).
But if you are trying to implement something that has no existing match for the <Where> parameters then you need to use the <Row> method (adding an entirely new entry).
 
You can only <Update><Where><Set> something if an entry already exists (modifying the existing entry).
But if you are trying to implement something that has no existing match for the <Where> parameters then you need to use the <Row> method (adding an entirely new entry).
Cyberchrist is right. And since America has 2 Unique Units and no Unique Building by default, there are no Civilization_BuildingClassOverrides for America.
 
I used exactly that code above and nothing happened. I'm also not capable of adding traits or free units to anyone (I wanted to start everyone with scouts to see how that would affect the beginning of the game).

The following is my code to just update America, but I wanted to duplicate it for other civs. I'm sure I'm properly adding the file, since my "updates" do get reflected in the game.

Code:
<GameData>
	<Civilization_BuildingClassOverrides>
                <!-- First, try out overriding a building class. -->
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_LIBRARY</BuildingClassType>
			<BuildingType>BUILDING_PAPER_MAKER</BuildingType>
		</Row>
	</Civilization_BuildingClassOverrides>

        <!-- Now try overriding a unit class. -->
	<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<UnitClass>UNITCLASS_CROSSBOWMAN</UnitClass>
			<UnitType>UNIT_CHINESE_CHUKONU</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>
        
        <!-- Now let's give away a free unit. -->
	<Civilization_FreeUnits>
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<UnitClassType>UNITCLASS_SCOUT</UnitClassType>
			<Count>1</Count>
			<UnitAIType>UNITAI_EXPLORE</UnitAIType>
		</Row>
	</Civilization_FreeUnits>
  </GameData>

Also, is a leader only allowed to have one trait? I'd like to toy around with adding tons of traits, so I'm starting with America (because they're the ones I'm kicking around to learn the ropes).

Code:
<GameData>
	<Traits>
		<Row>
			<Type>TRAIT_GUNPOWDER_EFFICIENCY</Type>
			<Description>TXT_KEY_TRAIT_GUNPOWDER_EFFICIENCY</Description>
			<ShortDescription>TXT_KEY_TRAIT_GUNPOWDER_EFFICIENCY_SHORT</ShortDescription>
		</Row>
	</Traits>

	<Trait_FreePromotionUnitCombats>
		<Row>
			<TraitType>TRAIT_GUNPOWDER_EFFICIENCY</TraitType>
			<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
			<PromotionType>PROMOTION_SECOND_ATTACK</PromotionType>
		</Row>
	</Trait_FreePromotionUnitCombats>
  
</GameData>

According to the mod guide, I've created a new trait. I already added the text in a separate file. To add it to America, I did the following:

Code:
<GameData>
	<Leader_Traits>
		<Row>
			<LeaderType>LEADER_WASHINGTON</LeaderType>
			<TraitType>TRAIT_GUNPOWDER_EFFICIENCY</TraitType>
		</Row>
        </Leader_Traits>
</GameData>
 
Back
Top Bottom