Quantcast
Channel: Civilization Fanatics' Forums
Viewing all articles
Browse latest Browse all 12856

[G&K] 3 problems with my custom unit

$
0
0
I'm making a new unit; the Field Cannon. The Field Cannon is aimed to be a Renaissance era ranged unit (almost every era has its own, so I don't see why the Renaissance has to stick with the outdated Crossbowman) with a higher ranged strength than the normal cannon, but no bonuses against cities. But I'm having some problems getting it to work correctly though.

The first and major problem is that the unit has an unusual pattern of damage output. Sometimes when I shoot something with it, it dies instantly, sometimes it deals just 1 damage and other times it does normal damage. Sometimes when aiming at an enemy unit, the box that shows how much damage that will be dealt and bonuses, e.g., is not there, and other times it's there but it's empty.


The other problem is that I can't figure out how to get the name of the unit on top of it. When you hover your cursor over it it just says TXT_KEY_UNIT_FIELD_CANNON, even though I have defined the text for it.


The third and final problem is that the unit doesn't appear in the tech tree or production line for cities, even when I have researched the required tech (Metallurgy).


Here is the entire code for the unit:
Spoiler:
Code:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 5/14/2013 2:24:31 PM -->
<GameData>
       
        <Units>
        <Row>
                <Class>UNITCLASS_FIELD_CANNON</Class>
                <Type>UNIT_FIELD_CANNON</Type>
                <PrereqTech>TECH_METALLURGY</PrereqTech>
                <Combat>18</Combat>
                <RangedCombat>28</RangedCombat>
                <Cost>185</Cost>
                <FaithCost>370</FaithCost>
                <RequiresFaithPurchaseEnabled>true</RequiresFaithPurchaseEnabled>
                <Moves>2</Moves>
                <Range>2</Range>
                <CombatClass>UNITCOMBAT_ARCHER</CombatClass>
                <Domain>DOMAIN_LAND</Domain>
                <DefaultUnitAI>UNITAI_RANGED</DefaultUnitAI>
                <Description>TXT_KEY_UNIT_FIELD_CANNON</Description>
                <Civilopedia>TXT_KEY_CIVILOPEDIA_UNITS_RENAISSANCE_CANNON_TEXT</Civilopedia>
                <Strategy>TXT_KEY_UNIT_FIELD_CANNON_STRATEGY</Strategy>
                <Help>TXT_KEY_UNIT_HELP_FIELD_CANNON</Help>
                <MilitarySupport>true</MilitarySupport>
                <MilitaryProduction>true</MilitaryProduction>
                <Pillage>true</Pillage>
                <IgnoreBuildingDefense>true</IgnoreBuildingDefense>
                <ObsoleteTech>TECH_DYNAMITE</ObsoleteTech>
                <GoodyHutUpgradeUnitClass>UNITCLASS_GATLINGGUN</GoodyHutUpgradeUnitClass>
                <AdvancedStartCost>30</AdvancedStartCost>
                <XPValueAttack>3</XPValueAttack>
                <XPValueDefense>3</XPValueDefense>
                <UnitArtInfo>ART_DEF_UNIT_CANNON</UnitArtInfo>
                <UnitFlagIconOffset>43</UnitFlagIconOffset>
                <IconAtlas>UNIT_ATLAS_2</IconAtlas>
                <PortraitIndex>0</PortraitIndex>
                <MoveRate>ARTILLERY</MoveRate>
        </Row>
        </Units>
       
        <Unit_FreePromotions>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <PromotionType>PROMOTION_ONLY_DEFENSE</PromotionType>
                </Row>
        </Unit_FreePromotions>
       
        <Unit_AITypes>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <UnitAIType>UNITAI_ATTACK</UnitAIType>
                </Row>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <UnitAIType>UNITAI_DEFENSE</UnitAIType>
                </Row>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <UnitAIType>UNITAI_EXPLORE</UnitAIType>
                </Row>
        </Unit_AITypes>
       
        <Unit_ClassUpgrades>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <UnitClassType>UNITCLASS_GATLINGGUN</UnitClassType>
                </Row>
        </Unit_ClassUpgrades>
       
        <Unit_Flavors>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <FlavorType>FLAVOR_RECON</FlavorType>
                        <Flavor>1</Flavor>
                </Row>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <FlavorType>FLAVOR_OFFENSE</FlavorType>
                        <Flavor>2</Flavor>
                </Row>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <FlavorType>FLAVOR_DEFENSE</FlavorType>
                        <Flavor>2</Flavor>
                </Row>
        </Unit_Flavors>
       
        <Unit_ResourceQuantityRequirements>
                <Row>
                        <UnitType>UNIT_FIELD_CANNON</UnitType>
                        <ResourceType>RESOURCE_IRON</ResourceType>
                </Row>
        </Unit_ResourceQuantityRequirements>
       
</GameData>



And here are the text entries (a separate XML):
Spoiler:
Code:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 5/14/2013 3:54:24 PM -->
<GameData>
        <Language_en_US>
                <Row Tag="TXT_KEY_UNIT_FIELD_CANNON">
                        <Text>Field Cannon</Text>
                </Row>
                <Row Tag="TXT_KEY_UNIT_HELP_FIELD_CANNON">
                        <Text>Field Cannon</Text>
                </Row>
                <Row Tag="TXT_KEY_UNIT_HELP_FIELD_CANNON">
                        <Text>Renaissance era ranged unit. Used to bombard enemy units.</Text>
                </Row>
                <Row Tag="TXT_KEY_CIVILOPEDIA_UNITS_RENAISSANCE_FIELD_CANNON_TEXT">
                        <Text>Renaissance era ranged unit. Used to bombard enemy units.</Text>
                </Row>
        </Language_en_US>
</GameData>



If you have any solutions for either of these problems, please reply.

Viewing all articles
Browse latest Browse all 12856

Trending Articles