[MOD] Help: mod not applying as expected

camomilk

Chieftain
Joined
Jan 18, 2006
Messages
46
I created a mod with a single SQL file:

Code:
-- China Civ
-- Eurekas and Inspirations provide 80% of the cost of civics and technologies rather than 50%.

UPDATE ModifierArguments SET Amount=30 WHERE ModifierId='TRAIT_TECHNOLOGY_BOOST';
UPDATE ModifierArguments SET Amount=30 WHERE ModifierId='TRAIT_CIVIC_BOOST';

I swear the first time I ran with this, it caused eurekas to give a 30% bonus instead of the intended 80%. However, ever since that first time, it doesn't seem to be making any difference at all; eurekas with China are always giving 60%. Any ideas why? The in game menu says my mod is applied.
 
The mod that I use has the following code:

Code:
--Created by Alesque

--Changing the boosts value to 25% for ALL techs and civics
UPDATE Boosts SET Boost='25';

--Updating description of the dynastic cycle ability for China.
UPDATE Traits SET Description='[ICON_TechBoosted] Eurekas and [ICON_CivicBoosted] Inspirations provide 35% of civics and technologies instead of 25%.' WHERE TraitType="TRAIT_CIVILIZATION_DYNASTIC_CYCLE";
 
That seems a bit broad though.. Would be nice to have great scientists give a good boost, and I wonder if this interferes with that.. or bring it down to 25%.
 
Interesting, I wonder if I need to set Amount='30' instead of Amount=30. I'll try that out.

Edit: No, it didn't work. Boosts still give China 60%.
 
Last edited:
[Replying to the thread's OP]: These are the only relevant rows within table ModifierArguments
Code:
	<ModifierArguments>
		<Row>
			<ModifierId>TRAIT_CIVIC_BOOST</ModifierId>
			<Name>Amount</Name>
			<Value>10</Value>
			<Extra>-1</Extra>
		</Row>
		<Row>
			<ModifierId>TRAIT_TECHNOLOGY_BOOST</ModifierId>
			<Name>Amount</Name>
			<Value>10</Value>
			<Extra>-1</Extra>
		</Row>
	</ModifierArguments>
You are likely getting an unusable column name or syntax error in the database log because this is the definition of the table
Code:
CREATE TABLE "ModifierArguments" (
		"ModifierId" TEXT NOT NULL,
		"Name" TEXT NOT NULL,
		"Type" TEXT NOT NULL DEFAULT "ARGTYPE_IDENTITY",
		"Value" TEXT NOT NULL,
		"Extra" TEXT,
		PRIMARY KEY(ModifierId, Name),
		FOREIGN KEY (ModifierId) REFERENCES Modifiers(ModifierId) ON DELETE CASCADE ON UPDATE CASCADE);
It also won't matter whether you state Value='30' or Value=30
 
Last edited:
Take a look at the code again .. this is what I"ve set and it sets the boosts to 25% and China , because of it's trait , get set to 35%
Code:
    <Boosts>
        <Update>
            <Set Boost="25"/>
        </Update>
    </Boosts>
 
Hmm, looks like China is
These are the only relevant rows within table ModifierArguments
Code:
    <ModifierArguments>
        <Row>
            <ModifierId>TRAIT_CIVIC_BOOST</ModifierId>
            <Name>Amount</Name>
            <Value>10</Value>
            <Extra>-1</Extra>
        </Row>
        <Row>
            <ModifierId>TRAIT_TECHNOLOGY_BOOST</ModifierId>
            <Name>Amount</Name>
            <Value>10</Value>
            <Extra>-1</Extra>
        </Row>
    </ModifierArguments>
You are likely getting an unusable column name or syntax error in the database log because this is the definition of the table
Code:
CREATE TABLE "ModifierArguments" (
        "ModifierId" TEXT NOT NULL,
        "Name" TEXT NOT NULL,
        "Type" TEXT NOT NULL DEFAULT "ARGTYPE_IDENTITY",
        "Value" TEXT NOT NULL,
        "Extra" TEXT,
        PRIMARY KEY(ModifierId, Name),
        FOREIGN KEY (ModifierId) REFERENCES Modifiers(ModifierId) ON DELETE CASCADE ON UPDATE CASCADE);
It also won't matter whether you state Value='30' or Value=30


Thanks, this made me realize my mistake! I was trying to set Amount=30 when "Amount" was just the value of the Name field, and I actually needed to change the Value field. The following code works now:

Code:
-- China Civ
-- Eurekas and Inspirations provide 80% of the cost of civics and technologies rather than 50%.

UPDATE ModifierArguments
    SET Value=30
    WHERE ModifierId='TRAIT_TECHNOLOGY_BOOST'
        AND Name='Amount';
        
UPDATE ModifierArguments
    SET Value=30
    WHERE ModifierId='TRAIT_CIVIC_BOOST'
        AND Name='Amount';
 
Take a look at the code again .. this is what I"ve set and it sets the boosts to 25% and China , because of it's trait , get set to 35%
Code:
    <Boosts>
        <Update>
            <Set Boost="25"/>
        </Update>
    </Boosts>
I was not quibbling with the "Boosts" code. I was pointing out why the original code was not working.

On the other hand you may not have been replying to me. A little confusing who you were replying to. Also confusing who I was replying to.
 
UPDATE ModifierArguments SET Amount=30 WHERE ModifierId='TRAIT_TECHNOLOGY_BOOST';

Try this:
UPDATE ModifierArguments SET Value=30 WHERE ModifierId='TRAIT_TECHNOLOGY_BOOST' AND Name='Amount';
 
First thing you should do when a value doesn't apply as expected is go to Documents > My Games > Sid Meier's Civilization VI > Logs and open Database.log (ideally with a tool like Notepad++). Look for an error in there. if your SQL fails it will often say something about foreign key constraints failing.

In any case, the Value field on the ModifierArguments table is a text field, not a number, so needs to be written like this:

(EDIT: I see that Civ 6 doesn't care about this distinction, which is interesting. Glad you got it working regardless. It is nice to know that either 30 or '30' works in this case).

UPDATE ModifierArguments SET Value='30' WHERE ModifierId='TRAIT_TECHNOLOGY_BOOST' ;

I agree with gelodgreat tho that its better in this case to be even more specific. Anytime you edit stuff on the ModifierArguments table I'd include a WHERE the Name field in the formula to avoid accidentally breaking things.

UPDATE ModifierArguments SET Value='30' WHERE ModifierId='TRAIT_TECHNOLOGY_BOOST' AND Name='Amount';
 
Last edited:
As far as I remember Civ5 did not care about the "text" or "integer" distinction, and allowed setting of either 30 or '30' for columns that were defined as text but implemented as integers.

And I don't believe that civ5's SQL parser quite behaved according to the rules of SQLlite in all cases. Civ6, who knows as yet.

Database log ought to be throwing up a "no such column" error from either an XML or SQL file that attempts to use an incorrect column within a table. And this in civ6 will cause the game to discard anything lower-down in the same file to where the fatal error occurs.

In the release version of the game this sort of thing would also cause civ6 to lock the entire database from further changes and you'd get like 9000 characters of text-wall reporting all the tables that had been locked off: not sure if the patch made the game quit this, as I haven't purposely tried to create fatal-level errors lately.:lol:

Civ5 would discard the entire xml file, but keep the previously-parsed portion of the SQL file. Civ6 appears to keep everything previously-parsed from either type of file, and discards anything after the fatal error.
 
In the release version of the game this sort of thing would also cause civ6 to lock the entire database from further changes and you'd get like 9000 characters of text-wall reporting all the tables that had been locked off: not sure if the patch made the game quit this, as I haven't purposely tried to create fatal-level errors lately.:lol:

As of the Fall Patch, it dumps you back to the Main Menu if any fatal errors occur. And does not list what, if any due it dumping you back to Main menu, tables got locked off. The database.log just lists the fatal errors you made.
 
Adding this bit of doggerol to a mod xml file:
Code:
<MaresEatOats>
     <Row>
          <MaresType>MARES_LAMBS</MaresType>
          <EatsIvy>true</EatsIvy>
          <YieldChange>5</YieldChange>
     </Row>
</MaresEatOats>
Only resulted in this in the Database log:
Code:
[2192243.827] [Gameplay] ERROR: no such table: MaresEatOats
[2192243.827] [Gameplay]: In Query - insert into MaresEatOats('MaresType', 'EatsIvy', 'YieldChange') values (?, ?, ?);
[2192243.827] [Gameplay]: In XMLSerializer while updating table MaresEatOats from file Units.xml.
Everything else from the same mod and other mods ran just fine. I got no return to the main menu. Perhaps this return to the main menu only occurs from an error within the modinfo file, or from fatal errors within a valid gametable, or perhaps only when it occurs in an SQL file ? So far I have not been able to force a return to the main menu from a fatal error within an XML file.

But it is nice to see that the Database.log is no longer being cluttered by an endless wall of text simply because one XML file had a fatal error within it.
 
Last edited:
Apparently it is invalid "Foriegn Keys" that cause the game to exit back to the main menu. So references to something that does not exist, like telling the game a building uses a PrereqTech of "TECH_WATERBOYS". Syntax errors for wrong column within a table or non-existant tables do not seem to shove you back to the main menu.
 
At least it is now only exiting back to main menu when foreign keys fail. :D Prior to that change I managed to crash to desktop several times by writing sloppy SQL.
 
Back
Top Bottom