Cant Figure out why my mod doesn't work

cyberhawk94

Chieftain
Joined
May 15, 2020
Messages
9
I am making a small re-balancing mod for my own use, and to be fair I have no idea what I am doing. I am basing it heavily on the format and syntax used by an existing mod, and simply adding additional effects. As far as I can tell everything is the same, but the mod doesn't seem to work.

Below is the .modinfo file, all the changes in the Russia and Canada files work perfectly (the original mod), none of the changes in the "Simple" file apply at all, and there are no visible errors in the Modding log

<FrontEndActions>
<UpdateDatabase id="Config">
<Properties>
<LoadOrder>13</LoadOrder>
</Properties>
<File>TCR_Config.sql</File>
</UpdateDatabase>
<UpdateText id="Text">
<Properties>
<LoadOrder>13</LoadOrder>
</Properties>
<File>TCR_Text.sql</File>
</UpdateText>
</FrontEndActions>
<InGameActions>
<UpdateText id="Text">
<Properties>
<LoadOrder>13</LoadOrder>
</Properties>
<File>TCR_Text.sql</File>
</UpdateText>
<UpdateDatabase id="Database">
<Properties>
<LoadOrder>13</LoadOrder>
</Properties>
<File>TCR_Canada.sql</File>
<File>TCR_Russia.sql</File>
<File>TCR_Simple.sql</File>
</UpdateDatabase>
</InGameActions>
<Files>
<File>TCR_Canada.sql</File>
<File>TCR_Config.sql</File>
<File>TCR_Russia.sql</File>
<File>TCR_Simple.sql</File>
<File>TCR_Text.sql</File>
</Files>
</Mod>

TCR_Simple.sql


-- Traits
--------------------------------------------------------------
UPDATE Traits SET Description='LOC_TRAIT_CIVILIZATION_MAORI_MANA_DESCRIPTION_CYB' WHERE TraitType='TRAIT_CIVILIZATION_MAORI_MANA';
UPDATE Traits SET Description='LOC_TRAIT_CIVILIZATION_MEDITERRANEAN_COLONIES_DESCRIPTION_CYB' WHERE TraitType='TRAIT_CIVILIZATION_MEDITERRANEAN_COLONIES';
UPDATE Traits SET Description='LOC_TRAIT_CIVILIZATION_INDUSTRIAL_REVOLUTION_DESCRIPTION_CYB' WHERE TraitType='TRAIT_CIVILIZATION_INDUSTRIAL_REVOLUTION';
UPDATE Traits SET Description='LOC_TRAIT_LEADER_DIVINE_WIND_DESCRIPTION_CYB' WHERE TraitType='TRAIT_LEADER_DIVINE_WIND';
--------------------------------------------------------------


-- TraitModifiers
--------------------------------------------------------------
DELETE FROM TraitModifiers WHERE ModifierId='TRAIT_MAORI_FISHING_BOAT_FOOD';
DELETE FROM TraitModifiers WHERE ModifierId='TRAIT_FREE_TECH_BOOST_WRITING';
DELETE FROM TraitModifiers WHERE ModifierId='TRAIT_ADJUST_MILITARY_ENGINEER_PRODUCTION';
DELETE FROM TraitModifiers WHERE ModifierId='TRAIT_ADJUST_MILITARY_ENGINEER_BUILDCHARGES';

INSERT OR REPLACE INTO TraitModifiers
(ModifierId, TraitType)
SELECT 'TRAIT_CYB_ENGLISH_ZONES', TraitType FROM Traits WHERE TraitType='TRAIT_CIVILIZATION_INDUSTRIAL_REVOLUTION';
--------------------------------------------------------------

-- Modifiers
--------------------------------------------------------------
INSERT OR REPLACE INTO Modifiers
(ModifierId, ModifierType)
VALUES ('TRAIT_CYB_ENGLISH_ZONES', 'MODIFIER_PLAYER_CITIES_ADJUST_DISTRICT_PRODUCTION');
--------------------------------------------------------------


-- ModifierArguments
--------------------------------------------------------------
INSERT OR REPLACE INTO ModifierArguments
(ModifierId, Name, Value)
VALUES ('TRAIT_BOOST_HOLY_SITE_PRODUCTION', 'DistrictType', 'DISTRICT_HOLY_SITE'),
('TRAIT_BOOST_HOLY_SITE_PRODUCTION', 'Amount', 50),
('TRAIT_BOOST_THEATER_DISTRICT_PRODUCTION', 'DistrictType', 'DISTRICT_THEATER'),
('TRAIT_BOOST_THEATER_DISTRICT_PRODUCTION', 'Amount', 50),
('TRAIT_BOOST_ENCAMPMENT_PRODUCTION', 'DistrictType', 'DISTRICT_ENCAMPMENT'),
('TRAIT_BOOST_ENCAMPMENT_PRODUCTION', 'Amount', 50),
('TRAIT_MAORI_PRODUCTION_WOODS_CONSERVATION', 'YieldType', 'YIELD_PRODUCTION'),
('TRAIT_MAORI_PRODUCTION_WOODS_CONSERVATION', 'Amount', 1),
('TRAIT_MAORI_PRODUCTION_RAINFOREST_CONSERVATION', 'YieldType', 'YIELD_PRODUCTION'),
('TRAIT_MAORI_PRODUCTION_RAINFOREST_CONSERVATION', 'Amount', 1),
('TRAIT_CYB_ENGLISH_ZONES', 'DistrictType', 'DISTRICT_INDUSTRIAL_ZONE'),
('TRAIT_CYB_ENGLISH_ZONES', 'Amount', 20);

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

Attachments

[1050158.382] [Gameplay] ERROR: near "": syntax error
[1050159.183] [Gameplay] ERROR: near "DELETE": syntax error
 
You had a couple of problems going on.
  1. File TCR_Simple.sql seems to have been corrupted because it was getting a syntax error near a null character. "Near" in Database.log lingo means prior to. File corruption can sometimes happen and it is difficult to pinpoint the cause. No portion of the file was being loaded by the game.
  2. I deleted the entire file and recreated it's contents in a new file called "Something.sql". The code from the new file began to load, but there was an actual syntax error within the code of the file.
  3. You never defined this ModifierId so I had to comment that chunk of the file out
    Code:
    --INSERT OR REPLACE INTO TraitModifiers
    --	(ModifierId,			TraitType)
    --SELECT  'TRAIT_CYB_ENGLISH_ZONES',	TraitType FROM Traits WHERE TraitType='TRAIT_CIVILIZATION_INDUSTRIAL_REVOLUTION';
  4. After that the code loaded all the way to the end of the file.
 

Attachments

One quick question, what do you mean by I never defined the ModifierId "Trait_Cyb_English_Zones"? Im a total noob with SQL, but I copied the syntax exactly from a fully functional mod (the syntax I used is the Canada file within this mod). Is there something I missed in a difference between the syntax for Leader vs Civilization abilities? or something else
 
You never defined it anywhere in table "Modifiers" -- you merely referenced to it in that chunk of code. You can't refer to a ModifierId you have never defined within table Modifiers.

This chunk of code defines a ModifierId called "TRAIT_ENGLISH_ZONE_PRODUCTION" and specifies that the ModifierType to be used with that ModifierId is "MODIFIER_PLAYER_CITIES_ADJUST_DISTRICT_PRODUCTION"
Code:
-- Modifiers
--------------------------------------------------------------
INSERT OR REPLACE INTO Modifiers
	(ModifierId,				ModifierType)
VALUES  ('TRAIT_ENGLISH_ZONE_PRODUCTION',	'MODIFIER_PLAYER_CITIES_ADJUST_DISTRICT_PRODUCTION');
Your mod never has a definition like this for ModifierId "TRAIT_CYB_ENGLISH_ZONES"

A search through all of your mod's files only shows "TRAIT_CYB_ENGLISH_ZONES" in that one chunk of code I mentioned that I had to comment out.
 
Oh oops, I guess the version I uploaded was out of date.

I noticed that ID mis-match right before I compressed the file, you can see its actually fixed in the copy-pasted code in the post.

Thats why I was so confused, I thought the fixed version still was having that issue.

Thanks for all your help!
 
Back
Top Bottom