alex1

Chieftain
Joined
Nov 22, 2022
Messages
9
Hello everyone,

A while back I started creating a mod for CIV 6, which is my own custom civilization. I used an old template, which I later changed to the ModBuddy template. Anyway, I was editing the leader and civilization's unique abilities, which are:

=== LEADER UNIQUE ABILITY ===

All cities gain +25% extra :c5science: Science once the "Computers" tech is completed.

=== CIVILIZATION UNIQUE ABILITY ===

+1 :c5production: production on tiles adjacent to a campus district. All units within the Peach Empire territory gain +1 :c5moves: movement and extra defense. (not implemented yet)

I tweaked with the numerous modifiers, requirements and already existing traits, yet I couldn't really make them work the way I wanted. The leader's ability was "working" in-game, but gave me +25 science per city instead of +25% of the science a city has, per city.

Here's the Leader_UA.sql code snippet:


SQL:
-- Types

INSERT INTO    Types
        (Type,                                                Kind            )
VALUES    ('TRAIT_LEADER_ALF_NOT_MY_CODE',                    'KIND_TRAIT'    );
       
-- Traits
       
INSERT INTO    Traits
        (TraitType,                            Name,                                        Description                                        )
VALUES    ('TRAIT_LEADER_ALF_NOT_MY_CODE',    'LOC_TRAIT_LEADER_ALF_NOT_MY_CODE_NAME',    'LOC_TRAIT_LEADER_ALF_NOT_MY_CODE_DESCRIPTION'    );

-- Leader Traits

INSERT INTO    LeaderTraits
        (LeaderType,            TraitType                        )
VALUES    ('LEADER_ALF_PCHISL',    'TRAIT_LEADER_ALF_NOT_MY_CODE'    );

-- Mods.

INSERT INTO Modifiers
        (ModifierId,                    ModifierType,                                    RunOnce, Permanent, NewOnly, OwnerRequirementSetId, SubjectRequirementSetId)
VALUES    ('SCIENCE_BOOST_COMPUTER_TECH', 'EFFECT_ADJUST_CITY_YIELD_MODIFIER',            0,         0,            0,         NULL,                    'REQSET_TECH'           );

-- Trait Mod.

INSERT INTO TraitModifiers
        (TraitType,                                    ModifierId                        )
VALUES    ('TRAIT_LEADER_ALF_NOT_MY_CODE',            'SCIENCE_BOOST_COMPUTER_TECH'    );

-- Mod. Args.

INSERT INTO ModifierArguments
        (ModifierId,                                        Name,                Value                                                )
VALUES    ('SCIENCE_BOOST_COMPUTER_TECH',                        'Amount',            '25'                                                ),
        ('SCIENCE_BOOST_COMPUTER_TECH',                        'YieldType',        'YIELD_SCIENCE'                                        );

-- Req. Sets

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES
('REQSET_TECH', 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES
('REQSET_TECH', 'HAS_TECH_COMPUTER');

-- Reqs.

INSERT INTO Requirements (RequirementId, RequirementType) VALUES
('HAS_TECH_COMPUTER', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY');

INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES
('HAS_TECH_COMPUTER', 'TechnologyType', 'TECH_COMPUTERS');

Now, the civ's ability doesn't work, at all. I ignored the second part for now, and only wrote the code for the first one. The thing is, when I load up civ, it doesn't give the campuses' adjacent tiles the +1 production yield. This code was much, much harder to write, so it probably has a lot more bugs, but I don't know why. I tried a lot of combinations, but I couldn't figure this one out.

Here's the Civilization_UA.sql code snippet:

SQL:
-- Types

INSERT INTO    Types
        (Type,                                                Kind            )
VALUES    ('TRAIT_CIVILIZATION_ALF_COLLEGE_LIFE',                'KIND_TRAIT'    );
        ('MODIFIER_CIVILIZATION_ALF_COLLEGE_LIFE',            'KIND_MODIFIER' );

-- Traits

INSERT INTO    Traits  
        (TraitType,                                    Name,                                        Description                                                        )
VALUES    ('TRAIT_CIVILIZATION_ALF_COLLEGE_LIFE',        'LOC_TRAIT_CIVILIZATION_ALF_COLLEGE_LIFE_NAME',        'LOC_TRAIT_CIVILIZATION_ALF_COLLEGE_LIFE_DESCRIPTION'            );

-- Civilization Traits

INSERT INTO    CivilizationTraits
        (CivilizationType,                TraitType                                )
VALUES    ('CIVILIZATION_MC_OLMEC',        'TRAIT_CIVILIZATION_ALF_COLLEGE_LIFE'    );

-- Trait Mods.

INSERT INTO    TraitModifiers  
        (TraitType,                                            ModifierId                                            )
VALUES    ('TRAIT_CIVILIZATION_ALF_COLLEGE_LIFE',                'CAMPUS_DISTRICT_ADJACENCY_PROD'                    ),

-- Dynamic Mods.

INSERT INTO DynamicModifiers
        (ModifierType,                                      CollectionType,              EffectType                             )
VALUES    ('MODIFIER_CIVILIZATION_ALF_COLLEGE_LIFE',          'COLLECTION_OWNER',          'EFFECT_ADJUST_PLOT_YIELD'             );

-- Mods. (Quick note: I am aware that I wrote the same ModifierId twice, but that doesn't solve the problem)

INSERT INTO    Modifiers
        (ModifierId,                                            ModifierType,                                            RunOnce,        Permanent,    OwnerRequirementSetId, SubjectRequirementSetId                        )
VALUES    ('CAMPUS_DISTRICT_ADJACENCY_PROD',                        'MODIFIER_CIVILIZATION_ALF_COLLEGE_LIFE',                1,                1,            NULL,                   'CAMPUS_ADJACENCY'                            ),
        ('CAMPUS_DISTRICT_ADJACENCY_PROD',                        'MODIFIER_ALL_DISTRICTS_ATTACH_MODIFIER',                1,                1,            NULL,                   'CAMPUS_ADJACENCY'                            );
       
-- Mod. Args.

INSERT INTO    ModifierArguments
        (ModifierId,                                                Name,                            Value,                            Extra,                            Type                    )
VALUES    ('CAMPUS_DISTRICT_ADJACENCY_PROD',                            'YieldType',                    'YIELD_PRODUCTION',                null,                            'ARGTYPE_IDENTITY'        ),
        ('CAMPUS_DISTRICT_ADJACENCY_PROD',                            'Amount',                        '1',                            null,                            'ARGTYPE_IDENTITY'        );
       
-- Req. Sets

INSERT INTO RequirementSets
        (RequirementSetId,    RequirementSetType                        )
VALUES  ('CAMPUS_ADJACENCY',  'REQUIREMENTSET_TEST_ALL'                    );

INSERT INTO RequirementSetRequirements
        (RequirementSetId,      RequirementId                                )
VALUES  ('CAMPUS_ADJACENCY',  'ADJACENT_TO_CAMPUS'                        );

-- Reqs.

INSERT INTO Requirements
        (RequirementId,                RequirementType                        )
VALUES    ('U_ADJACENT_TO_CAMPUS', 'REQUIREMENT_PLOT_ADJACENT_TO_OWNER'    );

So, in summary, the leader's ability works to some extent, but not really, and the civ's ability doesn't work at all.
 
Last edited:
Note: I just realized I forgot to remove the percentage sign from the code in the leader's ability file (science yield). The original was just the number 25.
 
Top Bottom