[GS] SQL modding issue, leader trait change

Egib

Chieftain
Joined
Apr 9, 2019
Messages
6
I've been trying my hand at creating a mod using sql, and it has been very interesting so far, but it seems that I run into some sort of load issue. Does anyone have any idea why that would be ?

The goal of this small mod is to change the leader trait of Wilhelmina to have an extra economic policy slot

This is what I have in my Billionaire.modinfo file,
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="5a49c033-8f55-486a-a238-4a10de74eb66" version="1">
    <Properties>
        <Name>Queen Wilhelmina Billionaire</Name>
        <Teaser>Adds Economic Policy slot to Wilhelmina</Teaser>
        <Description>Changes Wilhelmina's leader trait from "Radio Oranje" to "Billionaire", which simply adds an economic policy slot.</Description>
        <Authors>Put your name here</Authors>
    </Properties>

    <Files>
        <File>Billionaire.sql</File>
    </Files>

    <Components>
        <UpdateDatabase id="Gameplay">
            <Items>
                 <File>Billionaire.sql</File>
            </Items>
        </UpdateDatabase>
    </Components>
</Mod>

And this is the contents of my Billionaire.sql file
Code:
UPDATE LeaderTraits SET TraitType='TRAIT_BILLIONAIRE' WHERE LeaderType='LEADER_WILHELMINA';

INSERT INTO TraitModifiers         
        (TraitType,                                            ModifierId)
VALUES    ('TRAIT_BILLIONAIRE',                                'TRAIT_ECONOMIC_GOVERNMENT_SLOT');

INSERT INTO Modifiers 
        (ModifierId,                                        ModifierType,                                                    Permanent)
VALUES    ('TRAIT_ECONOMIC_GOVERNMENT_SLOT',                    'MODIFIER_PLAYER_CULTURE_ADJUST_GOVERNMENT_SLOTS_MODIFIER',        0);
   
INSERT INTO ModifierArguments
        (ModifierId,                                        Name,                        Value)
VALUES    ('TRAIT_ECONOMIC_GOVERNMENT_SLOT',                    'GovernmentSlotType',        'SLOT_ECONOMIC');

Any and all help is appreciated.
 
What do you mean by defining the trait type, i'm not sure I understand
 
Two issues:

Like raen said, you need to include an INSERT into Types prior to creating a Trait, like below:


INSERT INTO Types
(Type, Kind)
VALUES ('TRAIT_BILLIONAIRE', 'KIND_TRAIT') ;


Also make sure you don't do any Inserting prior to creating the object you are inserting. You can't insert into TraitModifiers prior to creating a Modifier, for example.


Be sure to check Database.log (in the logs folder) to watch for errors. Load the game a few times with mods you know work correctly to see what a clean log should look like.
 
Thanks both of you, i've made the change to this now

Code:
--------------------------------------------------------------------------------------------------------------------------
-- Modifiers
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO Modifiers 
        (ModifierId,                                        ModifierType,                                                    Permanent)
VALUES    ('TRAIT_ECONOMIC_GOVERNMENT_SLOT',                    'MODIFIER_PLAYER_CULTURE_ADJUST_GOVERNMENT_SLOTS_MODIFIER',        0);
--------------------------------------------------------------------------------------------------------------------------
-- Modifier Arguments
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO ModifierArguments
        (ModifierId,                                        Name,                        Value)
VALUES    ('TRAIT_ECONOMIC_GOVERNMENT_SLOT',                    'GovernmentSlotType',        'SLOT_ECONOMIC');
--------------------------------------------------------------------------------------------------------------------------
-- Types
-------------------------------------------------------------------------------------------------------------------------- 
INSERT INTO Types 
        (Type,                                Kind)
VALUES    ('TRAIT_BILLIONAIRE',                'KIND_TRAIT'); 
--------------------------------------------------------------------------------------------------------------------------         
-- Traits         
--------------------------------------------------------------------------------------------------------------------------             
INSERT INTO Traits             
        (TraitType,                            Name,                                        Description)
VALUES    ('TRAIT_BILLIONAIRE',                'LOC_TRAIT_BILLIONAIRE',                    'LOC_TRAIT_BILLIONAIRE');
--------------------------------------------------------------------------------------------------------------------------
--TraitModifiers
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO TraitModifiers         
        (TraitType,                                            ModifierId)
VALUES    ('TRAIT_BILLIONAIRE',                                'TRAIT_ECONOMIC_GOVERNMENT_SLOT');
--------------------------------------------------------------------------------------------------------------------------
--LeaderTraits
--------------------------------------------------------------------------------------------------------------------------
UPDATE LeaderTraits SET TraitType='TRAIT_BILLIONAIRE' WHERE LeaderType='LEADER_WILHELMINA';

Still trying to wrap my brain around how to get this to work like I want it to, as it still isn't creating the the extra slot, but it is now loading properly and everything i've defined here appears in the debug database except for the TRAIT_BILLIONAIRE replacing TRAIT_RADIO_ORANJE.

Is there anything else I need to define/ how would I go about doing that ?

I suppose I don't really get the "hierarchy" of what needs to be created first, is there somewhere I can look to figure those kinds of things out?

Thanks a bunch for your patience and help
 
Last edited:
It seems also that making the change in the debug database for this line:

Code:
UPDATE LeaderTraits SET TraitType='TRAIT_BILLIONAIRE' WHERE LeaderType='LEADER_WILHELMINA';

works fine, but fails to do its job when in the mod and running in game
 
Thank you very much, that seems to have done the trick, really appreciate the help raen and isau, it means a lot to me.

here's what I ended up with;

Code:
--------------------------------------------------------------------------------------------------------------------------
-- Modifiers
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO Modifiers   
        (ModifierId,                                        ModifierType,                                                    Permanent)
VALUES    ('TRAIT_ECONOMIC_GOVERNMENT_SLOT',                    'MODIFIER_PLAYER_CULTURE_ADJUST_GOVERNMENT_SLOTS_MODIFIER',        0);
--------------------------------------------------------------------------------------------------------------------------
-- Modifier Arguments
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO ModifierArguments
        (ModifierId,                                        Name,                        Value)
VALUES    ('TRAIT_ECONOMIC_GOVERNMENT_SLOT',                    'GovernmentSlotType',        'SLOT_ECONOMIC');
--------------------------------------------------------------------------------------------------------------------------
-- Types
--------------------------------------------------------------------------------------------------------------------------   
INSERT INTO Types   
        (Type,                                Kind)
VALUES    ('TRAIT_BILLIONAIRE',                'KIND_TRAIT');   
--------------------------------------------------------------------------------------------------------------------------           
-- Traits           
--------------------------------------------------------------------------------------------------------------------------               
INSERT INTO Traits               
        (TraitType,                            Name,                                        Description)
VALUES    ('TRAIT_BILLIONAIRE',                'LOC_TRAIT_BILLIONAIRE',                    'LOC_TRAIT_BILLIONAIRE');
--------------------------------------------------------------------------------------------------------------------------
--TraitModifiers
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO TraitModifiers           
        (TraitType,                                            ModifierId)
VALUES    ('TRAIT_BILLIONAIRE',                                'TRAIT_ECONOMIC_GOVERNMENT_SLOT');
--------------------------------------------------------------------------------------------------------------------------
--LeaderTraits
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO LeaderTraits           
        (LeaderType,                                        TraitType)
VALUES    ('LEADER_WILHELMINA',                                'TRAIT_BILLIONAIRE');
DELETE FROM LeaderTraits WHERE TraitType='TRAIT_RADIO_ORANJE';

I'll probably try my hand at getting the localizations a bit later, but it works perfect right now.
 
Back
Top Bottom