• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

Problem with editing mod's SQL files: Please help!

DistantRainbow

Chieftain
Joined
Apr 16, 2015
Messages
81
(DISCLAIMER: I didn't originally make any of these mods/files, I just downloaded them and sometimes edited them for personal use.)

Playing with a modded civ at the moment. I usually slightly 'touch up' mods' XML files for my personal use to fit whatever purpose I want, but this mod has every file in LUA or SQL form except for a single XML for in-game text.

So I tried editing the SQL file I wanted. Naturally, since I'm a dunce at these things, despite editing it there's no change whatsoever to the base mod. So I'm uploading the 'edited' mod I currently have; would someone knowledgeable in SQL check it and tell me how to make it work?

The goal I'm aiming for is editing the civ's UB. It's a Mint replacement that can be built with access to Copper/Iron/Aluminum in addition to the default Mint's Gold/Silver, and boosts gold per Mine worked by the city.
The change I'm aiming for is having the building give the Mint's +2 Gold bonus to Copper/Iron/Aluminum as well, as that bonus still only exists for Gold and Silver.
It looks like MC_Gaul_Buildings.sql is the file which codes for this UB. Accordingly, in the middle of said file I tried adding the following bit(in bold):

.
.
.
--==========================================================================================================================
-- Building_LocalResourceOrs
--==========================================================================================================================
INSERT INTO Building_LocalResourceOrs
(BuildingType, ResourceType)
SELECT ('BUILDING_MC_GAUL_METALSMITH'), ResourceType
FROM Building_LocalResourceOrs WHERE BuildingType = 'BUILDING_MINT';

INSERT INTO Building_LocalResourceOrs
(BuildingType, ResourceType)
VALUES ('BUILDING_MC_GAUL_METALSMITH', 'RESOURCE_IRON'),
('BUILDING_MC_GAUL_METALSMITH', 'RESOURCE_ALUMINUM'),
('BUILDING_MC_GAUL_METALSMITH', 'RESOURCE_COPPER');
--==========================================================================================================================
-- Building_ResourceYieldChanges
--==========================================================================================================================
INSERT INTO Building_ResourceYieldChanges
(BuildingType, ResourceType, YieldType, Yield)
SELECT ('BUILDING_MC_GAUL_METALSMITH'), ResourceType, YieldType, Yield
FROM Building_ResourceYieldChanges WHERE BuildingType = 'BUILDING_MINT';

INSERT INTO Building_ResourceYieldChanges
(BuildingType, ResourceType, YieldType, Yield)
VALUES ('BUILDING_MC_GAUL_METALSMITH', 'RESOURCE_IRON', 'YIELD_GOLD', 2),
('BUILDING_MC_GAUL_METALSMITH', 'RESOURCE_ALUMINUM', 'YIELD_GOLD', 2),
('BUILDING_MC_GAUL_METALSMITH', 'RESOURCE_COPPER', 'YIELD_GOLD', 2);

--==========================================================================================================================
-- Building_Flavors
--==========================================================================================================================
INSERT INTO Building_Flavors
.
.
.

However, it's not working and the UB's effects are still as per its original function.

Enclosed is the .zip file for the edited mod I currently have. How should I edit the file so that the UB will properly add the +2 Gold to Copper/Iron/Aluminum? Is that not how you code those changes in SQL? Did I make a mistake somewhere? Or would this possibly be some kind of mod conflict?

PS. Regarding mod conflict by the way... I also happen to be using a Resource Buildings mod that references Barathor's More Luxuries, which includes the .xml file I also uploaded which changes the default Mint so that its bonuses to Gold/Silver extend to Copper as well. Considering that the modded civ seems to consult the default Mint's stats then tweak them afterwards, would this be possibly causing a problem? Where there are duplicate commands to add +2 Gold/building capabilities to Copper and thus bugging the whole thing?

PPS. Besides that, I also touched up a bit of the text elsewhere, and also the UU where I added a new promotion to it which references another different mod. Pay no attention to those if they sport errors in the log or something, those work properly for me right now. My only focus for the mod civ is on its UB.
 

Attachments

Last edited:
The code as you have alterred it works correctly but the other mod may indeed be creating a problem as the game will not implement correctly in all cases where two identical rows exist within a table such as Building_ResourceYieldChanges. Without Barathor's mod running the game's database shows correct implementation within the game's database.

The solution would be to ensure that Barathor's mod loads into the game after your edited version of the MC mod. You can generally do this by diasbling Barathor's mod, starting a throw-away game with the MC Gauls mod enabled, exiting the game, and then starting a "real" game where you re-enable Barathor's mod before continuing on to game set-up. The more complicated and reliable method is to add a reference within Barathor's mod to the MC Gauls mod so that the MC Gauls mod will always load first if both are enabled.
 
Back
Top Bottom