MODIFIER_UNIT_ADJUST_COMBAT_CAPTURE

Joined
Feb 13, 2024
Messages
2
Hi brilliant people,

I've been learning how to make a custom civ (thanks to a wonderful guide and template from "Matt (MC)" and have run into some issues while playtesting. I am trying to make a unique unit that replaces Spec Ops and has an ability similar to the Eagle Warrior, except it has a chance to capture enemy units as Rock Bands instead of Builders. I've followed the code for the Eagle Warrior but when playtesting, this does not appear to give me Rock Bands after many non-barbarian kills. I'd appreciate any advice. Here is what I have so far for the ability (Note, right now it replaces the warrior and has a massive movement and combat buff simply for playtesting so that I don't need to get up to Spec Ops each time I want to test if a change in the code works):

SQL:
INSERT INTO Types
        (Type,                                    Kind            )
VALUES    ('TRAIT_CIVILIZATION_RTK_TALENTSCOUT',    'KIND_TRAIT'    ),
        ('UNIT_RTK_TALENTSCOUT',                'KIND_UNIT'        ),
        ('ABILITY_RTK_TALENTSCOUT',                'KIND_ABILITY'    );
        
INSERT INTO Tags
        (Tag,                        Vocabulary        )
VALUES    ('CLASS_RTK_TALENTSCOUT',    'ABILITY_CLASS'    );

INSERT INTO TypeTags
        (Type,                        Tag                        )
VALUES    ('UNIT_RTK_TALENTSCOUT',    'CLASS_RTK_TALENTSCOUT'    ),
        ('ABILITY_RTK_TALENTSCOUT',    'CLASS_RTK_TALENTSCOUT'    );

INSERT INTO TypeTags (Type,        Tag)
SELECT     'UNIT_RTK_TALENTSCOUT',    Tag
FROM     TypeTags
WHERE     Type = 'UNIT_WARRIOR';

INSERT INTO Traits
        (TraitType,                                Name,                                Description                                    )
VALUES    ('TRAIT_CIVILIZATION_RTK_TALENTSCOUT',    'LOC_UNIT_RTK_TALENTSCOUT_NAME',        'LOC_UNIT_RTK_TALENTSCOUT_DESCRIPTION'    );


INSERT INTO CivilizationTraits
        (CivilizationType,                    TraitType                                    )
VALUES    ('CIVILIZATION_RTK_DRAWING',        'TRAIT_CIVILIZATION_RTK_TALENTSCOUT'        );

INSERT INTO Units    (
        UnitType,
        Name,
        Description,
        TraitType,
        BaseMoves,
        Cost,
        PurchaseYield,
        AdvisorType,
        Combat,
        RangedCombat,
        Range,
        BaseSightRange,
        ZoneOfControl,
        Domain,
        FormationClass,
        PromotionClass,
        Maintenance,
        MandatoryObsoleteTech,
        PrereqTech,
        PrereqCivic
        )
SELECT    'UNIT_RTK_TALENTSCOUT',
        'LOC_UNIT_RTK_TALENTSCOUT_NAME',   
        'LOC_UNIT_RTK_TALENTSCOUT_DESCRIPTION',
        'TRAIT_CIVILIZATION_RTK_TALENTSCOUT',
        BaseMoves + 5,
        Cost + 15,
        PurchaseYield,
        AdvisorType,
        Combat + 50,
        RangedCombat,
        Range,
        BaseSightRange,
        ZoneOfControl,
        Domain,
        FormationClass,
        PromotionClass,
        Maintenance,
        MandatoryObsoleteTech,
        PrereqTech,
        PrereqCivic
FROM    Units
WHERE    UnitType = 'UNIT_WARRIOR';
        
INSERT INTO UnitUpgrades (Unit,    UpgradeUnit)
SELECT     'UNIT_RTK_TALENTSCOUT',    UpgradeUnit
FROM     UnitUpgrades
WHERE    Unit = 'UNIT_WARRIOR';

INSERT INTO UnitAiInfos (UnitType,    AiType)
SELECT     'UNIT_RTK_TALENTSCOUT',        AiType
FROM     UnitAiInfos
WHERE     UnitType = 'UNIT_WARRIOR';

INSERT INTO UnitReplaces
        (CivUniqueUnitType,            ReplacesUnitType    )
VALUES    ('UNIT_RTK_TALENTSCOUT',    'UNIT_WARRIOR'        );

INSERT INTO UnitAbilities
        (UnitAbilityType,            Name,                                    Description                        )
VALUES    ('ABILITY_RTK_TALENTSCOUT',    'LOC_UNIT_RTK_TALENTSCOUT_NAME',        'LOC_ABILITY_RTK_TALENTSCOUT'        );

INSERT INTO Modifiers   
        (ModifierId,                                        ModifierType                            )
VALUES    ('MODIFIER_RTK_TALENTSCOUT_CAPTURE_ROCKBAND',        'MODIFIER_UNIT_ADJUST_COMBAT_CAPTURE'    );

INSERT INTO ModifierArguments       
        (ModifierId,                                            Name,                            Value                )
VALUES    ('MODIFIER_RTK_TALENTSCOUT_CAPTURE_ROCKBAND',            'CanCapture',                    1                ),
        ('MODIFIER_RTK_TALENTSCOUT_CAPTURE_ROCKBAND',            'UnitType',                        'UNIT_ROCK_BAND'    );
        
INSERT INTO UnitAbilityModifiers
        (UnitAbilityType,                ModifierId                                    )
VALUES    ('ABILITY_RTK_TALENTSCOUT',        'MODIFIER_RTK_TALENTSCOUT_CAPTURE_ROCKBAND'    );
 
UPDATE: I've found the issue. It seems that after R&F came out, they changed the "MODIFIER_UNIT_ADJUST_COMBAT_CAPTURE" modifier to "MODIFIER_UNIT_ADJUST_COMBAT_UNIT_CAPTURE". This fixed my code.
 
Top Bottom