SocialMechanic
Chieftain
- Joined
- May 11, 2019
- Messages
- 97
So, I'm wanting to make a mod where the mountain tile can be worked by any Civ.
This is working as intended.
Then, I wanted the Incans to not really change at all with this mod
Then, I wanted the Ski Resort to be workable and to provide +3 gold.
All of this works no problem. However, I want mountains to gain a +1 Production bonus once once a certain Civic is discovered.
However, I couldn't find an actual "Terrain_BonusYieldChanges" table, so I used the "Improvement_BonusYieldChanges" table as a reference. Of course, I got an error letting me know that "Terrain_BonusYieldChanges" isn't an actual table, so I have to create it myself.
Looking at LeeS's PDF file, it appears that I can't make a table in XML, which is what I'm used to. So, I looked in the schemas directory in the SQL files to create my own table. This is what I made.
Basically, I took the "Improvement_BonusYieldChanges" table as a reference.
I'm pretty sure that this code is wrong but I have zero clue how to fix it.
I then created a new "UpdateDatabase" action in ModBuddy and put the SQL file in there. I made the LoadOrder "-1" (from what I remember when I was reading LeeS's PDF, you have to do this when you make tables).
Of course, this didn't work and the mountain isn't gaining the production when I finish Codes of Law.
This is working as intended.
Code:
<Terrain_YieldChanges>
<Row TerrainType="TERRAIN_GRASS_MOUNTAIN" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_PLAINS_MOUNTAIN" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_DESERT_MOUNTAIN" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_TUNDRA_MOUNTAIN" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_SNOW_MOUNTAIN" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
</Terrain_YieldChanges>
<TraitModifiers>
<Row TraitType="TRAIT_LEADER_MAJOR_CIV" ModifierId="TRAIT_WORK_GRASS_MOUNTAIN"/>
<Row TraitType="TRAIT_LEADER_MAJOR_CIV" ModifierId="TRAIT_WORK_PLAINS_MOUNTAIN"/>
<Row TraitType="TRAIT_LEADER_MAJOR_CIV" ModifierId="TRAIT_WORK_DESERT_MOUNTAIN"/>
<Row TraitType="TRAIT_LEADER_MAJOR_CIV" ModifierId="TRAIT_WORK_TUNDRA_MOUNTAIN"/>
<Row TraitType="TRAIT_LEADER_MAJOR_CIV" ModifierId="TRAIT_WORK_SNOW_MOUNTAIN"/>
</TraitModifiers>
Code:
<ModifierArguments>
<Update>
<Where ModifierId="TRAIT_PRODUCTION_MOUNTAIN" Name="Amount" Value="2"/>
<Set Value="1"/>
</Update>
</ModifierArguments>
Code:
<Improvements>
<Update>
<Where ImprovementType="IMPROVEMENT_SKI_RESORT"/>
<Set Workable="true"/>
</Update>
</Improvements>
<Improvement_YieldChanges>
<Row ImprovementType="IMPROVEMENT_SKI_RESORT" YieldType="YIELD_GOLD" YieldChange="3"/>
</Improvement_YieldChanges>
Code:
<Terrain_BonusYieldChanges>
<Row Id="1" TerrainType="TERRAIN_GRASS_MOUNTAIN" YieldType="YIELD_PRODUCTION" BonusYieldChange="1" PrereqCivic="CIVIC_CODE_OF_LAWS"/>
<Row Id="2" TerrainType="TERRAIN_PLAINS_MOUNTAIN" YieldType="YIELD_PRODUCTION" BonusYieldChange="1" PrereqCivic="CIVIC_CODE_OF_LAWS"/>
<Row Id="3" TerrainType="TERRAIN_DESERT_MOUNTAIN" YieldType="YIELD_PRODUCTION" BonusYieldChange="1" PrereqCivic="CIVIC_CODE_OF_LAWS"/>
<Row Id="4" TerrainType="TERRAIN_TUNDRA_MOUNTAIN" YieldType="YIELD_PRODUCTION" BonusYieldChange="1" PrereqCivic="CIVIC_CODE_OF_LAWS"/>
<Row Id="5" TerrainType="TERRAIN_SNOW_MOUNTAIN" YieldType="YIELD_PRODUCTION" BonusYieldChange="1" PrereqCivic="CIVIC_CODE_OF_LAWS"/>
</Terrain_BonusYieldChanges>
Looking at LeeS's PDF file, it appears that I can't make a table in XML, which is what I'm used to. So, I looked in the schemas directory in the SQL files to create my own table. This is what I made.
Code:
CREATE TABLE "Terrain_BonusYieldChanges" (
"Id" INTEGER NOT NULL DEFAULT 0,
"TerrainType" TEXT NOT NULL,
"YieldType" TEXT NOT NULL,
"BonusYieldChange" INTEGER NOT NULL,
"PrereqTech" TEXT,
"PrereqCivic" TEXT,
PRIMARY KEY(Id, TerrainType, YieldType),
FOREIGN KEY (PrereqTech) REFERENCES Technologies(TechnologyType) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (PrereqCivic) REFERENCES Civics(CivicType) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (TerrainType) REFERENCES Terrains(TerrainType) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (YieldType) REFERENCES Yields(YieldType) ON DELETE CASCADE ON UPDATE CASCADE);
INSERT INTO NavigationProperties("BaseTable", "PropertyName", "TargetTable", "IsCollection", "Query") VALUES("Terrains", "BonusYieldChanges", "Terrain_BonusYieldChanges", 1,"SELECT T1.rowid from Terrain_BonusYieldChanges as T1 inner join Terrains as T2 on T2.TerrainType = T1.TerrainType where T2.rowid = ? ORDER BY T1.rowid ASC");
INSERT INTO NavigationProperties("BaseTable", "PropertyName", "TargetTable", "IsCollection", "Query") VALUES("Terrain_BonusYieldChanges", "TerrainReference", "Terrains", 0,"SELECT T1.rowid from Terrains as T1 inner join Terrain_BonusYieldChanges as T2 on T2.TerrainType = T1.TerrainType where T2.rowid = ? ORDER BY T1.rowid ASC LIMIT 1");
INSERT INTO NavigationProperties("BaseTable", "PropertyName", "TargetTable", "IsCollection", "Query") VALUES("Terrain_BonusYieldChanges", "PrereqCivicReference", "Civics", 0,"SELECT T1.rowid from Civics as T1 inner join Terrain_BonusYieldChanges as T2 on T2.PrereqCivic = T1.CivicType where T2.rowid = ? ORDER BY T1.rowid ASC LIMIT 1");
INSERT INTO NavigationProperties("BaseTable", "PropertyName", "TargetTable", "IsCollection", "Query") VALUES("Terrain_BonusYieldChanges", "PrereqTechReference", "Technologies", 0,"SELECT T1.rowid from Technologies as T1 inner join Terrain_BonusYieldChanges as T2 on T2.PrereqTech = T1.TechnologyType where T2.rowid = ? ORDER BY T1.rowid ASC LIMIT 1");
INSERT INTO NavigationProperties("BaseTable", "PropertyName", "TargetTable", "IsCollection", "Query") VALUES("Terrain_BonusYieldChanges", "YieldReference", "Yields", 0,"SELECT T1.rowid from Yields as T1 inner join Terrain_BonusYieldChanges as T2 on T2.YieldType = T1.YieldType where T2.rowid = ? ORDER BY T1.rowid ASC LIMIT 1");
INSERT INTO NavigationProperties("BaseTable", "PropertyName", "TargetTable", "IsCollection", "Query") VALUES("Yields", "TerrainChange_Refs", "Terrain_BonusYieldChanges", 1,"SELECT T1.rowid from Terrain_BonusYieldChanges as T1 inner join Yields as T2 on T2.YieldType = T1.YieldType where T2.rowid = ? ORDER BY T1.rowid ASC");
I'm pretty sure that this code is wrong but I have zero clue how to fix it.
I then created a new "UpdateDatabase" action in ModBuddy and put the SQL file in there. I made the LoadOrder "-1" (from what I remember when I was reading LeeS's PDF, you have to do this when you make tables).
Of course, this didn't work and the mountain isn't gaining the production when I finish Codes of Law.