Leader Trait Not Applying to Civ

JohnnyHoob

Chieftain
Joined
Feb 26, 2023
Messages
3
Hello,

I'm very new to modding and SQL in general, but I've been very interested in making some custom civs to play with friends. I've been looking through the site and found a template for new civilizations. I figured it would be easiest for me to understand what was happening by changing things slowly until it no longer works and working on that. I've been reading up on some guides about adding traits and leader abilities, but I'm having some trouble.

Currently, I'm trying to add a leader trait to my civ named "Well Fed" which will act similarly to the base game's Cleopatra ability. Her ability provides gold when other civs send a trade route, whereas I would like to provide 2 food to my civ (I also would like to add some domestic trade adjustments as well, but I'm taking it one step at a time.) Below is the current code I have:

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

INSERT INTO Traits
(TraitType, Name, Description )
VALUES ('TRAIT_LEADER_LSF_WELL_FED', 'LOC_TRAIT_LEADER_LSF_WELL_FED_NAME', 'LOC_TRAIT_LEADER_LSF_WELL_FED_DESCRIPTION' );

INSERT INTO LeaderTraits
(LeaderType, TraitType )
VALUES ('LEADER_LSF_WILLIAM_TAFT', 'TRAIT_LEADER_LSF_WELL_FED' );

INSERT INTO TraitModifiers
(TraitType, ModifierId, )
VALUES ('TRAIT_LEADER_LSF_WELL_FED', 'TRAIT_INCOMING_TRADE_GAIN_FOOD' );

INSERT INTO Modifiers
(ModifierId, ModifierType )
('TRAIT_INCOMING_TRADE_GAIN_FOOD' 'MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS');

INSERT INTO ModifierArguments
(ModifierId, Name, Value )
VALUES ('TRAIT_INCOMING_TRADE_GAIN_FOOD', 'YieldType', 'YIELD_FOOD' ),
('TRAIT_INCOMING_TRADE_GAIN_FOOD', 'Amount', '2' );


I think I have a basic understanding of what is happening with this code. I'm adding my new trait, assigning it to my leader, and then defining what that trait actually does. I've taken the 'MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS' from the Modifiers.xml file, and I've modeled my arguments from Cleo's ability in the Leader.xml by just changing my Yield Type to Yield Food.

I've tried to check the logs, but there's a lot of information and I'm not skilled at navigating them. Like I said, I'm very new to modding and SQL, so there may be a very simple thing I am missing.

Any help is appreciated!

Cheers
 
INSERT INTO Modifiers
(ModifierId, ModifierType )
('TRAIT_INCOMING_TRADE_GAIN_FOOD' 'MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS');
Not sure if this is the only fault, but from a quick scan, I can see you're missing a comma in this section. Specifically, after your 'TRAIT_INCOMING_TRADE_GAIN_FOOD' entry, there needs to be a comma.

This will be causing an error in your logs - but I appreciate that you're not necessarily able to make that link at this stage in your modding journey. I would add that comma, rebuild and try again.

Also, for testing, I recommend you disable all mods except your own - this'll help with simplifying your resultant log files. The two log files you'll want to check are Database.log and Modding.log. Database.log to identify errors. Modding.log to locate the files from which those errors are being generated.
 
Thanks so much for your reply. I reached out to a civ modding discord as well and they gave me the same fix, which worked. I now have a fully functional civ! Your template was so helpful and made it accessible, even to someone with no coding background whatsoever. Thanks!
 
Top Bottom