Quick Modding Questions Thread

First you need to have all the Cost values for Ancient Era Civics less than the lowest cost value of any Civic in the Classical Era, and so on for each respective pair of eras. Otherwise this borks the code in the lua file that assigns the positions in the display.

Second you need to ensure that the CivicPrereqs table is properly constructed after your changes and does not have logical conflicts with the costs and positioning on the tree you are aiming after.
I have done pretty much the exact same with the technology tree and it displays properly, seen here (more expensive to the right)
https://i.imgur.com/3GpYPAY.png
which leads me to believe that the costs need not be cheaper than the costs of the next era? unless this only applies to civics.
For some reason in my civics tree, techs with higher costs are being displayed in the same column as civics with lower costs, and the tech tree isn't having the same problem.
https://i.imgur.com/Mr1XSD7.png
As for CivicPrereqs, how would this conflict with costs? I also have Techs requiring techs that are more expensive, displays fine in the tech tree
 
Quick Modding Question:
Has anyone successfully attached:
MODIFIER_PLAYER_UNIT_ADJUST_IGNORE_RESOURCE_MAINTENANCE
with Admiral?
This Modifier works with land units correctly, but when used spawning a naval unit, it still does have a resource maintenance.
EDIT:
For Reference:
This works as intended:
Code:
INSERT INTO GreatPersonIndividualActionModifiers (GreatPersonIndividualType, ModifierId, AttachmentTargetType)
VALUES ('GREAT_PERSON_INDIVIDUAL_THE_GRAND_COMMANDER', 'GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT', 'GREAT_PERSON_ACTION_ATTACHMENT_TARGET_UNIT_GREATPERSON'),
       ('GREAT_PERSON_INDIVIDUAL_THE_GRAND_COMMANDER', 'GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT_NO_RESOURCE_MAINTENANCE', 'GREAT_PERSON_ACTION_ATTACHMENT_TARGET_UNIT_DOMAIN_MILITARY_IN_TILE');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId)
VALUES ('GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT', 'MODIFIER_PLAYER_UNIT_GRANT_UNIT_WITH_EXPERIENCE', 1, 1, NULL),
       ('GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT_NO_RESOURCE_MAINTENANCE', 'MODIFIER_PLAYER_UNIT_ADJUST_IGNORE_RESOURCE_MAINTENANCE', 1, 1, NULL);

INSERT INTO ModifierArguments (ModifierId, Name, Value)
VALUES ('GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT', 'UnitType', 'UNIT_TANK'),
       ('GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT', 'Experience', 0),
       ('GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT', 'UniqueOverride', 1),
       ('GREATPERSON_THE_GRAND_COMMANDER_GRANT_UNIT_NO_RESOURCE_MAINTENANCE', 'Ignore', 1);
This one spawns a naval unit that still have resource maintenance:
Code:
INSERT INTO GreatPersonIndividualActionModifiers (GreatPersonIndividualType, ModifierId, AttachmentTargetType)
VALUES ('GREAT_PERSON_INDIVIDUAL_THE_GRAND_ADMIRAL', 'GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT', 'GREAT_PERSON_ACTION_ATTACHMENT_TARGET_UNIT_GREATPERSON'),
       ('GREAT_PERSON_INDIVIDUAL_THE_GRAND_ADMIRAL', 'GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT_NO_RESOURCE_MAINTENANCE', 'GREAT_PERSON_ACTION_ATTACHMENT_TARGET_UNIT_DOMAIN_MILITARY_IN_TILE');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId)
VALUES ('GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT', 'MODIFIER_PLAYER_UNIT_GRANT_UNIT_WITH_EXPERIENCE', 1, 1, NULL),
       ('GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT_NO_RESOURCE_MAINTENANCE', 'MODIFIER_PLAYER_UNIT_ADJUST_IGNORE_RESOURCE_MAINTENANCE', 1, 1, NULL);

INSERT INTO ModifierArguments (ModifierId, Name, Value)
VALUES ('GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT', 'UnitType', 'UNIT_SHIP_OF_THE_LINE'),
       ('GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT', 'Experience', 0),
       ('GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT', 'UniqueOverride', 1),
       ('GREATPERSON_THE_GRAND_ADMIRAL_GRANT_UNIT_NO_RESOURCE_MAINTENANCE', 'Ignore', 1);
 
Last edited:
anyone know what likeliness does in the requirements table?
upload_2021-1-20_21-48-56.png
 
No idea since neither Likeliness nor Impact appear to be used anywhere in any Gameplay XML files of the base game, expansions, DLC, scenarios, or in any of the code for the NFP modes.
 
No idea since neither Likeliness nor Impact appear to be used anywhere in any Gameplay XML files of the base game, expansions, DLC, scenarios, or in any of the code for the NFP modes.
Maybe one day we'll get a full API for civ6.

I mean maybe they didn't give it to us because at some point they were planning to release the source (that would have been redundant), but now that they don't plan it anymore that's one of the critical things (ie "how do we use what we have access to") missing for civ6 modding.
 
And maybe they don't have one on their side either :think:

I remember they shared (parts of) the internal documentation with us in a patch of the modding tools, so, yes, it's worth asking.
 
Hi guys!

How can I access the game setup options from my gameplay SQL?

Specifically, I added a boolean checkbox option to the game setup screen here:

Code:
INSERT INTO Parameters (ParameterId, Name, Description, Domain, DefaultValue,
ConfigurationGroup, ConfigurationId, GroupId, Visible, ReadOnly,
SupportsSinglePlayer, SupportsLANMultiplayer, SupportsInternetMultiplayer, SupportsHotSeat, SupportsPlayByCloud,
ChangeableAfterGameStart, ChangeableAfterPlayByCloudMatchCreate, SortIndex) VALUES
('SDG_ALL_RELIGIONS_CUSTOM', 'SDG - All Custom Names', 'The names for all relgions can be customized, but the AI chooses blank names', 'bool', 0,
'Game', 'SDG_ALL_RELIGIONS_CUSTOM', 'GameOptions', 1, 0,
1, 1, 1, 1, 1,
0, 0, 81) ;

And now I want to access the selection from game setup in a Gameplay sql command like so:
Code:
UPDATE Religions SET RequiresCustomName = 1 WHERE ReligionType != 'RELIGION_PANTHEON' AND
1 IN (SELECT SDG_ALL_RELIGIONS_CUSTOM FROM Parameters) ;

It's the parenthetical part of that last line that I can't figure out.

Thanks!

Kind regards,
DB
 
If by this you mean how can you make an InGameActions UpdateDatabase file access something from a FrontEndActions UpdateDatabase file, then the answer is it is not possible.
 
Have a look on this Mod: "Configure Diplomatic Victory Points". It let's you set the DV Points in the Set-Up Menu (in the Database fills the appropriate Entry). You can use it as an example.
 
It's as LeeS said.

But maybe you could use <Criteria> and <ConfigurationValueMatches> in the .modinfo to load a single Gameplay sql with the first part of your query

example
Code:
        <Criteria id="GranColombiaMaya_Mode_Expansion2">
            <RuleSetInUse>RULESET_EXPANSION_2</RuleSetInUse>
            <ConfigurationValueMatches>
                <Group>Game</Group>
                <ConfigurationId>GAMEMODE_APOCALYPSE</ConfigurationId>
                <Value>1</Value>
            </ConfigurationValueMatches>
        </Criteria>
 
Thanks so much all of you!

Configure Diplomatic Victory Points does it exactly as Gedemon suggested: it has a separate sql file for each VP choice (20.sql, 21.sql, etc.).

I can do the same for my options. It's not what I was expecting, but it will work. Glad I asked because I don't think I would have ever figured that out on my own.

Kind regards,
DB
 
Have a look on this Mod: "Configure Diplomatic Victory Points". It let's you set the DV Points in the Set-Up Menu
Is the current Value of the GlobalParameter 'DIPLOMATIC_VICTORY_POINTS_REQUIRED' stored in the save files (i.e. fix for the whole game) _or_ [after complete exit & new start of civ6 & reloaded save] read from the Database, which could be different from that in the previous session (i.e. DV Points possibly depending on the development of the current game)?

 
Codings to adjust specific unit strenghts. This one is to use TECH_IRONWORKING to adjust specific Ancient era units.
Code:
<GameData>
   <Technologies>
       <Update> <Where TechnologyType="TECH_IRON_WORKING" /> <Set Description="LOC_TECH_IRON_WORKING_DESCRIPTION" /> </Update>
   </Technologies>
   <Tags>
       <Row Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE" Vocabulary="ABILITY_CLASS"/> <!--Melee and Anticavs Upgrade-->
       <Row Tag="CLASS_IRONWEAPONS_UPGRADE_RANGED" Vocabulary="ABILITY_CLASS"/> <!--Ranged Upgrades-->
   </Tags>
 
       <Modifiers>
       <Row> <ModifierId>IRONWEAPONS_ADJUST_COMBAT_STRENGHT</ModifierId> <ModifierType>MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH</ModifierType> <SubjectRequirementSetId>IRONWEAPONS_MELEE_REQUIREMENTS</SubjectRequirementSetId> </Row>
       <Row> <ModifierId>IRONWEAPONS_ADJUST_RANGED_STRENGHT</ModifierId> <ModifierType>MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH</ModifierType> <SubjectRequirementSetId>IRONWEAPONS_RANGED_REQUIREMENTS</SubjectRequirementSetId> </Row>
   </Modifiers>
   <ModifierArguments>
       <Row> <ModifierId>IRONWEAPONS_ADJUST_COMBAT_STRENGHT</ModifierId> <Name>Amount</Name> <Value>8</Value> </Row>
       <Row> <ModifierId>IRONWEAPONS_ADJUST_RANGED_STRENGHT</ModifierId> <Name>Amount</Name> <Value>8</Value> </Row>
   </ModifierArguments>
   <RequirementSets>
       <Row> <RequirementSetId>IRONWEAPONS_MELEE_REQUIREMENTS</RequirementSetId> <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType> </Row>
       <Row> <RequirementSetId>IRONWEAPONS_RANGED_REQUIREMENTS</RequirementSetId> <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType> </Row>
   </RequirementSets>
   <RequirementSetRequirements>
       <!--Iron Weapons adjusts unit H2H strenght-->
       <Row> <RequirementSetId>IRONWEAPONS_MELEE_REQUIREMENTS</RequirementSetId> <RequirementId>UNIT_CLASS_IRONWEAPONS_UPGRADE_MELEE</RequirementId> </Row>
       <Row> <RequirementSetId>IRONWEAPONS_MELEE_REQUIREMENTS</RequirementSetId> <RequirementId>MELEE_COMBAT_REQUIREMENTS</RequirementId> </Row>
       <!--Iron Weapons adjusts unit ranged strenght-->
       <Row> <RequirementSetId>IRONWEAPONS_RANGED_REQUIREMENTS</RequirementSetId> <RequirementId>UNIT_CLASS_IRONWEAPONS_UPGRADE_RANGED</RequirementId> </Row>
       <Row> <RequirementSetId>IRONWEAPONS_RANGED_REQUIREMENTS</RequirementSetId> <RequirementId>RANGED_COMBAT_REQUIREMENTS</RequirementId> </Row>
   </RequirementSetRequirements>
   <Requirements>
       <Row> <RequirementId>UNIT_CLASS_IRONWEAPONS_UPGRADE_MELEE</RequirementId> <RequirementType>REQUIREMENT_UNIT_TAG_MATCHES</RequirementType> </Row>
       <Row> <RequirementId>UNIT_CLASS_IRONWEAPONS_UPGRADE_RANGED</RequirementId> <RequirementType>REQUIREMENT_UNIT_TAG_MATCHES</RequirementType> </Row>
   </Requirements>
   <RequirementArguments>
       <Row> <RequirementId>UNIT_CLASS_IRONWEAPONS_UPGRADE_MELEE</RequirementId> <Name>Tag</Name> <Value>CLASS_IRONWEAPONS_UPGRADE_MELEE</Value> </Row>
       <Row> <RequirementId>UNIT_CLASS_IRONWEAPONS_UPGRADE_RANGED</RequirementId> <Name>Tag</Name> <Value>CLASS_IRONWEAPONS_UPGRADE_RANGED</Value> </Row>
   </RequirementArguments>
   <ModifierStrings>
       <Row ModifierId="IRONWEAPONS_ADJUST_COMBAT_STRENGHT" Context="Preview" Text="+{1_Amount} {LOC_TECH_IRON_WORKING_NAME} {LOC_TECH_DESCRIPTOR_PREVIEW_TEXT}"/>
       <Row ModifierId="IRONWEAPONS_ADJUST_RANGED_STRENGHT" Context="Preview" Text="+{1_Amount} {LOC_TECH_IRON_WORKING_NAME} {LOC_TECH_DESCRIPTOR_PREVIEW_TEXT}"/>

   </ModifierStrings>
</GameData>

Code:
       <Row Type="UNIT_SCOUT" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
       <Row Type="UNIT_WARRIOR" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
       <Row Type="UNIT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
       <Row Type="UNIT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_RANGED"/>
       <Row Type="UNIT_SPEARMAN" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
       <Row Type="UNIT_HEAVY_CHARIOT" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>

       <Row Type="UNIT_GALLEY" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
       <Row Type="UNIT_NORWEGIAN_LONGSHIP" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>

       <Row Type="UNIT_EGYPTIAN_CHARIOT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
       <Row Type="UNIT_EGYPTIAN_CHARIOT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_RANGED"/>
       <Row Type="UNIT_SUMERIAN_WAR_CART" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
       <Row Type="UNIT_GREEK_HOPLITE" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>

       <Row Type="UNIT_WARRIOR_MONK" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
Units to earn combat strenght tech adjustments of this item are as follows
- Scout
- Warrior
- Archer
- Sprearman
- Heavy Chariot
- Galley
- Norwegian Longship
- Egyptian Maryannu Chariot Archer
- Sumerian War Cart
- Greek Hoplite
- Warrior Monk

1. Are these a correct code to enable such strength adjustments via tech? What will the game itself do with these codes? Of course rightnow no crashing errors of any kind incurred yet.
2. If not then what. with only specified units earned adjustments?
 

Attachments

Last edited:
Is the current Value of the GlobalParameter 'DIPLOMATIC_VICTORY_POINTS_REQUIRED' stored in the save files (i.e. fix for the whole game) _or_ [after complete exit & new start of civ6 & reloaded save] read from the Database, which could be different from that in the previous session (i.e. DV Points possibly depending on the development of the current game)?
If I understand your question correctly, then it's the former. Once you select the DV Points in the setup menu, the Game will adopt the selected value automatically, say, it's stored in the save file, so you don't need to restart the Game in order for it to verify the Changes (just like the new Wonder/CS Pickers). The Database changes every Time you start a New game (depending on the Mods you activated, setup/setting changes), you can even change the code in your Mod without needing to exit the whole Game and restart it, you just start a new Game match. A reload of the game is only neccessary if you change the Modinfo, Langauge, (some graphic changes)...etc.
 
@Lonecat Nekophrodite You can do it via attaching the Modifiers to a specific tech in the "TechnologyModifiers" Table or by making it via Unit Abilities by making a Tech and Tag requirement. And,
<Row Type="UNIT_SCOUT" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_WARRIOR" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_RANGED"/> <Row Type="UNIT_SPEARMAN" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_HEAVY_CHARIOT" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_GALLEY" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_NORWEGIAN_LONGSHIP" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_EGYPTIAN_CHARIOT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_EGYPTIAN_CHARIOT_ARCHER" Tag="CLASS_IRONWEAPONS_UPGRADE_RANGED"/> <Row Type="UNIT_SUMERIAN_WAR_CART" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_GREEK_HOPLITE" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/> <Row Type="UNIT_WARRIOR_MONK" Tag="CLASS_IRONWEAPONS_UPGRADE_MELEE"/>
These must be in the TypeTags Table.
 
@Lonecat Nekophrodite You can do it via attaching the Modifiers to a specific tech in the "TechnologyModifiers" Table
Doing this option. How?

or by making it via Unit Abilities by making a Tech and Tag requirement. And,

These must be in the TypeTags Table.

If using this option. How to make tech requirements? Do i need to make a tech 'constrains' in <SubjectRequirementSetId> or is there an existing constrains to set?
 
Doing this option. How?
Code:
<TechnologyModifiers>
       <Row> <TechnologyType>TECH_MACHINERY</TechnologyType> <ModifierId>IRONWEAPONS_ADJUST_COMBAT_STRENGHT</ModifierId>
       <Row>
   </TechnologyModifiers>

If using this option. How to make tech requirements? Do i need to make a tech 'constrains' in <SubjectRequirementSetId> or is there an existing constrains to set?
Yes, although I think you must make an OwnerRequirementSetId (but I'm not sure about that, you just have to test it), with "REQUIREMENT_PLAYER_HAS_TECHNOLOGY" in requirements. But make both in the Owner/or SubjectRequirementSetId, Technology AND Unit tag, with a test all in "RequirementSetRequirements".

For Example:
Code:
INSERT INTO Modifiers (ModifierId, ModifierType, SubjectRequirementSetId) VALUES
    ('TECH_COMBAT_IRONSTRENGTH', 'MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH', 'TECH_COMBAT_IRONSTRENGTH_REQUIREMENTS');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId)
VALUES    ('TECH_COMBAT_IRONSTRENGTH_REQUIREMENTS', 'PLAYER_HAS_X_TECH_REQUIREMENT'),
        ('TECH_COMBAT_IRONSTRENGTH_REQUIREMENTS', 'IRONSTRENGTH_REQUIRES_UNIT_IS_CLASS_X');

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

INSERT INTO Requirements (RequirementId, RequirementType, Inverse)
VALUES    ('PLAYER_HAS_X_TECH_REQUIREMENT', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY', 0),
        ('IRONSTRENGTH_REQUIRES_UNIT_IS_CLASS_X', 'REQUIREMENT_UNIT_TAG_MATCHES', 0);
....

Edit: And you don't have to make 2 Modifiers for 2 different Unit class types if they get the same strength value anyway. just add a second requirement in RequirementSetRequirements and TEST_ANY in RequirementSets.
 
Last edited:
Once you select the DV Points in the setup menu, the Game will adopt the selected value automatically, say, it's stored in the save file, so you don't need to restart the Game in order for it to verify the Changes
Sorry, I was quite unclear. With the assumption "Configure Diplomatic Victory Points" mod active, the question would be now: is in the save file stored the absolute resulting DVP value, (eg. "23") or the selected Configuration during setup, which points to the file 23.sql? This file contains by default "23", but could be manipulated via renaming files later while civ6 is stopped and contain then eg. "28".

Without the "Configure Diplomatic Victory Points" mod the 'DIPLOMATIC_VICTORY_POINTS_REQUIRED' is by default the constant "20", which can be modified to another constant, but still is always correct & available in the Database ...
ie. I don't see the necessity to store that constant in the save files and wonder if it actually happens. Are all the GlobalParameters stored in the save files??

The background for "variable" Diplomatic Victory Points is here:
[...] I increasingly think my issue with diplo victory is just that the cap shouldn't be 20, but maybe 25 or 30.
[...] some games are just unwinnable by a specific victory condition [...] So on the one hand, if there is no weather/military drama going on, it becomes almost impossible to win a diplo victory. On the other hand, if there is drama like that going on, it becomes trivially easy to win one.
A Lua script could monitor the opening of a game & write a result into Lua.log, which controls a shell script adapting Diplomatic Victory Points (say in the range 23-28) / renaming files while civ6 is stopped.

 
is in the save file stored the absolute resulting DVP value, (eg. "23") or the selected Configuration during setup, which points to the file 23.sql. This file contains by default "23", but could be manipulated via renaming files later while civ6 is stopped and contain then eg. "28".
Yes, the Value that you have chosen in the setup menu while starting the Game, should be stored in the save file (just like everything else you choose from the setup screen - So you can't change the value once a Game is started). But that just points the Game to the appropriate sql file (say, it's adjustable). The default value shows only in the setup menu, but doesn't affect saved games with other DVP values.

The Mod changes the value of "DIPLOMATIC_VICTORY_POINTS_REQUIRED" in the Globalparameters based on your choice in the setup menu. The Mod is basically an example, of how to alter the database easily in the setup menu (because the database gets only constructed once you start a new Game).

A Lua script could monitor the opening of a game & write a result into Lua.log, which controls a shell script adapting Diplomatic Victory Points (say in the range 23-28) / renaming files while civ6 is stopped.
Unfortunately we have limited access concerning Diplomacy objects with Lua. It's actually the Game Element we can least do about. So we cannot change DVP with lua (we can only change Diplomatic Favor).
 
Back
Top Bottom