Debugging adding a new unit class

Machiavelli24

Mod creator
Joined
May 9, 2012
Messages
818
[Edit: found and fixed the issue. Nothing to see here.]

In my attempts to learn how to mod Civ 5 I am starting small, adding a new unit class. Unfortunately what I've got doesn't appear to work any I can't figure out why. If anyone can point out where I've made a mistake or where I can find more debugging information I would be grateful. The non-functioning xml is below.

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 5/6/2012 11:13:18 AM -->
<GameData>
  <!-- TODO: Insert table creation example here. -->
 
  <!-- TODO: Insert table data example here.-->
  
  <!-- Enter your Game Data here. -->
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_GRENADIER</Type>
			<Description>TXT_KEY_UNIT_GRENADIER</Description>
			<DefaultUnit>UNIT_GRENADIER</DefaultUnit>
		</Row>
	</UnitClasses>

	<Units>
		<Row>
			<Class>UNITCLASS_GRENADIER</Class>
			<Type>UNIT_GRENADIER</Type>
			<PrereqTech>TECH_CHEMISTRY</PrereqTech>
			<Combat>25</Combat>
			<RangedCombat>25</RangedCombat>
			<Cost>225</Cost>
			<Moves>2</Moves>
			<Range>1</Range>
			<CombatClass>UNITCOMBAT_ARCHER</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_RANGED</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_GRENADIER</Description>
			<Civilopedia>TXT_KEY_CIV5_RENAISSANCE_GRENADIER_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_GRENADIER_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_GRENADIER</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_REPLACEABLE_PARTS</ObsoleteTech>
		<GoodyHutUpgradeUnitClass>UNITCLASS_INFANTRY</GoodyHutUpgradeUnitClass> 
			<AdvancedStartCost>30</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_CHARIOT_ARCHER</UnitArtInfo>
			<UnitFlagIconOffset>12</UnitFlagIconOffset>
			<IconAtlas>UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>12</PortraitIndex>
			<MoveRate>WHEELED</MoveRate>
		</Row>
	</Units>

	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_GRENADIER</UnitType>
			<PromotionTYpe>PROMOTION_ONLY_DEFENSIVE</PromotionTYpe>
		</Row>
	</Unit_FreePromotions>

	<Unit_AIType>
		<Row>
			<UnitType>UNIT_GRENADIER</UnitType>
			<UnitAIType>UNITAI_RANGED</UnitAIType>
		</Row>
	</Unit_AIType>

	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNITCLASS_GRENADIER</UnitType>
			<UnitClassType>UNITCLASS_INFANTRY</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>

	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_GRENADIER</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>5</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_GRENADIER</UnitType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>5</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_GRENADIER</UnitType>
			<FlavorType>FLAVOR_RANGED</FlavorType>
			<Flavor>10</Flavor>
		</Row>
	</Unit_Flavors>
 
	<Language_en_US>
		<Row Tag="TXT_KEY_UNIT_GRENADIER">
			<Text>Grenadier</Text>
		</Row>
		<Row Tag="TXT_KEY_CIV5_RENAISSANCE_GRENADIER_TEXT">
			<Text>Grenadier Civilopedia</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_GRENADIER_STRATEGY">
			<Text>Grenadier Strategy</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_HELP_GRENADIER">
			<Text>Grenadier Help</Text>
		</Row>		
	</Language_en_US>
</GameData>

I've looked at the logs (I'm assuming "database" and "xml" are the most relevant ones) but I don't see anything suspicious in them. "Database" mentions some invalid references to DLC and scenario units but it looks the same as it did without the mod. "xml" seems to look the same as well, the only odd (but I don't think new) thing was a line about "Number of selection sounds doesn't match number of units."

When I use SQLite Manager to look at the database I only ever see the base game (unmodded) info. Even if I have a mod that changes the cost of units that I can see works in game I only see the non-modded cost with SQLite Manager. This makes me think I am looking at the wrong database with the SQLite Manager.

I'm assuming that if this xml worked I would see a grenadier entry in the civipedia when I ran the mod (although it would have the chariot archer icon since I didn't want to deal with art assets yet.

Does anyone see something I missed?
 
Can you cut/paste the output of the database log file . It will normally have an indicator of the type of XML error.

EDIT: Have to also ask, just in case, but have you included the XML file as a part of your mod project file?
 
Back
Top Bottom