Unit Creation help would be much appreciated.

XK9Wolfe

Chieftain
Joined
Oct 15, 2015
Messages
12
Guys, I need some help. Normally I would scour the internet before asking anyone for help, so the fact that I’m here means I’m at the end of my rope. You guys are perhaps the most responsive and helpful community forums I’ve been a part of so I’d like to say “thank you” in advanced.
Here's my problem:

Put simply, I’m attempting to add a new unit class into the game and it’s not showing up. However, I’ve used Whoward’s “Modbuilder” for unit creation and that works just fine; the unit shows up in game. But rather than falling back on a tool I’d like to learn to write units myself. I’ve looked over my hand written code and Whoward’s auto-generated code and I don’t see what it is I’m missing. Before you ask, yes, I have OnModActivated for both of these (but not at the same time, obviously; I’ve tested each separately), and VFS set to true. Here’s the code…

My hand written code
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 12/24/2015 6:45:44 PM -->
<GameData>
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_BRONZESWORDSMAN</Type>
			<Description>TXT_KEY_UNIT_BRONZESWORDSMAN</Description>
			<DefaultUnit>UNIT_BRONZESWORDSMAN</DefaultUnit>
		</Row>
	</UnitClasses>
	<Units>
		<Row>
			<Class>UNITCLASS_BRONZESWORDSMAN</Class>
			<Type>UNIT_BRONZESWORDSMAN</Type>
			<Cost>60</Cost>
			<Combat>11</Combat>
			<Moves>2</Moves>
			<CombatLimit>100</CombatLimit>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_BRONZESWORDSMAN</Description>
			<Civilopedia>TXT_KEY_CIV5ANTIQUITY_WARRIOR</Civilopedia>
			<Strategy>TXT_KEY_UNIT_WARRIOR_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_BRONZESWORDSMAN</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_GUNPOWDER</ObsoleteTech>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_SWORDSMAN</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>10</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<Conscription>1</Conscription>
			<UnitArtInfo>ART_DEF_UNIT_SWORDSMAN</UnitArtInfo>
			<IconAtlas>UNIT_ATLAS_1</IconAtlas>
			<UnitFlagIconOffset>3</UnitFlagIconOffset>
			<PortraitIndex>3</PortraitIndex>
		</Row>
	</Units>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
		</Row>
	</Unit_FreePromotions>
	<Unit_AIType>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_ATTACK</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_DEFENSE</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_EXPLORE</UnitAIType>
		</Row>
	</Unit_AIType>
	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitClassType>UNICLASS_SWORDSMAN</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>12</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>8</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_RECON</FlavorType>
			<Flavor>4</Flavor>
		</Row>
	</Unit_Flavors>
	<Language_en_US>
		<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN" />
			<Text>Bronze era swordsman. Requires bronze, weaker than swordsman, better than the warrior/</Text>
		<Row Tag="TXT_KEY_UNIT_HELP_BRONZESWORDSMAN" />
		<Text>You're on your own.</Text>
	</Language_en_US>
</GameData>

Whoward's auto-generated code
Code:
<?xml version="1.0" encoding="UTF-8"?>
<GameData>
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_BRONZESWORDSMAN</Type>
			<Description>TXT_KEY_UNIT_BRONZESWORDSMAN</Description>
			<DefaultUnit>UNIT_BRONZESWORDSMAN</DefaultUnit>
		</Row>
	</UnitClasses>
	<Units>
		<Row>
			<Type>UNIT_BRONZESWORDSMAN</Type>
			<Description>TXT_KEY_UNIT_BRONZESWORDSMAN</Description>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<Class>UNITCLASS_BRONZESWORDSMAN</Class>
			<Cost>90</Cost>
			<HurryCostModifier>1</HurryCostModifier>
			<AdvancedStartCost>10</AdvancedStartCost>
			<FaithCost>90</FaithCost>
			<RequiresFaithPurchaseEnabled>true</RequiresFaithPurchaseEnabled>
			<Combat>11</Combat>
			<Moves>2</Moves>
			<Strategy>TXT_KEY_UNIT_BRONZESWORDSMAN_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_BRONZESWORDSMAN_HELP</Help>
			<Civilopedia>TXT_KEY_UNIT_BRONZESWORDSMAN_PEDIA</Civilopedia>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<ObsoleteTech>TECH_GUNPOWDER</ObsoleteTech>
			<Pillage>true</Pillage>
			<MoveRate>HEAVY_BIPED</MoveRate>
			<Mechanized>false</Mechanized>
			<UnitArtInfo>ART_DEF_UNIT_BRONZESWORDSMAN</UnitArtInfo>
			<UnitFlagAtlas>UNIT_FLAG_ATLAS</UnitFlagAtlas>
			<UnitFlagIconOffset>14</UnitFlagIconOffset>
			<CombatLimit>100</CombatLimit>
			<MilitaryProduction>true</MilitaryProduction>
			<MilitarySupport>true</MilitarySupport>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
		</Row>
	</Units>
	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_ATTACK</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_DEFENSE</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_EXPLORE</UnitAIType>
		</Row>
	</Unit_AITypes>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>4</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>1</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_RECON</FlavorType>
			<Flavor>4</Flavor>
		</Row>
	</Unit_Flavors>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
		</Row>
	</Unit_FreePromotions>
	<ArtDefine_UnitInfos>
		<Row>
			<Type>ART_DEF_UNIT_BRONZESWORDSMAN</Type>
			<DamageStates>1</DamageStates>
			<Formation>DefaultMelee</Formation>
		</Row>
	</ArtDefine_UnitInfos>
	<ArtDefine_UnitInfoMemberInfos>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_BRONZESWORDSMAN</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_SWORDSMAN_V2</UnitMemberInfoType>
			<NumMembers>3</NumMembers>
		</Row>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_BRONZESWORDSMAN</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_SWORDSMAN</UnitMemberInfoType>
			<NumMembers>6</NumMembers>
		</Row>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_BRONZESWORDSMAN</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_SWORDSMAN_V3</UnitMemberInfoType>
			<NumMembers>3</NumMembers>
		</Row>
	</ArtDefine_UnitInfoMemberInfos>
	<UnitGameplay2DScripts>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<SelectionSound>AS2D_SELECT_SWORDSMAN</SelectionSound>
			<FirstSelectionSound>AS2D_BIRTH_SWORDSMAN</FirstSelectionSound>
		</Row>
	</UnitGameplay2DScripts>
	<ArtDefine_StrategicView>
		<Row>
			<StrategicViewType>ART_DEF_UNIT_BRONZESWORDSMAN</StrategicViewType>
			<TileType>Unit</TileType>
			<Asset>SV_Swordsman.dds</Asset>
		</Row>
	</ArtDefine_StrategicView>
	<Language_en_US>
		<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN">
			<Text>BRONZESWORDSMAN</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN_STRATEGY">
			<Text>ASDFASDF</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN_HELP">
			<Text>ASDFASDF</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN_PEDIA">
			<Text>ASDFASDF</Text>
		</Row>
	</Language_en_US>
</GameData>

If it makes any differnce, I was following along with Kael's guide, I'm not sure how up-to-date that is...
 
Guys, I need some help. Normally I would scour the internet before asking anyone for help, so the fact that I’m here means I’m at the end of my rope. You guys are perhaps the most responsive and helpful community forums I’ve been a part of so I’d like to say “thank you” in advanced.
Here's my problem:

Put simply, I’m attempting to add a new unit class into the game and it’s not showing up. However, I’ve used Whoward’s “Modbuilder” for unit creation and that works just fine; the unit shows up in game. But rather than falling back on a tool I’d like to learn to write units myself. I’ve looked over my hand written code and Whoward’s auto-generated code and I don’t see what it is I’m missing. Before you ask, yes, I have OnModActivated for both of these (but not at the same time, obviously; I’ve tested each separately), and VFS set to true. Here’s the code…

My hand written code
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 12/24/2015 6:45:44 PM -->
<GameData>
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_BRONZESWORDSMAN</Type>
			<Description>TXT_KEY_UNIT_BRONZESWORDSMAN</Description>
			<DefaultUnit>UNIT_BRONZESWORDSMAN</DefaultUnit>
		</Row>
	</UnitClasses>
	<Units>
		<Row>
			<Class>UNITCLASS_BRONZESWORDSMAN</Class>
			<Type>UNIT_BRONZESWORDSMAN</Type>
			<Cost>60</Cost>
			<Combat>11</Combat>
			<Moves>2</Moves>
			<CombatLimit>100</CombatLimit>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_BRONZESWORDSMAN</Description>
			<Civilopedia>TXT_KEY_CIV5ANTIQUITY_WARRIOR</Civilopedia>
			<Strategy>TXT_KEY_UNIT_WARRIOR_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_BRONZESWORDSMAN</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_GUNPOWDER</ObsoleteTech>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_SWORDSMAN</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>10</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<Conscription>1</Conscription>
			<UnitArtInfo>ART_DEF_UNIT_SWORDSMAN</UnitArtInfo>
			<IconAtlas>UNIT_ATLAS_1</IconAtlas>
			<UnitFlagIconOffset>3</UnitFlagIconOffset>
			<PortraitIndex>3</PortraitIndex>
		</Row>
	</Units>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
		</Row>
	</Unit_FreePromotions>
	<Unit_AIType>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_ATTACK</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_DEFENSE</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitAIType>UNITAI_EXPLORE</UnitAIType>
		</Row>
	</Unit_AIType>
	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<UnitClassType>[COLOR="red"]UNICLASS_SWORDSMAN[/COLOR]</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>12</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>8</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BRONZESWORDSMAN</UnitType>
			<FlavorType>FLAVOR_RECON</FlavorType>
			<Flavor>4</Flavor>
		</Row>
	</Unit_Flavors>
	<Language_en_US>
		[COLOR="red"]<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN" />
			<Text>Bronze era swordsman. Requires bronze, weaker than swordsman, better than the warrior/</Text>
		<Row Tag="TXT_KEY_UNIT_HELP_BRONZESWORDSMAN" />
		<Text>You're on your own.</Text>[/COLOR]
	</Language_en_US>
</GameData>


If it makes any differnce, I was following along with Kael's guide, I'm not sure how up-to-date that is...
  1. XML files that start with <GameData> as the 1st executable code should not be set as VFS=true
  2. No such unitclass as "UNICLASS_SWORDSMAN". You are missing a "T" in there.
  3. this is making the game dump the entire file where it occurs:
    Code:
    <Language_en_US>
    	[COLOR="red"]<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN" />
    		<Text>Bronze era swordsman. Requires bronze, weaker than swordsman, better than the warrior/</Text>
    	<Row Tag="TXT_KEY_UNIT_HELP_BRONZESWORDSMAN" />
    	<Text>You're on your own.</Text>[/COLOR]
    </Language_en_US>
    Needs to be
    Code:
    <Language_en_US>
    	<Row Tag="TXT_KEY_UNIT_BRONZESWORDSMAN">
    		<Text>Bronze era swordsman. Requires bronze, weaker than swordsman, better than the warrior</Text>
    	</Row>
    	<Row Tag="TXT_KEY_UNIT_HELP_BRONZESWORDSMAN">
    		<Text>You're on your own.</Text>
    	</Row>
    </Language_en_US>
 
Back
Top Bottom