.sql Parameter Quick Help

Word Rage

Chieftain
Joined
Oct 28, 2016
Messages
7
Hi there

I've been trying to remove the costprogression from districts, but I can't seem to find the right parameter, at least that's what I believe is the problem.

I've tried with

UPDATE Districts SET CostProgressionModel = 'NO_COST_PROGRESSION' WHERE RequiresPlacement="true";

I've tested the parameter (WHERE) with this line:
UPDATE Districts SET Cost = '5' WHERE RequiresPlacement="true";

Doesn't decrease district cost to '5'

So my question is really quite simple. Am I totally off and the lines should be different, or is the parameter wrong? And how should it be instead?

Any help is appreciated.
 
In sql, use 1, not true.
also, are there any errors in database log?

You could also try doing it in XML format.

UPDATE Districts SET CostProgressionModel = 'NO_COST_PROGRESSION' WHERE CostProgressionModel = "COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH";

UPDATE Districts SET CostProgressionModel = 'NO_COST_PROGRESSION' WHERE CostProgressionModel = "COST_PROGRESSION_GAME_PROGRESS";

I've tried these two as well, but still the right result eludes me. If I do it in xml, should the lines still be the same, or could I just make a modified version of the districts.xml and put it into the mod folder? Will it then update or replace the original, and if so, which lines will give me that?
 
Code:
<GameInfo>
    <Districts>
        <Update>
            <Where RequiresPlacement="true"/>
                <Set CostProgressionModel ="NO_COST_PROGRESSION"/>
            </Update>
    </Districts>
</GameInfo>

or just try
sql:
UPDATE Districts SET CostProgressionModel = 'NO_COST_PROGRESSION'

If you post your database log might be able to help.


Is that for the .modinfo file?

The database log is like this (if it's the right one):

[1242108.756] [Localization]: Validating Foreign Key Constraints...
[1242108.757] [Localization]: Passed Validation.
[1242108.765] [Configuration]: Validating Foreign Key Constraints...
[1242108.766] [Configuration]: Passed Validation.
[1242120.440] [FullTextSearch]: Initializing FullTextSearch
[1242122.024] [Gameplay]: Validating Foreign Key Constraints...
[1242122.036] [Gameplay]: Passed Validation.
[1242122.935] [Configuration]: Validating Foreign Key Constraints...
[1242122.935] [Configuration]: Passed Validation.
[1242151.709] [Configuration]: Validating Foreign Key Constraints...
[1242151.710] [Configuration]: Passed Validation.
[1242153.527] [Configuration]: Validating Foreign Key Constraints...
[1242153.527] [Configuration]: Passed Validation.
[1242165.716] [Gameplay] ERROR: UNIQUE constraint failed: Kinds.Kind
[1242165.716] [Gameplay]: While executing - 'insert into Kinds('Kind') values (?);'
[1242165.716] [Gameplay]: In XMLSerializer while inserting row into table insert into Kinds('Kind') with values (KIND_UNIT, ).
[1242165.716] [Gameplay]: In XMLSerializer while updating table Kinds from file Units.xml.
[1242165.716] [Gameplay] ERROR: UNIQUE constraint failed: Kinds.Kind
[1242165.716] [Gameplay]: Validating Foreign Key Constraints...
[1242165.728] [Gameplay]: Passed Validation.
[1242171.094] [FullTextSearch]: FTS - Creating Context
[1242171.335] [FullTextSearch]: FTS - Creating Context
[1242171.864] [FullTextSearch]: FTS - Creating Context
[1242210.306] [Configuration]: Validating Foreign Key Constraints...
[1242210.306] [Configuration]: Passed Validation.
[1242211.040] [Configuration]: Validating Foreign Key Constraints...
[1242211.040] [Configuration]: Passed Validation.
[1242214.689] [Configuration]: Validating Foreign Key Constraints...
[1242214.689] [Configuration]: Passed Validation.
[1242216.882] [Configuration]: Validating Foreign Key Constraints...
[1242216.882] [Configuration]: Passed Validation.
[1242223.557] [Gameplay]: Validating Foreign Key Constraints...
[1242223.569] [Gameplay]: Passed Validation.
[1242228.748] [FullTextSearch]: FTS - Creating Context
[1242228.980] [FullTextSearch]: FTS - Creating Context
[1242229.447] [FullTextSearch]: FTS - Creating Context
[1242507.993] [FullTextSearch]: FullTextSearch - Shutting down
 
you have an entry for KIND_UNIT that already exists.



No, that's the code in xml if you wanted to try it that way.

The KIND_UNIT could be related to this from my districts.sql:

UPDATE Units SET CostProgressionModel = 'NO_COST_PROGRESSION' WHERE UnitType='UNIT_BUILDER';
UPDATE Units SET Cost = '2' WHERE UnitType='UNIT_BUILDER';

I added the SET Cost to test quickly whether those lines work, and they apparently do, but I can't to get these to work:

UPDATE Districts SET CostProgressionModel = 'NO_COST_PROGRESSION' WHERE CostProgressionModel = "COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH";
UPDATE Districts SET Cost = '5' WHERE CostProgressionModel = "COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH";
UPDATE Districts SET CostProgressionModel = 'NO_COST_PROGRESSION' WHERE CostProgressionModel = "COST_PROGRESSION_GAME_PROGRESS";
UPDATE Districts SET Cost = '5' WHERE CostProgressionModel = "COST_PROGRESSION_GAME_PROGRESS";

Again the SET Cost is to quickly test it. Should I put the Update Districts lines in a separate .sql file? (or the other way around)

And just to finish off, here is the .modinfo file I'm using so you have all the details:

<?xml version="1.0" encoding="utf-8"?>
<Mod id="79a96bee-c555-45b4-ae34-5221c1154f94" version = "2">
<Properties>
<Name>District Cost Mod</Name>
<Stability>Beta</Stability>
<Teaser>District Cost Mod</Teaser>
<Description>District Cost Mod</Description>
<Authors>Me</Authors>
</Properties>
<Files>
<File>Districts.sql</File>
</Files>
<Components>
<UpdateDatabase id="DistrictCostMod">
<Items>
<File>Districts.sql</File>
</Items>
</UpdateDatabase>
</Components>
</Mod>

I borrowed most of it from another small functioning mod

Can you pinpoint the problem or is it all wrong?
 
[1242165.716] [Gameplay] ERROR: UNIQUE constraint failed: Kinds.Kind
[1242165.716] [Gameplay]: While executing - 'insert into Kinds('Kind') values (?);'
[1242165.716] [Gameplay]: In XMLSerializer while inserting row into table insert into Kinds('Kind') with values (KIND_UNIT, ).
[1242165.716] [Gameplay]: In XMLSerializer while updating table Kinds from file Units.xml.
[1242165.716] [Gameplay] ERROR: UNIQUE constraint failed: Kinds.Kind

These entries from your database log tell you what and where error is.
In one of your entries you have Kind="KIND_UNIT" which is already defined in base game.(unless you have another mod loaded which is causing error).



I do better when I can see everything in context, if you could post your mod, or just the complete file I could probably better help.
 
These entries from your database log tell you what and where error is.
In one of your entries you have Kind="KIND_UNIT" which is already defined in base game.(unless you have another mod loaded which is causing error).



I do better when I can see everything in context, if you could post your mod, or just the complete file I could probably better help.

What I posted IS the entire mod.

The first 6 lines are a districts.sql file and the other lines are the .modinfo file

That's it. Does the mod require more to function? The two lines considering the builder works as it is.
 
Here's what I did

Code:
<Districts>
        <Update>
            <Set CostProgressionModel="NO_COST_PROGRESSION"/>
        </Update>
</Districts>
 
You are telling the game to 1st set everything to "'NO_COST_PROGRESSION" within the Districts table anywhere it finds the cost progression set as "COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH"

Then, 2nd, you are telling the game to set the Costs within table Districts to '5' wherever it now has a CostProgressionModel of "COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH". But at this point there is no DistrictType within table Districts that has a matching CostProgressionModel of "COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH", so no Cost is ever set to '5' for this line of the code.

You then make the same error for "COST_PROGRESSION_GAME_PROGRESS".

You need to make the changes to the Districts' Costs before you change the settings for the CostProgressionModel.

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

And as pointed out by @gyogen2 you should run no mod at the same time as a mod you are testing out unless the other mod is 100% required for your mod to operate. And since the current state of civ6 modding is unclear whether it allows references and dependancies to other mods, in civ6 the rule is 100% test with only one mod enabled because you cannot at the moment ensure there is no conflict with the other mod.
 
Back
Top Bottom