Unit - Dreadnought

Erocco

Chieftain
Joined
Feb 10, 2002
Messages
62
Location
Vancouver, Canada
I decided to create a new unit (Dreadnought) as in my opinion there is a big gap between Frigates and Battleships. The unit works fine and as planned with the exception that now all other units upgrade to the Dreadnought! I've spent 2 days trying to figure what is wrong but I finally gave up. I've also downloaded other unit mods to review the code but I can't find anything different. I am happy to post the XML files and code if someone is willing to help me solve the problem.
 
It's pretty hard to say why without the XML. Upgrades are handled at the UnitClass level, through the <Unit_ClassUpgrades> table. Did you define a new UnitClass for your dreadnought? Is the Frigate the only unit defined to upgrade to the dreadnought unit class?
 
How can I get ahold of your unit. I surely could use it for my WWI scenario.
 
whoward69 said:
Trying to guess what you may or may not have done based on your descriptions is nigh on impossible. Please zip your mod (the one in the MODS sub-directory, not the ModBuddy project) and attach it to your post so we can read the actual files.
/5char
 
Post those files I can look into it too. I think the frigate should upgrade into dreadnought. Confusing me why more than one ship is upgrading into it though. That should be quite easy to fix even so.
 
Here is the entire code from the XML file

Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<GameData>
<UnitClasses>
<Row>
<Type>UNITCLASS_DREADNOUGHT</Type>
<Description>Dreadnought</Description>
<DefaultUnit>UNIT_DREADNOUGHT</DefaultUnit>
</Row>
</UnitClasses>

<Units>
<Row>
<Class>UNITCLASS_DREADNOUGHT</Class>
<Type>UNIT_DREADNOUGHT</Type>
<PrereqTech>TECH_STEAM_POWER</PrereqTech>
<BaseSightRange>3</BaseSightRange>
<Combat>55</Combat>
<RangedCombat>55</RangedCombat>
<Cost>375</Cost>
<Moves>4</Moves>
<Range>3</Range>
<CombatClass>UNITCOMBAT_NAVALRANGED</CombatClass>
<Domain>DOMAIN_SEA</Domain>
<DefaultUnitAI>UNITAI_ATTACK_SEA</DefaultUnitAI>
<Description>Dreadnought</Description>
<Civilopedia>The dreadnought was the predominant type of battleship in the early 20th century. Dreadnought's design had two revolutionary features: an "all-big-gun" armament scheme, with an unprecedented number of heavy-calibre guns and steam turbine propulsion</Civilopedia>
<Help>The dreadnought is the first heavy ranged attack naval unit</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>true</Pillage>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<ObsoleteTech>TECH_ELECTRONICS</ObsoleteTech>
<Mechanized>true</Mechanized>
<AdvancedStartCost>50</AdvancedStartCost>
<MinAreaSize>10</MinAreaSize>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_DREADNOUGHT</UnitArtInfo>
<UnitFlagAtlas>UNITS_DREADNOUGHT_FLAG_ATLAS</UnitFlagAtlas>
<UnitFlagIconOffset>0</UnitFlagIconOffset>
<IconAtlas>UNITS_DREADNOUGHT_ICON_ATLAS</IconAtlas>
<PortraitIndex>28</PortraitIndex>
<MoveRate>BOAT</MoveRate>
</Row>

<Update>
<Where Type="UNIT_BATTLESHIP"/>
<Set Cost="425"/>
</Update>
<Update>
<Where Type="UNIT_BATTLESHIP"/>
<Set Combat="75"/>
</Update>
<Update>
<Where Type="UNIT_BATTLESHIP"/>
<Set RangedCombat="75"/>
</Update>
<Update>
<Where Type="UNIT_MISSILE_CRUISER"/>
<Set Combat="75"/>
</Update>
<Update>
<Where Type="UNIT_MISSILE_CRUISER"/>
<Set RangedCombat="65"/>
</Update>
<Update>
<Where Type="UNIT_DESTROYER"/>
<Set Cost="325"/>
</Update>
<Update>
<Where Type="UNIT_FRIGATE"/>
<Set ObsoleteTech="TECH_STEAM_POWER"
Moves="4"/>
</Update>
<Update>
<Where Type="UNIT_ENGLISH_SHIPOFTHELINE"/>
<Set ObsoleteTech="TECH_STEAM_POWER"
Moves="4"/>
</Update>
</Units>

<Unit_AITypes>
<Row>
<UnitType>UNIT_DREADNOUGHT</UnitType>
<UnitAIType>UNITAI_ATTACK_SEA</UnitAIType>
</Row>
</Unit_AITypes>

<Unit_Flavors>
<Row>
<UnitType>UNIT_DREADNOUGHT</UnitType>
<FlavorType>FLAVOR_NAVAL</FlavorType>
<Flavor>40</Flavor>
</Row>
<Row>
<UnitType>UNIT_DREADNOUGHT</UnitType>
<FlavorType>FLAVOR_OFFENSE</FlavorType>
<Flavor>5</Flavor>
</Row>
</Unit_Flavors>

<Unit_ClassUpgrades>
<Row>
<UnitType>UNIT_DREADNOUGHT</UnitType>
<UnitClassType>UNITCLASS_BATTLESHIP </UnitClassType>
</Row>
<Update>
<Where UnitType="UNIT_FRIGATE"/>
<Set UnitClassType="UNITCLASS_DREADNOUGHT"/>
</Update>
<Update>
<Where UnitType="UNIT_ENGLISH_SHIPOFTHELINE"
<Set UnitClassType="UNITCLASS_DREADNOUGHT"/>
</Update>
</Unit_ClassUpgrades>

<Unit_ResourceQuantityRequirements>
<Row>
<UnitType>UNIT_DREADNOUGHT</UnitType>
<ResourceType>RESOURCE_COAL</ResourceType>
</Row>
<Row>
<UnitType>UNIT_DREADNOUGHT</UnitType>
<ResourceType>RESOURCE_IRON</ResourceType>
</Row>
</Unit_ResourceQuantityRequirements>

<UnitGameplay2DScripts>
<Row>
<UnitType>UNIT_DREADNOUGHT</UnitType>
<SelectionSound>AS2D_SELECT_IRONCLAD</SelectionSound>
<FirstSelectionSound>AS2D_BIRTH_IRONCLAD</FirstSelectionSound>
</Row>
</UnitGameplay2DScripts>
</GameData>
 
<Where UnitType="UNIT_ENGLISH_SHIPOFTHELINE"

It's missing /> at the end.

Also here:

<UnitClassType>UNITCLASS_BATTLESHIP </UnitClassType>

Is an extra space, I don't know if it matters or not, but you should delete it just in case.

(Both things are in the Unit_ClassUpgrades table.)
 
It's missing /> at the end.

Also here:



Is an extra space, I don't know if it matters or not, but you should delete it just in case.

(Both things are in the Unit_ClassUpgrades table.)

Big thanks PawelS, indeed the /> was missing at the end of <Where UnitType="UNIT_ENGLISH_SHIPOFTHELINE". Thank you very much!:goodjob:
 
Top Bottom