Unique Units Unlocked for all Civs

P-Dubya

Chieftain
Joined
Mar 24, 2010
Messages
60
Does anyone know if and how it is possible to make unique, civ-specific units available for production for all civilizations? I recently made a modded scenario set in the 13th century, and to add flavor I want all Civs to have a few more options for siege units, such as the Battering Ram and Siege Tower.

In trying to figure this out on my own, the best I've been able to do is use XML code that does allow me to give Battering Ram production to most civs, but some civs such as Mongolia still won't build Battering Rams despite the fact that the code works for most other civs. The pile of coding I used is provided below:

Spoiler :
<Civilization_UnitClassOverrides>
<Row>
<CivilizationType>CIVILIZATION_MOROCCO</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_SONGHAI</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_GERMANY</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_POLAND</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_RUSSIA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_PERSIA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_ENGLAND</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_INDIA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_MONGOLIA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_SWEDEN</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_ETHIOPIA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_DENMARK</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_ARABIA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_SPAIN</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_FRANCE</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_JAPAN</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_EGYPT</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_SIAM</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_KOREA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_BYZANTIUM</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_CHINA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
<Row>
<CivilizationType>CIVILIZATION_CHINA</CivilizationType>
<UnitClassType>UNITCLASS_SPEARMAN</UnitClassType>
<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
</Row>
</Civilization_UnitClassOverrides>


I can't help but to think that there's a much easier or at least a less sloppy way to accomplish this. Thanks in advance for any help you can give. I'll be happy to provide more information if needed.
 
Try this Code:
Spoiler :
Code:
<GameData>
	<Civilization_UnitClassOverrides>
		<Delete UnitType="UNIT_HUN_BATTERING_RAM" />
		<Row>
			<CivilizationType>CIVILIZATION_HUNS</CivilizationType>
			<UnitClassType>UNITCLASS_BATTERING_RAM</UnitClassType>
			<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_BATTERING_RAM</Type>
			<DefaultUnit>UNIT_BATTERING_RAM</DefaultUnit>
			<Description>TXT_KEY_UNIT_HUN_BATTERING_RAM</Description>
		</Row>
	</UnitClasses>
	<Units>
		<Replace>
			<Class>UNITCLASS_BATTERING_RAM</Class>
			<Type>UNIT_BATTERING_RAM</Type>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<Combat>10</Combat>
			<Cost>75</Cost>
			<FaithCost>150</FaithCost>
			<RequiresFaithPurchaseEnabled>true</RequiresFaithPurchaseEnabled>
			<Moves>2</Moves>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_CITY_BOMBARD</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_HUN_BATTERING_RAM</Description>
			<Civilopedia>TXT_KEY_CIV5_HUN_BATTERING_RAM_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_HUN_BATTERING_RAM_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_HUN_BATTERING_RAM</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_PHYSICS</ObsoleteTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_TREBUCHET</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>15</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_U_HUNS_BATTERING_RAM</UnitArtInfo>
			<UnitFlagAtlas>EXPANSION_UNIT_FLAG_ATLAS</UnitFlagAtlas>
			<UnitFlagIconOffset>2</UnitFlagIconOffset>
			<IconAtlas>EXPANSION_UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>2</PortraitIndex>
		</Replace>
		<Replace>
			<Class>UNITCLASS_BATTERING_RAM</Class>
			<Type>UNIT_HUN_BATTERING_RAM</Type>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<Combat>12</Combat>
			<Cost>75</Cost>
			<FaithCost>150</FaithCost>
			<RequiresFaithPurchaseEnabled>true</RequiresFaithPurchaseEnabled>
			<Moves>2</Moves>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_CITY_BOMBARD</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_HUN_BATTERING_RAM</Description>
			<Civilopedia>TXT_KEY_CIV5_HUN_BATTERING_RAM_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_HUN_BATTERING_RAM_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_HUN_BATTERING_RAM</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_PHYSICS</ObsoleteTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_TREBUCHET</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>15</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_U_HUNS_BATTERING_RAM</UnitArtInfo>
			<UnitFlagAtlas>EXPANSION_UNIT_FLAG_ATLAS</UnitFlagAtlas>
			<UnitFlagIconOffset>2</UnitFlagIconOffset>
			<IconAtlas>EXPANSION_UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>2</PortraitIndex>
		</Replace>
	</Units>
	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<UnitAIType>UNITAI_CITY_BOMBARD</UnitAIType>
		</Row>
	</Unit_AITypes>
	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<UnitClassType>UNITCLASS_TREBUCHET</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>20</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<FlavorType>FLAVOR_RANGED</FlavorType>
			<Flavor>5</Flavor>
		</Row>
	</Unit_Flavors>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_CITY_ASSAULT</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_NO_DEFENSIVE_BONUSES</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_DEFENSE_PENALTY</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_SIGHT_PENALTY</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_COVER_1</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_ONLY_ATTACKS_CITIES</PromotionType>
		</Row>
	</Unit_FreePromotions>
</GameData>
  1. Creates a new class of unit called the "Battering Ram", and gives it a default unit which is a direct copy of the Hun Battering Ram
  2. Moves the Hun Battering Ram to this new "Battering Ram" class of units, and makes it a unique for the Huns within this class of units
  3. Makes the Hun Battering Ram slighlty more powerful than the Battering Ram other nations get to construct.
  4. Uses all the existing info from the Hun Battering Ram for Icons, Unit Animations, Text Displayed In-Game. So you will see two units in the Civilopedia whose unit-names etc., will look identical, but the combat power will be higher for the one the Huns can use.
  5. I did not disable Barbarians from using the new unit-class, so if Barbs are part of your scenario, you might see Barbarian Battering Rams wandering the map.
  6. A player would have to have at least G&K because the Hun Battering Ram and its unit-art and icons are part of G&K.
You would need to do a similar thing for other uniques you would like to make available to other civilizations.
 
In trying to figure this out on my own, the best I've been able to do is use XML code that does allow me to give Battering Ram production to most civs, but some civs such as Mongolia still won't build Battering Rams despite the fact that the code works for most other civs. The pile of coding I used is provided below:

That's because Mongolia is CIVILIZATION_MONGOL, not CIVILIZATION_MONGOLIA.

This civ by ViceVirtuoso can build any Unique Unit; it's possible you could alter it to allow certain UUs to be buildable by anyone instead.
 
Try this Code:
Spoiler :
Code:
<GameData>
	<Civilization_UnitClassOverrides>
		<Delete UnitType="UNIT_HUN_BATTERING_RAM" />
		<Row>
			<CivilizationType>CIVILIZATION_HUNS</CivilizationType>
			<UnitClassType>UNITCLASS_BATTERING_RAM</UnitClassType>
			<UnitType>UNIT_HUN_BATTERING_RAM</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_BATTERING_RAM</Type>
			<DefaultUnit>UNIT_BATTERING_RAM</DefaultUnit>
			<Description>TXT_KEY_UNIT_HUN_BATTERING_RAM</Description>
		</Row>
	</UnitClasses>
	<Units>
		<Replace>
			<Class>UNITCLASS_BATTERING_RAM</Class>
			<Type>UNIT_BATTERING_RAM</Type>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<Combat>10</Combat>
			<Cost>75</Cost>
			<FaithCost>150</FaithCost>
			<RequiresFaithPurchaseEnabled>true</RequiresFaithPurchaseEnabled>
			<Moves>2</Moves>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_CITY_BOMBARD</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_HUN_BATTERING_RAM</Description>
			<Civilopedia>TXT_KEY_CIV5_HUN_BATTERING_RAM_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_HUN_BATTERING_RAM_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_HUN_BATTERING_RAM</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_PHYSICS</ObsoleteTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_TREBUCHET</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>15</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_U_HUNS_BATTERING_RAM</UnitArtInfo>
			<UnitFlagAtlas>EXPANSION_UNIT_FLAG_ATLAS</UnitFlagAtlas>
			<UnitFlagIconOffset>2</UnitFlagIconOffset>
			<IconAtlas>EXPANSION_UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>2</PortraitIndex>
		</Replace>
		<Replace>
			<Class>UNITCLASS_BATTERING_RAM</Class>
			<Type>UNIT_HUN_BATTERING_RAM</Type>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<Combat>12</Combat>
			<Cost>75</Cost>
			<FaithCost>150</FaithCost>
			<RequiresFaithPurchaseEnabled>true</RequiresFaithPurchaseEnabled>
			<Moves>2</Moves>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_CITY_BOMBARD</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_HUN_BATTERING_RAM</Description>
			<Civilopedia>TXT_KEY_CIV5_HUN_BATTERING_RAM_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_HUN_BATTERING_RAM_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_HUN_BATTERING_RAM</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_PHYSICS</ObsoleteTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_TREBUCHET</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>15</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_U_HUNS_BATTERING_RAM</UnitArtInfo>
			<UnitFlagAtlas>EXPANSION_UNIT_FLAG_ATLAS</UnitFlagAtlas>
			<UnitFlagIconOffset>2</UnitFlagIconOffset>
			<IconAtlas>EXPANSION_UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>2</PortraitIndex>
		</Replace>
	</Units>
	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<UnitAIType>UNITAI_CITY_BOMBARD</UnitAIType>
		</Row>
	</Unit_AITypes>
	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<UnitClassType>UNITCLASS_TREBUCHET</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>20</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<FlavorType>FLAVOR_RANGED</FlavorType>
			<Flavor>5</Flavor>
		</Row>
	</Unit_Flavors>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_CITY_ASSAULT</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_NO_DEFENSIVE_BONUSES</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_DEFENSE_PENALTY</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_SIGHT_PENALTY</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_COVER_1</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_BATTERING_RAM</UnitType>
			<PromotionType>PROMOTION_ONLY_ATTACKS_CITIES</PromotionType>
		</Row>
	</Unit_FreePromotions>
</GameData>
  1. Creates a new class of unit called the "Battering Ram", and gives it a default unit which is a direct copy of the Hun Battering Ram
  2. Moves the Hun Battering Ram to this new "Bettering Ram" class of units, and makes it a unique for the Huns within this class of units
  3. Makes the Hun Battering Ram slighlty more powerful than the Battering Ram other nations get to construct.
  4. Uses all the existing info from the Hun Battering Ram for Icons, Unit Animations, Text Displayed In-Game. Go you will see two units in the Civilopedia whose unit-names etc., will look identical, but the combat power will be higher for the one the Huns can use.
  5. I did not disable Barbarians from using the new unit-class, so if Barbs are part of your scenario, you might see Barbarian Battering Rams wandering the map.
  6. A player would have to have at least G&K because the Hun Battering Ram and its unit-art and icons are part of G&K.
You would need to do a similar thing for other uniques you would like to make available to other civilizations.

Thank you very much for this. It'll teach me a lot (I'm new to coding). Barbs having rams won't be an issue since I left them out of the scenario I made.


That looks like a pretty awesome mod. Very clever way to give all civs a way to get unique units. But I lack some sort of DLC to use it. I'll get the DLC soon though and try it out. Thanks!

That's because Mongolia is CIVILIZATION_MONGOL, not CIVILIZATION_MONGOLIA.

This civ by ViceVirtuoso can build any Unique Unit; it's possible you could alter it to allow certain UUs to be buildable by anyone instead.

I feel so dumb not noticing I got the civ name wrong, of all things :lol: Thanks for pointing that out for me, and for the link you provided. I'll be sure to check out the coding for those files, too.


Thanks to everyone for your prompt help :)
 
That looks like a pretty awesome mod. Very clever way to give all civs a way to get unique units. But I lack some sort of DLC to use it.

It requires BNW not a DLC. Are you saying you have BNW but can not use that mod?
 
Back
Top Bottom