<UpdateDatabase>
<Item>solver-test.sql</Item>
</UpdateDatabase>
UPDATE Unit_Stats SET Combat=200 WHERE Combat > 0;
I think these xml objects translate to dtos in the backend that then creates multiple entries within the -in-game db.What should I do if I want to change things that are more deeply nested and/or are outside of tags, like this from diplomacy-gameeffects.xml?
Code:<Modifier id="PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE" collection="COLLECTION_OWNER" effect="EFFECT_PLAYER_GRANT_TRADITION_SLOTS"> <Argument name="Amount">1</Argument> </Modifier>
What should I do if I want to change things that are more deeply nested and/or are outside of tags, like this from diplomacy-gameeffects.xml?
Code:<Modifier id="PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE" collection="COLLECTION_OWNER" effect="EFFECT_PLAYER_GRANT_TRADITION_SLOTS"> <Argument name="Amount">1</Argument> </Modifier>
ModifierId Name Extra SecondExtra Type Value
PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE Amount 1
Is the base module sufficient for everything?The only thing to keep in mind is that dependencies need to be set up correctly, or else the query will run before the database is ready. If the above is done in a modinfo with no dependencies, it will fail because the query will run before any ages are loaded and so there's nothing to update. A dependency on the base game age modules should be set up, then everything is as expected.
<Dependencies>
<Mod id="base-standard" title="LOC_MODULE_BASE_STANDARD_NAME"/>
</Dependencies>
UPDATE Constructibles
SET Cost = Cost * 3 WHERE ConstructibleClass = "BUILDING";
<Criteria id="any-age" any="true">
<AgeInUse>AGE_ANTIQUITY</AgeInUse>
<AgeInUse>AGE_EXPLORATION</AgeInUse>
<AgeInUse>AGE_MODERN</AgeInUse>
</Criteria>
@Acken gave me XML-example how to modify arguments table. Case is very similar and I have been using it in my mods.What should I do if I want to change things that are more deeply nested and/or are outside of tags, like this from diplomacy-gameeffects.xml?
Code:<Modifier id="PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE" collection="COLLECTION_OWNER" effect="EFFECT_PLAYER_GRANT_TRADITION_SLOTS"> <Argument name="Amount">1</Argument> </Modifier>
I actually used that as base. But with this understanding I have that mod template has two actions it can do and neither work for the values that settlement limit uses:
Actions that example template can do are UpdateDatabase and UpdateText. With my very limited understanding neither of those can do modifiers and their arguments?
XML:<?xml version="1.0" encoding="utf-8"?> <ActionGroups> <ActionGroup id="solver-mod-actions" scope="game" criteria="always"> <Actions> <UpdateDatabase> <Item>data/units.xml</Item>...
<?xml version="1.0" encoding="utf-8"?>
<Database>
<ModifierArguments>
<Update>
<Where ModifierId="TRAIT_INITIAL_SETTLEMENT_CAP" name="Amount"/>
<Set Value="4"/>
</Update>
</Modifiers>
</Database>
I'm sure that can be translated to the right XML, but it's probably easier to handle with SQL. My approach would be to examine the gameplay DB and find what the entry looks like there, then update it.
Looking at the DB, seems like modifiers that are used with arguments that come from other entities, live in the DynamicModifiers table. We can find PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE and look it at there, but the argument with the value 1 lives in ModifierArguments. Let's look this one up:
SELECT * FROM ModifierArguments WHERE ModifierID = 'PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE';
Code:ModifierId Name Extra SecondExtra Type Value PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE Amount 1
So an update could be e.g.
UPDATE ModifierArguments SET Value = 2 WHERE ModifierID = 'PLAYER_DIPLOMACY_GRANT_POLICY_SLOT_COMPLETE' AND Name = 'Amount';
where is the gameplay DB? I haven't been able to find it.
Help me out here - why update the unit data always if the unit only exists in Antiquity? Wouldn't it make more sense to update the unit data only in Antiquity, and then make the text changes always in case those localization tags are referenced again?The mod is going to update an Antiquity unit, but that's only possible when the game is actually in Antiquity. If you're in Age 2 or 3, Medjay aren't even present in the game data, so it'd be an error to update them. As such, the mod defines two criteria for its actions: antiquity-age-current to check if we're in Antiquity, and always to run always.
In the always case, we update the gameplay database with data/units.xml. If we're in Antiquity, we additionally update the text from text/en_us/UnitText.xml. [I think it would work fine to update the non-existent Medjay in other ages as well, but it's not a clean practice].
No, the base module is definitely not for everything. The base module is more like broad rules, but if there's anything you interact with only in a particular age (units, techs, civics, wonders, civs), it's probably in the age modules.
So ConstructibleClass exists in base, as the Improvement/Building/Wonder split is a broad, basic rule of Civ7. But the only buildings in base-standard are the Palace and City Hall, for which your cost modification technically works (I assume) but is pointless since they're automatically placed. To modify all building costs, you'd probably want to apply the change to the specific ages. My guess is you could define a criteria for any age:
Code:<Criteria id="any-age" any="true"> <AgeInUse>AGE_ANTIQUITY</AgeInUse> <AgeInUse>AGE_EXPLORATION</AgeInUse> <AgeInUse>AGE_MODERN</AgeInUse> </Criteria>
and point to that Criteria in your ActionGroup. No need for additional dependencies though. That's my guess based on how the Shawnee/Tecumseh content is set up.
Thanks for the feedback Solver. As I get deeper I'm seeing the matrix a little more and I see how it could go wrong. Thanks!I'll edit that soon because it's not a good practice - it's guaranteed to work because it only updates one unit, but that's not a good idea.