[SOLVED]Cannot get an ability description to appear in the combat preview

Mettpawwz

Chieftain
Joined
Feb 4, 2017
Messages
73
For whatever reason I can't get it to work. This is the example I'm testing it with and I'm kinda stumped as to what exactly is wrong. The effect is present in-game, but the description doesn't show up.

It basically just gives PROMOTION_CLASS_MELEE units an extra 15 strength vs anti-cavalry units. I've tried supplying the <UpdateText> file as both XML and SQL and neither was shown in-game.

Here's the main functionality file (Troubleshooter.sql):

Code:
    --Types Tables entries
    INSERT INTO Types     (Type, Kind)
    VALUES                ('METT_ABILITY_EXAMPLE', 'KIND_ABILITY');
    INSERT INTO UnitAbilities     (UnitAbilityType, Name, Description, Inactive, ShowFloatTextWhenEarned)
    VALUES                        ('METT_ABILITY_EXAMPLE', 'LOC_METT_ABILITY_EXAMPLE_NAME', 'LOC_METT_ABILITY_EXAMPLE_DESCRIPTION', '0', '0');
    INSERT INTO TypeTags     (Type, Tag)
    VALUES                    ('METT_ABILITY_EXAMPLE', 'CLASS_MELEE');
    --Modifier Tables entries
    INSERT INTO UnitAbilityModifiers    (UnitAbilityType, ModifierId)
    VALUES                                ('METT_ABILITY_EXAMPLE', 'METT_ABILITY_EXAMPLE_MODIFIER');
    INSERT INTO Modifiers     (ModifierId, ModifierType, SubjectRequirementSetId)
    VALUES                     ('METT_ABILITY_EXAMPLE_MODIFIER', 'MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH', 'ANTI_SPEAR_OPPONENT_REQUIREMENTS');
    INSERT INTO ModifierArguments     (ModifierId, Name, Value)
    VALUES                             ('METT_ABILITY_EXAMPLE_MODIFIER', 'Amount', '15');

Here is the XML version of the text file (Troubleshooter_Text.xml):

Code:
<?xml version="1.0" encoding="UTF-8"?>
<GameData>
<LocalizedText>
        <!-- Name -->
        <Row Tag="LOC_METT_ABILITY_EXAMPLE_NAME" Language="en_US">
            <Text>Strong Against Specialists</Text>
        </Row>

        <!-- Description -->
        <Row Tag="LOC_METT_ABILITY_EXAMPLE_DESCRIPTION" Language="en_US">
            <Text>+10 [ICON_Strength]Damage against Specialist Melee Units</Text>
        </Row>
</LocalizedText>
</GameData>

And here is the SQL version of it (Troubleshooter_Text.sql):

Code:
INSERT INTO LocalizedText     (Language, Tag, Text)
VALUES                        ('en_US', 'LOC_METT_ABILITY_EXAMPLE_NAME', 'Strong Against Anti-Cavalry'),
                            ('en_US', 'LOC_METT_ABILITY_EXAMPLE_DESCRIPTION', '+15 Damage against Anti-cavalry Units');


Finally, this is what the Modinfo file looks like:

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="81A5EBCF-85FB-8D58-2894-23F773C2218B" version="1.0">

    <Properties>
        <Name>Troubleshooting</Name>
        <Teaser>I am a Troubleshooter.</Teaser>
        <Description>Still a Troubleshooter.</Description>
        <Authors>Mettpawwz</Authors>
    </Properties>

    <Components>
        <UpdateDatabase>
                <File>Troubleshooter.sql</File>
        </UpdateDatabase>
 
        <UpdateText>
            <File>Troubleshooter_Text.xml</File>
        </UpdateText>
    </Components>
 
    <Files>
        <File>Troubleshooter.sql</File>
        <File>Troubleshooter_Text.xml</File>
    </Files>

</Mod>
 
Last edited:
I figured it out on my own.

For anyone wanting to know how this is done, you need to add the following entry into the ModifierStrings Table in the main functionality file:

Code:
INSERT INTO ModifierStrings    (ModifierId, Context, Text)
VALUES                         ('METT_ABILITY_EXAMPLE_MODIFIER', 'Preview', 'LOC_METT_ABILITY_EXAMPLE_COMBAT_MODIFIER_DESCRIPTION');

And then an entry in the text file for it to fetch from, for example:

Code:
INSERT INTO LocalizedText     (Language, Tag, Text)
VALUES                        ('en_US', 'LOC_METT_ABILITY_EXAMPLE_COMBAT_MODIFIER_DESCRIPTION', '+15 Damage against Anti-cavalry Units');
 
Back
Top Bottom