1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Adding a new ability to the trait of a new civ

Discussion in 'Mod Creation Help' started by 'Stache, Jan 10, 2019 at 7:44 PM.

  1. 'Stache

    'Stache Chieftain

    Joined:
    Thursday
    Messages:
    3
    Gender:
    Male
    Hello, I am currently trying to make my first own civ in civ 6, I have used Josh Atkins YouTube tutorial and used his template. Now I am stuck at adding the ability to my new civ, that enables all units to ignore hills.
    I have written this code so far.

    Here it is as xml:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameInfo>
        <Types>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Kind="KIND_ABILITY"/>
        </Types>
        <TypeTags>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LANDCIVILIAN"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RECON"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_MELEE"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RANGED"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_SIEGE"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_HEAVY_CAVALRY"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LIGHT_CAVALRY"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RANGED_CAVALRY"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_ANTI_CAVALRY"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_HEAVY_CHARIOT"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LIGHT_CHARIOT"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_BATTERING_RAM"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_SIEGE_TOWER"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_OBSERVATION"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_ANTI_AIR"/>
            <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_GARDE"/>
        </TypeTags>
        <UnitAbilities>
            <Row UnitAbilityType="ABILITY_STACHE_IGNORE_HILL_COST" Name="LOC_ABILITY_STACHE_IGNORE_HILL_COST_NAME" Description="LOC_ABILITY_STACHE_IGNORE_HILL_COST_DESCRIPTION" Inactive="true"/>
        </UnitAbilities>
        <!--  -->
        <UnitAbilityModifiers>
            <Row>
                <UnitAbilityType>ABILITY_STACHE_IGNORE_HILL_COST</UnitAbilityType>
                <ModifierId>ALTITUDE_TRAINING_IGNORE_HILLS</ModifierId>
            </Row>
        </UnitAbilityModifiers>
        <Modifiers>
            <Row>
                <ModifierId>STACHE_IGNORE_HILL_COST</ModifierId>
                <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
                <Permanent>true</Permanent>
            </Row>
        </Modifiers>
        <ModifierArguments>
            <Row>
                <ModifierId>STACHE_IGNORE_HILL_COST</ModifierId>
                <Name>AbilityType</Name>
                <Value>ABILITY_STACHE_IGNORE_HILL_COST</Value>
            </Row>
            <Row>
                <ModifierId>ALTITUDE_TRAINING_IGNORE_HILLS</ModifierId>
                <Name>Ignore</Name>
                <Value>true</Value>
            </Row>
            <Row>
                <ModifierId>ALTITUDE_TRAINING_IGNORE_HILLS</ModifierId>
                <Name>Type</Name>
                <Value>HILLS</Value>
            </Row>
        </ModifierArguments>
        <TraitModifiers>
            <Row TraitType="TRAIT_CIVILIZATION_STACHE_IGNORE_HILLS" ModifierId="STACHE_IGNORE_HILL_COST"/>
        </TraitModifiers>
    </GameInfo>
    
    

    and as sql:
    Code:
    INSERT INTO Types
    (Type,                                                    Kind)
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'KIND_ABILITY');
    INSERT INTO TypeTags
    (Type,                                                    Tag)
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_LANDCIVILIAN'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_RECON'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_MELEE'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_RANGED'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_SIEGE'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_HEAVY_CAVALRY'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_LIGHT_CAVALRY'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_RANGED_CAVALRY'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_ANTI_CAVALRY'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_HEAVY_CHARIOT'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_LIGHT_CHARIOT'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_BATTERING_RAM'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_SIEGE_TOWER'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_OBSERVATION'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_ANTI_AIR'),
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'CLASS_GARDE');
    
    INSERT INTO UnitAbilities
    (UnitAbilityType,                                        Name,                                                        Description,                                                Inactive)
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'LOC_ABILITY_STACHE_IGNORE_HILL_COST_NAME',                    'LOC_ABILITY_STACHE_IGNORE_HILL_COST_DESCRIPTION',            'true');
    
    INSERT INTO UnitAbilityModifiers
    (UnitAbilityType,                                        ModifierId)
    ('ABILITY_STACHE_IGNORE_HILL_COST',                        'ALTITUDE_TRAINING_IGNORE_HILLS');
    
    INSERT INTO Modifiers
    (ModifierId,                                            ModifierType,                                                Permanent)
    ('STACHE_IGNORE_HILL_COST',                                'MODIFIER_PLAYER_UNITS_GRANT_ABILITY',                        'true');
    
    INSERT INTO ModifierArguments
    (ModifierId,                                            Name,                                                        Value)
    ('STACHE_IGNORE_HILL_COST',                                'AbilityType',                                                'ABILITY_STACHE_IGNORE_HILL_COST'),
    ('ALTITUDE_TRAINING_IGNORE_HILLS',                        'Ignore',                                                    'true'),
    ('ALTITUDE_TRAINING_IGNORE_HILLS',                        'Type'                                                        'HILLS');
    
    INSERT INTO TraitModifiers
    (TraitType,                                                ModifierId)
    ('TRAIT_CIVILIZATION_STACHE_IGNORE HILLS',                        'STACHE_IGNORE_HILL_COST');
    
    

    I don't know if this is correct. I copied it from a suggestion from @LeeS, made in the "give all units a promotion as a trait?" thread. Then I adjusted it accordingly.
    My game ignores this file though. The new civ runs without it.
    I put the .xml in FrontEnd Actions and In-game Actions under Update Database.

    My questions are: Is this code even correct?
    Didn't I connect it correctly?

    (The "TRAIT_CIVILIZATION_STACHE_IGNORE HILLS" leads to the trait of the civ (not the leader), which is defined in another .sql file.)

    I may be way off here, this is my first time as a modder dealing with coding of that magnitude.
    Thank you very much for any help.
     
    Last edited: Jan 11, 2019 at 10:50 AM
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    5,766
    Location:
    Illinois, USA
  3. 'Stache

    'Stache Chieftain

    Joined:
    Thursday
    Messages:
    3
    Gender:
    Male
    Thank you, LeeS.

    So removing these lines like so should suffice?

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameInfo>
       <CivilizationTraits>
           <Row CivilizaitonType="CIVILIZATION_STACHE_CIV_THALVARIA" TraitType="ABILITY_STACHE_IGNORE_HILL_COST"/>
       </CivilizationTraits>
       <Types>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Kind="KIND_ABILITY"/>
       </Types>
       <TypeTags>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LANDCIVILIAN"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RECON"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_MELEE"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RANGED"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_SIEGE"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_HEAVY_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LIGHT_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RANGED_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_ANTI_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_HEAVY_CHARIOT"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LIGHT_CHARIOT"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_BATTERING_RAM"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_SIEGE_TOWER"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_OBSERVATION"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_ANTI_AIR"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_GARDE"/>
       </TypeTags>
       <UnitAbilities>
           <Row UnitAbilityType="ABILITY_STACHE_IGNORE_HILL_COST" Name="LOC_ABILITY_STACHE_IGNORE_HILL_COST_NAME" Description="LOC_ABILITY_STACHE_IGNORE_HILL_COST_DESCRIPTION" Inactive="true"/>
       </UnitAbilities>
       <!--  -->
       <UnitAbilityModifiers>
           <Row>
               <UnitAbilityType>ABILITY_STACHE_IGNORE_HILL_COST</UnitAbilityType>
               <ModifierId>ALTITUDE_TRAINING_IGNORE_HILLS</ModifierId>
           </Row>
       </UnitAbilityModifiers>
       <Modifiers>
           <Row>
               <ModifierId>STACHE_IGNORE_HILL_COST</ModifierId>
               <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
               <Permanent>true</Permanent>
           </Row>
       </Modifiers>
       <ModifierArguments>
           <Row>
               <ModifierId>STACHE_IGNORE_HILL_COST</ModifierId>
               <Name>AbilityType</Name>
               <Value>ABILITY_STACHE_IGNORE_HILL_COST</Value>
           </Row>
       </ModifierArguments>
       <TraitModifiers>
           <Row TraitType="TRAIT_CIVILIZATION_STACHE_GRIND" ModifierId="STACHE_IGNORE_HILL_COST"/>
       </TraitModifiers>
    </GameInfo>
    
    When I test it, the game doesn't acknowledge the file yet, It just runs without any effect.
    I put the code in FrontEnd Actions and In-Game actions.


    Thank you for your help so far!
     
  4. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    5,766
    Location:
    Illinois, USA
    You don't need the code in FrontEndActions.
    And, as always, is there anything in Database.log related to your file-name ? This ought to be generating at least one error-message:
    Code:
    <CivilizationTraits>
           <Row CivilizaitonType="CIVILIZATION_STACHE_CIV_THALVARIA" TraitType="ABILITY_STACHE_IGNORE_HILL_COST"/>
       </CivilizationTraits>
    ................................................
       <TraitModifiers>
           <Row TraitType="TRAIT_CIVILIZATION_STACHE_GRIND" ModifierId="STACHE_IGNORE_HILL_COST"/>
       </TraitModifiers>
    You're referencing an undefined TraitType in table "CivilizationTraits" and are instead attempting to give the name of the UnitAbilityType
     
  5. 'Stache

    'Stache Chieftain

    Joined:
    Thursday
    Messages:
    3
    Gender:
    Male
    Jup. I found out where the Database.log is, and it says:

    [1147489.818] [Gameplay] ERROR: Database::XMLSerializer (Ignore_Hills_Trait.xml): Cannot parse file.

    I tinkered for a bit, and I got it now!

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameInfo>
       <Types>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Kind="KIND_ABILITY"/>
       </Types>
       <TypeTags>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LANDCIVILIAN"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RECON"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_MELEE"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RANGED"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_SIEGE"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_HEAVY_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LIGHT_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_RANGED_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_ANTI_CAVALRY"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_HEAVY_CHARIOT"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_LIGHT_CHARIOT"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_BATTERING_RAM"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_SIEGE_TOWER"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_OBSERVATION"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_ANTI_AIR"/>
           <Row Type="ABILITY_STACHE_IGNORE_HILL_COST" Tag="CLASS_GARDE"/>
       </TypeTags>
       <UnitAbilities>
           <Row UnitAbilityType="ABILITY_STACHE_IGNORE_HILL_COST" Name="LOC_ABILITY_STACHE_IGNORE_HILL_COST_NAME" Description="LOC_ABILITY_STACHE_IGNORE_HILL_COST_DESCRIPTION" Inactive="true"/>
       </UnitAbilities>
       <!--  -->
       <UnitAbilityModifiers>
           <Row>
               <UnitAbilityType>ABILITY_STACHE_IGNORE_HILL_COST</UnitAbilityType>
               <ModifierId>ALTITUDE_TRAINING_IGNORE_HILLS</ModifierId>
           </Row>
       </UnitAbilityModifiers>
       <Modifiers>
           <Row>
               <ModifierId>STACHE_IGNORE_HILL_COST</ModifierId>
               <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
               <Permanent>true</Permanent>
           </Row>
       </Modifiers>
       <ModifierArguments>
           <Row>
               <ModifierId>STACHE_IGNORE_HILL_COST</ModifierId>
               <Name>AbilityType</Name>
               <Value>ABILITY_STACHE_IGNORE_HILL_COST</Value>
           </Row>
       </ModifierArguments>
       <TraitModifiers>
           <Row TraitType="TRAIT_CIVILIZATION_STACHE_GRIND" ModifierId="STACHE_IGNORE_HILL_COST"/>
       </TraitModifiers>
    </GameInfo>
    
    Thank you so much for your understanding.
    My mistakes may be agonizingly clear to an expert like you, but I am thankful for your patience in helping mod newcomers like us.


    (P.S.: I also took it out of FrontEndActions.)
     
    Last edited: Jan 12, 2019 at 7:09 PM
  6. isau

    isau Warlord

    Joined:
    Jan 15, 2007
    Messages:
    2,772
    I would recommend downloading a SQL editor like SQLight Studio to test run your SQL statements and double check that values are making it into the game. It will make the process of creating and verifying database values easier.
     

Share This Page