Civilization/Leader traits having no effect (modifiers)

maconnolly

Warlord
Joined
Jun 3, 2019
Messages
210
I feel a little disappointed to be returning and asking for help again - as I thought I had 'cracked it' through previous trial and error.

I'm creating a Civilization and have a Civilization and Leader trait (or unique ability), which I cannot get to take effect in-game.

I believe the code to be valid - it does not present any errors in either the Database.log nor the Modding.log. I can only assume there is a failure of logic on my side, somewhere.

Firstly, the Civilization UA. I would like that all of this civilization's 'foot troops' be granted +10 Combat Strength when they are within two tiles of a Holy Site. Here is my code to achieve it, as it stands:

Spoiler :
Code:
-----------------------------------------------
-- Types
-----------------------------------------------

INSERT INTO    Types
            (Type,                                                    Kind            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',            'KIND_TRAIT'    ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'KIND_ABILITY'    );

-----------------------------------------------
-- TypeTags
-----------------------------------------------

INSERT INTO TypeTags
            (Type,                                                    Tag                        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_RANGED'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_MELEE'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_RECON'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_ANTI_CAVALRY'    );

-----------------------------------------------
-- UnitAbilities
-----------------------------------------------

INSERT INTO UnitAbilities
            (UnitAbilityType,                                    Name,                                                        Description,                                                        Inactive        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_NAME',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_DESCRIPTION',        1                );

-----------------------------------------------
-- UnitAbilities
-----------------------------------------------

INSERT INTO UnitAbilityModifiers
            (UnitAbilityType,                                    ModifierId                                        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS'    );

-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits   
            (TraitType,                                            Name,                                                        Description                                                            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_NAME',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_DESCRIPTION'        );
       
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------

INSERT INTO    CivilizationTraits
            (CivilizationType,                    TraitType                                            )
VALUES        ('CIVILIZATION_MC_NORTECHICO',        'TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI'        );

-----------------------------------------------
-- TraitModifiers
-----------------------------------------------

INSERT INTO    TraitModifiers   
            (TraitType,                                            ModifierId                                            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS'        );

-----------------------------------------------
-- EmergencyBuffs
-----------------------------------------------

-----------------------------------------------
-- EmergencyRewards
-----------------------------------------------

-----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
            (ModifierId,                                        ModifierType,                                            SubjectRequirementSetId            )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH',            'PLOT_TWO_INCLUDE_HOLY_SITE'    );

-----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO    ModifierArguments
            (ModifierId,                                        Name,                Value        )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'Amount',            10            );

-----------------------------------------------
-- RequirementSets
-----------------------------------------------

INSERT INTO RequirementSets
            (RequirementSetId,                    RequirementSetType            )
VALUES        ('PLOT_TWO_INCLUDE_HOLY_SITE',        'REQUIREMENT_TEST_ALL'        );

-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
            (RequirementSetId,                    RequirementId                            )
VALUES        ('PLOT_TWO_INCLUDE_HOLY_SITE',        'REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE'    );

-----------------------------------------------
-- Requirements
-----------------------------------------------

INSERT INTO Requirements
            (RequirementId,                                RequirementType                                        )
VALUES        ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES'    );

-----------------------------------------------
-- RequirementArguments
-----------------------------------------------

INSERT INTO RequirementArguments
            (RequirementId,                                Name,                Value                        )
VALUES        ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'DistrictType',        'DISTRICT_HOLY_SITE'        ),
            ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'MinRange',            0                            ),
            ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'MaxRange',            2                            );

For the avoidance of doubt, I am accepting the four unit classes (CLASS_RANGED, CLASS_MELEE, CLASS_RECON and CLASS_ANTI_CAVALRY) to collectively equal the units I want to receive this bonus.

I have also attempted to deploy the same code as above, though with the UnitAbilities 'Inactive' boolean set the other way.

--

The second non-functional element is the Leader UA. I am attempting to grant this Leader a 50% boost to Holy Site production, alongside a 20% boost to the building of either Shrines or Temples. Here's my code:

Spoiler :
Code:
/*
    UA
    Authors: MC
*/

-----------------------------------------------
-- Types
-----------------------------------------------

INSERT INTO    Types
            (Type,                                                        Kind            )
VALUES        ('TRAIT_LEADER_TAPAC_YAURI',                                'KIND_TRAIT'    ),
--            ('MODIFIER_PLAYER_CITIES_ADJUST_RELIGIOUS_ERA_PRODUCTION',    'KIND_MODIFIER'    ),
            ('EFFECT_ADJUST_RELIGIOUS_ERA_PRODUCTION',                    'KIND_EFFECT'    );

-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits
            (TraitType,                        Name,                                    Description                                    )
VALUES        ('TRAIT_LEADER_TAPAC_YAURI',    'LOC_TRAIT_LEADER_TAPAC_YAURI_NAME',    'LOC_TRAIT_LEADER_TAPAC_YAURI_DESCRIPTION'    );
       
-----------------------------------------------
-- LeaderTraits
-----------------------------------------------

INSERT INTO    LeaderTraits
            (LeaderType,                TraitType                    )
VALUES        ('LEADER_MC_MANQU_QHAPAQ',    'TRAIT_LEADER_TAPAC_YAURI'    );

-----------------------------------------------
-- DyanmicModifiers
-----------------------------------------------

-- INSERT INTO DynamicModifiers
--                (ModifierType,                                                CollectionType,                    EffectType                                    )
-- VALUES        ('MODIFIER_PLAYER_CITIES_ADJUST_RELIGIOUS_ERA_PRODUCTION',    'COLLECTION_PLAYER_CITIES',        'EFFECT_ADJUST_RELIGIOUS_ERA_PRODUCTION'    );

-----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO Modifiers
            (ModifierId,                                        ModifierType,                                                RunOnce,        Permanent        )
VALUES        ('TRAIT_HOLYSITE_ANCIENTCLASSICAL_PRODUCTION',        'MODIFIER_PLAYER_CITIES_ADJUST_DISTRICT_PRODUCTION',        0,                0                ),
            ('TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION',    'MODIFIER_PLAYER_CITIES_ADJUST_BUILDING_PRODUCTION',        0,                0                );

-----------------------------------------------
-- TraitModifiers
-----------------------------------------------

INSERT INTO TraitModifiers 
            (TraitType,                        ModifierId                                            )
VALUES        ('TRAIT_LEADER_TAPAC_YAURI',    'TRAIT_HOLYSITE_ANCIENTCLASSICAL_PRODUCTION'        ),
            ('TRAIT_LEADER_TAPAC_YAURI',    'TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION'    );

-----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO ModifierArguments 
            (ModifierId,                                            Name,                Value                                )
VALUES        ('TRAIT_HOLYSITE_ANCIENTCLASSICAL_PRODUCTION',            'Amount',            50                                    ),
            ('TRAIT_HOLYSITE_ANCIENTCLASSICAL_PRODUCTION',            'DistrictType',        'DISTRICT_HOLY_SITE'                ),
           
            ('TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION',        'Amount',            20                                    ),
            ('TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION',        'BuildingType',        'BUILDING_SHRINE,BUILDING_TEMPLE'    );

You'll note the DynamicModifiers entry is commented-out. I have tried with this included - to no avail (same result, no errors, but no effect either). I have tried various combinations of the RunOnce and Permanent booleans for the entry into Modifiers, too. Same deal.

Am I making a rookie error here? For the Leader UA, I looked-up and followed the logic for the French 'Grand Tour' ability (TRAIT_WONDER_MEDIAVALINDUSTRIAL_PRODUCTION).

For the Civilization UA, my reference was the 'God of War' faith kills modifier (GOD_OF_WAR_FAITH_KILLS_MODIFIER), although of course there was a sensible divergence at the point of defining the ModifierType.

Any help forthcoming would be much appreciated. I promise to get better at this with time!
 
Code:
-----------------------------------------------
-- UnitAbilities
-----------------------------------------------

INSERT INTO UnitAbilityModifiers
            (UnitAbilityType,                                    ModifierId                                        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS'    );


-----------------------------------------------
-- TraitModifiers
-----------------------------------------------

INSERT INTO    TraitModifiers   
            (TraitType,                                            ModifierId                                            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS'        );
The TraitModifier needs to be a ModifierType that grants all of a player's units a Unitability. The Modifier for the Unitability needs to be a ModifierType that is direct to the individual unit rather than to all of a player's units:
Code:
-----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
            (ModifierId,                                        ModifierType,                                            SubjectRequirementSetId            )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH',            'PLOT_TWO_INCLUDE_HOLY_SITE'    );
TraitModifier == MODIFIER_PLAYER_UNITS_GRANT_ABILITY

AbilityModifier == MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH

[table=head]ModifierType | CollectionType | EffectType
MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH | COLLECTION_PLAYER_COMBAT | EFFECT_ADJUST_PLAYER_STRENGTH_MODIFIER
MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH | COLLECTION_UNIT_COMBAT | EFFECT_ADJUST_PLAYER_STRENGTH_MODIFIER[/table]Even though the EffectType is the same the collection these modifiers affect are substantially different. The Player one affects all the player's units and so as a general rule does not belong associated with a Unitability. The Unit one is more appropriate to a Unitability.

And the reason some of the code you were attempting never did anything is that you never gave the Ability to any units. Adding the Modifier directly to the Trait simply causes the game to not do anything in many of these cases because a Trait is a stand-in for a player (a player can never be anywhere on the map) -- thus the method of the Trait Modifier granting a Unitability, and the actual effective modifier is applied to the UnitAbility rather than directly to the Trait, which avoids these conditions where the game is not able to parse out how to execute the effects and the requirements if the modifier were attached directly to a Trait.
 
Last edited:
Thank you. I've read this advice/guidance, digested it, but not had a chance to do so alongside my existing code and make the amendments.

I will report back on things once I have that chance. But thank you so much.
 
OK, so I've tried to iterate and re-build the logic, just in case I have missed anything obvious - perhaps I am just suffering from over-familiarity with this at this stage.

Neither my Leader UA nor my Civilization UA are functioning. Neither cause errors - they simply have no effect. You'll note that for the Leader UA I have amended the effect to simply provide a 50% production boost to the Monument building (for immediate testing in a new game). The Civilization UA should provide a 20% Combat Strength boost when within 5 tiles of a City Center.

Is there anyone that can help steer me on where I'm going wrong? What am I missing?

Leader UA:

Spoiler :
Code:
-----------------------------------------------
-- Types
-----------------------------------------------

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

-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits
            (TraitType,                        Name,                                    Description                                    )
VALUES        ('TRAIT_LEADER_TAPAC_YAURI',    'LOC_TRAIT_LEADER_TAPAC_YAURI_NAME',    'LOC_TRAIT_LEADER_TAPAC_YAURI_DESCRIPTION'    );
       
INSERT INTO AiListTypes
            (ListType            )
VALUES        ('ManquBuildings'    );

INSERT INTO AiLists
            (ListType,                LeaderType,                        System            )
VALUES        ('ManquBuildings',        'TRAIT_LEADER_TAPAC_YAURI',        'Buildings'        );

INSERT INTO AiFavoredItems
            (ListType,                Item,                            Favored            )
VALUES        ('ManquBuildings',        'BUILDING_MONUMENT',            1                );

-----------------------------------------------
-- LeaderTraits
-----------------------------------------------

INSERT INTO    LeaderTraits
            (LeaderType,                TraitType                    )
VALUES        ('LEADER_MC_MANQU_QHAPAQ',    'TRAIT_LEADER_TAPAC_YAURI'    );

-----------------------------------------------
-- TraitModifiers
-----------------------------------------------

INSERT INTO TraitModifiers 
            (TraitType,                        ModifierId                                            )
VALUES        ('TRAIT_LEADER_TAPAC_YAURI',    'TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION'    );
--            ('TRAIT_LEADER_TAPAC_YAURI',    'TRAIT_HOLYSITE_ANCIENTCLASSICAL_PRODUCTION'        )

-----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO Modifiers
            (ModifierId,                                        ModifierType                                            )
VALUES        ('TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION',    'MODIFIER_PLAYER_CITIES_ADJUST_BUILDING_PRODUCTION'        );

-----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO ModifierArguments 
            (ModifierId,                                            Name,                Value                                )
VALUES        ('TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION',        'BuildingType',        'BUILDING_MONUMENT'                    ),
            ('TRAIT_SHRINETEMPLE_ANCIENTCLASSICAL_PRODUCTION',        'Amount',            50                                    );

Civilization UA:

Spoiler :
Code:
-----------------------------------------------
-- Types
-----------------------------------------------

INSERT INTO    Types
            (Type,                                                    Kind            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',            'KIND_TRAIT'    ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'KIND_ABILITY'    );

-----------------------------------------------
-- TypeTags
-----------------------------------------------

INSERT INTO TypeTags
            (Type,                                                    Tag                        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_RANGED'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_MELEE'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_RECON'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_ANTI_CAVALRY'    );

-----------------------------------------------
-- UnitAbilities
-----------------------------------------------

INSERT INTO UnitAbilities
            (UnitAbilityType,                                    Name,                                                        Description,                                                        Inactive        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_NAME',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_DESCRIPTION',        1                );

-----------------------------------------------
-- UnitAbilities
-----------------------------------------------

INSERT INTO UnitAbilityModifiers
            (UnitAbilityType,                                    ModifierId                                        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS'    );

-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits   
            (TraitType,                                            Name,                                                        Description                                                            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_NAME',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_DESCRIPTION'        );
       
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------

INSERT INTO    CivilizationTraits
            (CivilizationType,                    TraitType                                            )
VALUES        ('CIVILIZATION_MC_NORTECHICO',        'TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI'        );

-----------------------------------------------
-- TraitModifiers
-----------------------------------------------

INSERT INTO    TraitModifiers   
            (TraitType,                                            ModifierId                                            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY'    );

-----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
            (ModifierId,                                        ModifierType,                                            SubjectRequirementSetId            )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY',    'MODIFIER_PLAYER_UNITS_GRANT_ABILITY',                    null                            ),
            ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH',            'PLOT_TWO_INCLUDE_HOLY_SITE'    );

-----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO    ModifierArguments
            (ModifierId,                                        Name,                Value                                                )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'Percent',            20                                                    ),
            ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY',    'AbilityType',        'ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES'        );

-----------------------------------------------
-- RequirementSets
-----------------------------------------------

INSERT INTO RequirementSets
            (RequirementSetId,                    RequirementSetType            )
VALUES        ('PLOT_TWO_INCLUDE_HOLY_SITE',        'REQUIREMENT_TEST_ALL'        );

-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
            (RequirementSetId,                    RequirementId                            )
VALUES        ('PLOT_TWO_INCLUDE_HOLY_SITE',        'REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE'    );

-----------------------------------------------
-- Requirements
-----------------------------------------------

INSERT INTO Requirements
            (RequirementId,                                RequirementType                                        )
VALUES        ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES'    );

-----------------------------------------------
-- RequirementArguments
-----------------------------------------------

INSERT INTO RequirementArguments
            (RequirementId,                                Name,                Value                        )
VALUES        ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'DistrictType',        'DISTRICT_CITY_CENTER'        ),
            ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'MinRange',            0                            ),
            ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'MaxRange',            5                            );
 
I hate to ‘bump’ my own thread, but I have become completely stuck and it’s preventing me from progressing further.

I don’t feel like the UA’s I’m going for are that complex, so would be keen to understand the flaw in my logic/code. If anyone brighter than me can troubleshoot I’d really appreciate it. I’m keen to learn and then continue my own work as well as help others.
 
Zip and post the actual mod. I don't see anything wrong from an examination of the Leader effect, so there may be something incorrect in the structure of the mod itself.
  1. Zip the version of the mod the game is actually trying to use, which will be found as a sub-folder in ~\Documents\My Games\Sid Meier's Civilization VI\Mods. Zip the whole sub-folder for your mod.
  2. To attach the zip to a forum post, look for a button called Upload A File when composing your thread reply: this button opens a browse menu where you can select the zipped folder to attach directly to a forum post.
 
Of course - please find it attached, following a fresh build in ModBuddy.

It's worth noting that the version built - which I've tested and is not working in the same way - uses a Percentage increase of 20% to Combat Strength when within a five-tile radius of a Holy Site. The extra radius is just for easier testing in-game.

Similarly, I've re-constructed the Civilization UA to aim to give a 50% reduction in the build cost of a Monument - again, for more immediate testing. Running through a number of turns to get to a Holy Site and then testing was, well, a nightmare - and I'm not versed in FireTuner just yet.

Obviously these changes retain the exact same principles/coding structure, so I hope you understand I'm not pulling the carpet out from under you in terms of subsequent versions, but rather making like-for-like changes that I expect are 'failing' for the same reason (whatever that is).
 

Attachments

You do have one small goof in Modbuddy here
Code:
  <FrontEndActions>
    <UpdateDatabase id="NewAction">
      <File>Leader/Leader_Config.sql</File>
      <File>Core/NewIcons.sql</File>
    </UpdateDatabase>
The NewIcons.sql file should not be listed under that action. It's Icons code. You also have the file properly listed in the FrontEnd under an "UpdateIcons" action.

The 50% extra production toward Monuments is working just fine for me. The User Interface however does not specifically list this when mousing over a city's "cogs" icon, but the effect is being implemented.

Erm:
Code:
INSERT INTO RequirementArguments
		(RequirementId,					Name,			Value			)
VALUES		('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',		'DistrictType',		'DISTRICT_CITY_CENTER'	),
		('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',		'MinRange',		0			),
		('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',		'MaxRange',		5			);
Looking at other modifiers that use "MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH", I am as sure as I can be at this point that you need 'Amount' instead of 'Percent' here:
Code:
INSERT INTO	ModifierArguments
		(ModifierId,						Name,			Value												)
VALUES		('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',		'Percent',		20													),
		('MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY',	'AbilityType',		'ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES'		);
I can't think of any instances off the top of my head where an "X_ADJUST_COMBAT_STRENGTH" ModifierType used a 'Percent' argument -- so far as I can recall they all use 'Amount'. Even though the word 'modifier' often is used to imply 'percentage' in the wider usage of the term, in Civ6 'modifier' and 'modify' don't necessarily imply percentage, and especially for unit combat strengths a direct combat strength change amount is used. So a value of '5' literally adds 5 combat strength regardless of whether the unit's previous strength was 5 or 100. But Firaxis is not very consistent on defining the various ModifierTypes they've already provided to make it clear what will be (and need) a percentage and what will be and need a direct integer change value.
 
Also, you may need to add an additional requirement that the Holy Site belong to the owner of the unit, otherwise I think the game may apply the effect for any Holy Site owned by anyone. If this was not your intent, then more fun requirements code will be needed.
 
Thanks Lee!

Regarding the NewIcons.sql - to be honest, this generates an error/warning regarding IconTextureAtlases...but it never dawned on me (nor did I care to check, with my other issues taking priority) regarding the UpdateType it was sitting under. I'll amend that right now before I invariably forget.

LeeS said:
The 50% extra production toward Monuments is working just fine for me. The User Interface however does not specifically list this when mousing over a city's "cogs" icon, but the effect is being implemented.

I feel silly for not 'realising' this. I think I was just expecting it to be visually represented by the lower Production cost in the UI. I presume this kind of change simply can't be represented in that City UI.

On the next point, I presume you're referring to the DistrictType - that is my bad. It was intended to be another caveat in my description; I amended this to use the DISTRICT_CITY_CENTER for testing, owing to the same problem of waiting to build the Holy Site later in the game. I suspect the problem itself relates to:

LeeS said:
I am as sure as I can be at this point that you need 'Amount' instead of 'Percent' here

I'll implement the changes and test again, properly, to see if the functionality is there.

--

EDIT: To take into account your second reply:

LeeS said:
Also, you may need to add an additional requirement that the Holy Site belong to the owner of the unit, otherwise I think the game may apply the effect for any Holy Site owned by anyone. If this was not your intent, then more fun requirements code will be needed.

Ironically, my original wish was to have this apply to all Holy Sites, irrespective of owner, but restrict the units to which this applies. I then bailed on that idea, thinking it would be more difficult and so in the current mod - which you are troubleshooting - the intention is for the effect only to apply to 'foot troops' for that civilization's Holy Sites. I'll square this up in my mind and then proceed accordingly, pending the other items that need resolving.

As always - thanks. I feel like you're a one-man-band fixing my code at the moment. I feel like I owe you a beer (or several)! If you have a mechanism via which you take donations, I'm all ears.
 
LeeS said:
The User Interface however does not specifically list this

This, actually, now has me thinking that perhaps the Combat Strength bonus applied when within a certain distance of the district is also simply not represented on the UI. I'll need to dig into that - as I vaguely recall seeing entries that define these tooltips somewhere. Or perhaps I'm making it up in some vain hope that it's all working even though I can't see it!

EDIT: There's a series of LOC_COMBAT_PREVIEW strings that essentially define what can/will show up on the Combat Preview dialogue. This explains, perhaps, why there's no visual representation of the CS bonus. I think as a first step, I'll just hugely exaggerate the bonus to see if it's taking effect - then work out how we make it visible to the player.
 
So far, still no luck on the CS bonus (unit ability).

Thanks to FireTuner, I have a much simpler process for testing, though - which is helping. I wish I'd spent two minutes learning it weeks ago!

It appears that the UnitAbility is being applied correctly - inspecting in FireTuner shows that the units get the ability applied to them. Naturally, for this to happen,
MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY is present (as this is what grants that ability).

However, something's not right with the other modifier (
MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS), which is what gives the unit the CS boost. I'll keep testing - but the fact it does not appear at all in the Modifiers list (in FireTuner) suggests there's a failure somewhere.
 
Sigh. I'm back - as I have, pretty much, exhausted my options and still do not understand why the Civilization UA does not work.

The code is included further below. I have taken every precaution I can to use the base-game as a reference point. I've even taken out the requirements (to have the modifier take effect) to try and simplify things. Alas, the Modifier (MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS) does not appear to be present in-game (according to FireTuner and, indeed, the in-game effects.

I've 'extracted' (from the base-game) all entries pertaining to Tomyris' unique UnitAbilityType where she receives a combat bonus versus wounded enemy units. The code logic matches like-for-like. Thinking there may be some discrepancy within the expansions, I checked their schema and see nothing appended/different. I checked the presence of the Tomyris Modifier in FireTuner - it appears. I even thought that perhaps the ModifierType MODIFIER_PLAYER_UNITS_GRANT_ABILITY was not allowed on CivilizationTraits (which mine is), but only LeaderTraits (which Tomyris' is). But that's not the case. Norway - and others, I suspect - have CivilizationTraits that use modifiers of the MODIFIER_PLAYER_UNITS_GRANT_ABILITY type.

Nothing in Database.log or Modding.log. The mod loads and all other elements are there.

Within the INSERT INTO UnitAbilities, I have tried both values for the Inactive boolean. I started with 'true' (1) because it matched Tomyris' modifier, although having stripped the SubjectRequirementSetId entry from the INSERT INTO Modifiers I changed it to 'false' (0) as it seemed to make sense.

This tiny thing has bugged me for weeks, now. If anyone can save the day and point out the flaw(s), I owe you. Dare I say it, this has become personal.

Summary: :wallbash:

Spoiler :
Code:
-----------------------------------------------
-- Types
-----------------------------------------------

INSERT INTO    Types
            (Type,                                                    Kind            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',            'KIND_TRAIT'    ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'KIND_ABILITY'    );

-----------------------------------------------
-- TypeTags
-----------------------------------------------

INSERT INTO TypeTags
            (Type,                                                    Tag                        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_RANGED'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_MELEE'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_RECON'            ),
            ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',            'CLASS_ANTI_CAVALRY'    );

-----------------------------------------------
-- UnitAbilities
-----------------------------------------------

INSERT INTO UnitAbilities
            (UnitAbilityType,                                    Name,                                                        Description,                                                        Inactive        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_NAME',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_DESCRIPTION',        1                );

-----------------------------------------------
-- UnitAbilities

-----------------------------------------------

INSERT INTO UnitAbilityModifiers
            (UnitAbilityType,                                    ModifierId                                        )
VALUES        ('ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS'    );

-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits   
            (TraitType,                                            Name,                                                        Description                                                            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_NAME',        'LOC_TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI_DESCRIPTION'        );
       
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------

INSERT INTO    CivilizationTraits
            (CivilizationType,                    TraitType                                            )
VALUES        ('CIVILIZATION_MC_NORTECHICO',        'TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI'        );

-----------------------------------------------
-- TraitModifiers

-----------------------------------------------

INSERT INTO    TraitModifiers   
            (TraitType,                                            ModifierId                                            )
VALUES        ('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY'    );

-----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
            (ModifierId,                                        ModifierType,                                            SubjectRequirementSetId            )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY',    'MODIFIER_PLAYER_UNITS_GRANT_ABILITY',                    null                            ),
            ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH',                    null                            );

-----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO    ModifierArguments
            (ModifierId,                                        Name,                Value                                                )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_UNIT_ABILITY',    'AbilityType',        'ABILITY_NORTECHICO_CS_BONUS_NEAR_HOLY_SITES'        ),
            ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'Amount',            10                                                    );

-----------------------------------------------
-- RequirementSets
-----------------------------------------------

INSERT INTO RequirementSets
            (RequirementSetId,                    RequirementSetType            )
VALUES        ('PLOT_TWO_INCLUDE_HOLY_SITE',        'REQUIREMENT_TEST_ALL'        );

-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
            (RequirementSetId,                    RequirementId                            )
VALUES        ('PLOT_TWO_INCLUDE_HOLY_SITE',        'REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE'    );

-----------------------------------------------
-- Requirements
-----------------------------------------------

INSERT INTO Requirements
            (RequirementId,                                RequirementType                                        )
VALUES        ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES'    );

-----------------------------------------------
-- RequirementArguments
-----------------------------------------------

INSERT INTO RequirementArguments
            (RequirementId,                                Name,                Value                        )
VALUES        ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'DistrictType',        'DISTRICT_HOLY_SITE'        ),
            ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'MinRange',            0                            ),
            ('REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE',        'MaxRange',            2                            );

-----------------------------------------------
-- ModifierStrings
-----------------------------------------------

INSERT INTO ModifierStrings
            (ModifierId,                                        Context,        Text                                                    )
VALUES        ('MODIFIER_SANCTUARY_OF_THE_KONTIKI_CS_BONUS',        'Preview',        'LOC_COMBAT_PREVIEW_TRAIT_SANCTUARY_OF_THE_KONTIKI'        );
 
I can't see anything you are doing wrong, to be honest. Since the game does not seem to follow the logic via a Unitability, try this direct method of adjusting player unit combat strengths. You'll have to translate most of it into valid SQL inserts but the logic should be sound
Code:
"Requirements"
RequirementId					RequirementType
REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE		REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES
SANCTUARY_OF_THE_KONTIKI_UNIT_REQUIREMENTS	REQUIREMENT_REQUIREMENTSET_IS_MET

"RequirementArguments"
RequirementId					Name			Value
REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE		DistrictType		DISTRICT_HOLY_SITE
REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE		MaxRange		2
REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE		MinRange		0
SANCTUARY_OF_THE_KONTIKI_UNIT_REQUIREMENTS	RequirementSetId	KONTIKI_UNITS_REQUIREMENTSET	

"RequirementSetRequirements"
RequirementSetId		RequirementId
PLOT_TWO_INCLUDE_HOLY_SITE	REQUIRES_PLOT_WITHIN_TWO_HOLY_SITE
PLOT_TWO_INCLUDE_HOLY_SITE	SANCTUARY_OF_THE_KONTIKI_UNIT_REQUIREMENTS
KONTIKI_UNITS_REQUIREMENTSET	RECON_UNITS
KONTIKI_UNITS_REQUIREMENTSET	REQUIREMENT_UNIT_IS_MELEE
KONTIKI_UNITS_REQUIREMENTSET	REQUIREMENT_UNIT_IS_RANGED
KONTIKI_UNITS_REQUIREMENTSET	REQUIREMENT_UNIT_IS_ANTI_CAV


"RequirementSets"
RequirementSetId		RequirementSetType
PLOT_TWO_INCLUDE_HOLY_SITE	REQUIREMENTSET_TEST_ALL
KONTIKI_UNITS_REQUIREMENTSET	REQUIREMENTSET_TEST_ANY

"Modifiers"
ModifierId					ModifierType						SubjectRequirementSetId
SANCTUARY_OF_THE_KONTIKI_UNITS_MODIFIER		MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH		PLOT_TWO_INCLUDE_HOLY_SITE

"ModifierArguments"
ModifierId					Name				Value
SANCTUARY_OF_THE_KONTIKI_UNITS_MODIFIER		Amount				10

INSERT INTO    TraitModifiers   
		(TraitType,                                            ModifierId                                            )
VALUES		('TRAIT_CIVILIZATION_SANCTUARY_OF_THE_KONTIKI',        'SANCTUARY_OF_THE_KONTIKI_UNITS_MODIFIER'    );
So essentially this method is ditching the Unitability and directly making the effect via a TraitModifier, with requirements for the Holy Site distance and the needed types of units.


These requirement Ids are already defined by and used in the base game so you can safely re-use them without needing to define anything in table Requirements or RequirementArguments for them
Code:
RECON_UNITS
REQUIREMENT_UNIT_IS_MELEE
REQUIREMENT_UNIT_IS_RANGED
REQUIREMENT_UNIT_IS_ANTI_CAV
 
Lee - thank you for this alternative approach. Very novel - and I would never have thought of it.

I haven't tested it yet. But I will of course advise on how things go.
 
OK, so the plot thickens a little on this one. Partly through a mistake in my code, which I somehow introduced between copy-pasting it in here and building the mod. In addition, I now realise I was looking in the wrong place (in FireTuner) for the presence of the Modifier that is attached by the UnitAbility.

The code error was a missing semi-colon at the very end of the document. I think this didn't generate an error in Database.log because, typically, that throws an error up based on the next bit of the syntax. As such, I don't think it had a way to reference 'the next bit of the syntax' - because there wasn't any.

What this served to do was (I think) cause the Combat Preview not to show. This made me think no effect was being applied, even where the Requirements were not attached to the Modifier.

Long story short, I added the semi-colon and everything works as intended - when the SubjectRequirementSetId is set to null. The Combat Preview shows, which is a great indication that the Modifier is applied to that unit. Happy days.

However, when I reintroduce the SubjectRequirementSetId and I set it to PLOT_TWO_INCLUDE_HOLY_SITE, it no longer activates that Modifier. So the issue is with the requirements, I think.

FireTuner correctly identifies the Subject Requirements - it appears there. However, it doesn't show the unit in the list below, nor indicate the status of Met/Unmet for those requirements. Basically, I don't think it is trying to execute the requirements - therefore, it can't determine if the result is True, to then apply the Modifier's effect.

I am going to try and code this in using the alternative code - to see if that reaches the functionality - but I would like to take this opportunity to learn about the way these requirements are processed. This particular Modifier changes Combat Strength based on proximity to a District, so when should it run that check? Is it only at the point that combat is instigated? Or would it update that unit's combat value every turn based on its position? Either way, is there some other limiting factor - for example, are certain RequirementSet 'check' schedules only applicable to Owner Requirements, versus Subject Requirements?

I can't help but feel that I'm very close to getting there and this would probably get me to a point where I can comfortably mod without turning to the forum for assistance over-and-over; but there's just one final piece missing...
 
I bloody found it. At. Last. Actually, it was a fairly 'fundamental' mistake.

Code:
INSERT INTO RequirementSets
           (RequirementSetId,                    RequirementSetType            )
VALUES        ('PLOT_TWO_INCLUDE_HOLY_SITE',        'REQUIREMENT_TEST_ALL'        );

The RequirementSetType needed to be REQUIREMENTSET_TEST_ALL, rather than REQUIREMENT_TEST_ALL.

I amended this and it works as expected. Anyway, that is another step forward...I won't make that mistake again!

LeeS - thank you for all your efforts on this. I actually did try the alternative method you suggested, briefly - it did not work. But it did not work for the same reason - I copy-pasted my errant REQUIREMENT_TEST_ALL string as a base.[/CODE]
 
Yep. That'll do it. Completely missed that typo myself in your code. And you don't get database errors for that since the RequirementSetType column does not 'reference' to anything needed else where in another table. It just requires a text-string and expects the entry to be one of the ones the game actually understands.
 
Yep. That'll do it. Completely missed that typo myself in your code. And you don't get database errors for that since the RequirementSetType column does not 'reference' to anything needed else where in another table. It just requires a text-string and expects the entry to be one of the ones the game actually understands.

Yeah, as soon as I found the error, my first thought was 'if only it had told me...' but, alas, it's something baked in/not referenced explicitly. I'm too tired, right this second, to be annoyed - so I'll just take the silver lining that I will never make that same error again (famous last words).

The irony was that I had given up and was planning to use something in the game that was close - but not the same - when I noticed a discrepancy in what I thought was the case. That was enough to prod me to do a like-for-like replacement of entries per table, which led to me spotting it.

Along the lines of the implicit REQUIREMENTSET_TEST_ strings, I think I found the game does similarly with certain other terms, such as ADJACENT. There's a RequirementId called REQUIRES_PLOT_ADJACENT_HOLY_SITE. It's RequirementArguments include DistrictType="DISTRICT_HOLY_SITE" and MinRange="0". But no MaxRange="1", which leads me to believe that the maximum range is somehow implied from the RequirementId name. Little nuances like that can really throw your understanding off when you're trying to use the existing code for a helping hand.
 
The 'implied' part will not be related to the RequirementId name. You can copy everything related to that requirementId and rename it REQUIRES_CHEESEBURGERS and it will work in the same way. The implied 'distance' will be in the RequirementType. And since we have no access to the game's DLL sourcecode we can only guess as to whether or not 'MaxRange' is defaulted to '1' when no argument for 'MaxRange' is supplied.

These sorts of issues were what disappointed me at the announcement that the DLL sourcecode will not be released in any foreseeable future.
 
Back
Top Bottom