New Mod Isn't Taking Effect

crashburn274

Chieftain
Joined
Nov 13, 2011
Messages
10
This is my first attempt at creating a mod and most of "my" code is copy-pasted from either Kale's guide or the game XML. I'm running G&K because I never bought the other expansions. This mod is supposed to create a new unit called the Dreadnaught which, presently, uses the Battleship's icon, animations, ect. Yesterday it loaded but crashed the game whenever the unit tried to bombard, and today the unit doesn't exist in the build menu or tech tree. I don't know what changed.
I have the OnModActivated set up, and when I pressed Build it reports "1 succeeded,"

Unit Art File
Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 11/10/2014 1:05:20 AM -->
<GameData>
<Language_en_US>
<Row Tag="TXT_KEY_UNIT_DREADNAUGHT">
<Text>Dreadnaught</Text>
</Row>
<Row Tag="TXT_KEY_CIVILOPEDIA_UNITS_DREADNAUGHT_TEXT">
<Text>The Dreadnaught unit is named after the HMS Dreadnaught, a vessel which made every earlier battleship instantly obsolete with it's all-big-gun design and considerable improvements in engine and armament. Rather than accurately recreating the historical vessel, this unit class represents world war one era battleships in general. Earlier ironclad battleships are better represented by the Ironclad unit, and advances in aiming computers made perhaps the greatest contribution to the improvement of naval battleships between the first and second world wars, so the relevent technologies are reasonable. This unit's statistics are chosen for game balance, however, and don't represent any particular historical reality. The Dreadnaught unit has the same range as the frigate, but starts with the indirect fire promotion. It's movement rate is the same as the ironclad, which it's intended to operate alongside (and against), and its armor and firepower are sufficient to send wooden-hulled navies to the bottom</Text>
</Row>
<Row Tag="TXT_KEY_UNIT_DREADNAUGHT_STRATEGY">
<Text>The Dreadnaught replaces the obsolete Frigate. With its heavy armor and powerful armament, use the dreadnaught to sweep wooden navies from the seas.</Text>
</Row>
<Row Tag="TXT_KEY_UNIT_HELP_DREADNAUGHT">
<Text>The Dreadnaught is a naval ranged unit with heavier armor and armament than the frigate and the indirect fire promotion, though it is slower.</Text>
</Row>
</Language_en_US>
</GameData>


and game data file
Spoiler :

<!-- Created by ModBuddy on 11/8/2014 2:18:27 AM -->
<GameData>
<UnitClasses>
<Row>
<Type>UNITCLASS_DREADNAUGHT</Type>
<Description>TXT_KEY_UNIT_DREADNAUGHT</Description>
<DefaultUnit>UNIT_DREADNAUGHT</DefaultUnit>
</Row>
</UnitClasses>
<Units>
<Row>
<Class>UNITCLASS_DREADNAUGHT</Class>
<Type>UNIT_DREADNAUGHT</Type>
<PrereqTech>TECH_ELECTRICITY</PrereqTech>
<Combat>45</Combat>
<RangedCombat>35</RangedCombat>
<Cost>250</Cost>
<Moves>4</Moves>
<Range>2</Range>
<CombatClass>UNITCOMBAT_NAVAL</CombatClass>
<Domain>DOMAIN_SEA</Domain>
<DefaultUnitAI>UNITAI_ATTACK_SEA</DefaultUnitAI>
<Description>TXT_KEY_UNIT_DREADNAUGHT</Description>
<Civilopedia>TXT_KEY_CIVILOPEDIA_UNITS_DREADNAUGHT_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_DREADNAUGHT_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_DREADNAUGHT</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>true</Pillage>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<Mechanized>true</Mechanized>
<AdvancedStartCost>60</AdvancedStartCost>
<MinAreaSize>20</MinAreaSize>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_BATTLESHIP</UnitArtInfo>
<UnitFlagIconOffset>68</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_2</IconAtlas>
<PortraitIndex>21</PortraitIndex>
<MoveRate>BOAT</MoveRate>
</Row>
</Units>

<Unit_AITypes>
<Row>
<UnitType>UNIT_BATTLESHIP</UnitType>
<UnitAIType>UNITAI_ATTACK_SEA</UnitAIType>
</Row>
<Row>
<UnitType>UNIT_BATTLESHIP</UnitType>
<UnitAIType>UNITAI_RESERVE_SEA</UnitAIType>
</Row>
</Unit_AITypes>


<Unit_FreePromotions>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<PromotionType>PROMOTION_INDIRECT_FIRE</PromotionType>
</Row>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<PromotionType>PROMOTION_ONLY_DEFENSIVE</PromotionType>
</Row>
<!-- <Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<PromotionType>PROMOTION_OCEAN_IMPASSABLE</PromotionType>
</Row> -->
</Unit_FreePromotions>


<Unit_ClassUpgrades>
<Update>
<Where UnitType="UNIT_FRIGATE"/>
<SET UnitClassType="UNIT_DREADNAUGHT"/>
</Update>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<UnitClassType>UNITCLASS_BATTLESHIP</UnitClassType>
</Row>
</Unit_ClassUpgrades>

<Unit_Flavors>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<FlavorType>FLAVOR_OFFENSE</FlavorType>
<Flavor>9</Flavor>
</Row>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<FlavorType>FLAVOR_DEFENSE</FlavorType>
<Flavor>9</Flavor>
</Row>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<FlavorType>FLAVOR_NAVAL</FlavorType>
<Flavor>9</Flavor>
</Row>
</Unit_Flavors>

<Unit_ResourceQuantityRequirements>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<ResourceType>RESOURCE_COAL</ResourceType>
</Row>
</Unit_ResourceQuantityRequirements>


</GameData>
 
Are you sure it's supposed to have PROMOTION_ONLY_DEFENSIVE? I can't find a unit that has that promotion in the base game. Not even the Carrier.

The Modbuddy project basically only catches syntax errors in xml, sql, or lua files, and even then isn't very smart on that point. It can't tell you if anything is "wrong" with your logic.
 
Are you sure it's supposed to have PROMOTION_ONLY_DEFENSIVE? I can't find a unit that has that promotion in the base game. Not even the Carrier.

The Modbuddy project basically only catches syntax errors in xml, sql, or lua files, and even then isn't very smart on that point. It can't tell you if anything is "wrong" with your logic.

IIRC all range units have the PROMOTION_ONLY_DEFENSIVE....
 
Thanks for responding!
I'm sure PROMOTION_ONLY_DEFENSIVE is part of the base game, I copied it from the CIV5UNITS.xml file where the Battleship has it.

Actually, there's something I don't understand. All the naval units in that file have the promotion. I think it's from the original game and the expansion packs and DLC must modify it, but I haven't been able to find the code for Gods&Kings or any other DLC. They must be somewhere, since the game runs them, but... What's the standard install directory for DLC content?
 
Like i said all range units have this promotion, and its part of Civ, its defines if a range unit is able to counter attack or not, if it was attacked by another unit.

PS. For the DLCS

Steam...../Civ/Assests/DLC
 
The game really does not like information it already has:
Code:
<Unit_AITypes>
<Row>
<UnitType>UNIT_BATTLESHIP</UnitType>
<UnitAIType>UNITAI_ATTACK_SEA</UnitAIType>
</Row>
<Row>
<UnitType>UNIT_BATTLESHIP</UnitType>
<UnitAIType>UNITAI_RESERVE_SEA</UnitAIType>
</Row>
</Unit_AITypes>
Capitalization is important in XML. "SET" is not the same as "Set". And you need to specify the Class of unit for UnitClassType instead of the unit name:
Code:
<Unit_ClassUpgrades>
<Update>
<Where UnitType="UNIT_FRIGATE"/>
<[COLOR="Red"]SET[/COLOR] UnitClassType="[COLOR="Red"]UNIT_DREADNAUGHT[/COLOR]"/>
</Update>
<Row>
<UnitType>UNIT_DREADNAUGHT</UnitType>
<UnitClassType>UNITCLASS_BATTLESHIP</UnitClassType>
</Row>
</Unit_ClassUpgrades>
 
Thank you, LeeS, that explains what happened. The mod exists again.

Anyone have ideas why the combat animation kills it? How is animation defined, and what am I missing? I've seen several tutorials for importing graphics, but I would like to mod to be functional with the existing graphics before trying to learn that part.
 
A quick look through the units file supplied by Firaxis shows that there is no UNITCOMBAT_NAVAL for <CombatClass>. Naval ships are of the following combat classes (for BNW):
Spoiler :
Code:
 [B][COLOR="Red"]This listing will be slightly altered for G&K,
but I did a quick once-through of the G&K file and the UnitCombat
designations are the same, though some units may be assigned to
UNITCOMBAT_NAVALRANGED instead of UNITCOMBAT_NAVALMELEE,
or vice versa:[/COLOR][/B]
DOMAIN_SEA (contains the following unitcombat subtypes)
	UNITCOMBAT_NAVALRANGED
		UNITCLASS_GALLEASS
			UNIT_GALLEASS
			UNIT_VENETIAN_GALLEASS
		UNITCLASS_TRIREME
			UNIT_BYZANTINE_DROMON
		UNITCLASS_FRIGATE
			UNIT_FRIGATE
			UNIT_ENGLISH_SHIPOFTHELINE
		UNITCLASS_BATTLESHIP
			UNIT_BATTLESHIP
		UNITCLASS_MISSILE_CRUISER
			UNIT_MISSILE_CRUISER
	UNITCOMBAT_NAVALMELEE
		UNITCLASS_GALLEY
			UNIT_GALLEY
		UNITCLASS_TRIREME
			UNIT_TRIREME
			UNIT_CARTHAGINIAN_QUINQUEREME
		UNITCLASS_PRIVATEER
			UNIT_PRIVATEER
			UNIT_DUTCH_SEA_BEGGAR
		UNITCLASS_CARAVEL
			UNIT_CARAVEL
			UNIT_PORTUGUESE_NAU
			UNIT_KOREAN_TURTLE_SHIP
		UNITCLASS_IRONCLAD
			UNIT_IRONCLAD
		UNITCLASS_DESTROYER
			UNIT_DESTROYER
	UNITCOMBAT_SUBMARINE
		UNITCLASS_SUBMARINE
			UNIT_SUBMARINE
		UNITCLASS_NUCLEAR_SUBMARINE
			UNIT_NUCLEAR_SUBMARINE
	UNITCOMBAT_CARRIER
		UNITCLASS_CARRIER
			UNIT_CARRIER
For BNW (and I think G&K) all UNITCOMBAT_NAVALRANGED use
Code:
 <DefaultUnitAI>UNITAI_ASSAULT_SEA</DefaultUnitAI>
And all UNITCOMBAT_NAVALMELEE use
Code:
<DefaultUnitAI>UNITAI_ATTACK_SEA</DefaultUnitAI>
Since you have a Ranged Combat strength you probably need
Code:
<CombatClass>UNITCOMBAT_NAVALRANGED</CombatClass>
<DefaultUnitAI>UNITAI_ASSAULT_SEA</DefaultUnitAI>
 
Found another error in definition. Apparently UNITCOMBAT_NAVAL isn't a thing, it's UNITCOMBAT_NAVALMELEE or UNITCOMBAT_NAVALRANGED. I think I copied this from the base game. Correcting that fixed the problem.

One issue left: When the build the dreadnaught in a city with a barracks, it starts with 0 XP. When I buy one in the same city, it has 15 XP.
 
One issue left: When the build the dreadnaught in a city with a barracks, it starts with 0 XP. When I buy one in the same city, it has 15 XP.

Well, now I'm just talking to myself. This problem was fixed at the same time, I just didn't realize it at first.
 
Top Bottom