easy line of code not working

[to_xp]Gekko

QCT junkie
Joined
Dec 16, 2005
Messages
7,950
Location
Seyda Neen, Vvardenfell
can anyone tell me why this code is not working? it's supposed to allow lumbermills on rainforest tiles once sanitation is researched:

Code:
INSERT INTO Improvement_ValidFeatures (ImprovementType, FeatureType, PrereqTech) VALUES ('IMPROVEMENT_LUMBER_MILL', 'FEATURE_JUNGLE', 'TECH_SANITATION');
 
definition of the table
Code:
CREATE TABLE "Improvement_ValidFeatures" (
		"ImprovementType" TEXT NOT NULL,
		"FeatureType" TEXT NOT NULL,
		PRIMARY KEY(ImprovementType, FeatureType),
		FOREIGN KEY (ImprovementType) REFERENCES Improvements(ImprovementType) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (FeatureType) REFERENCES Features(FeatureType) ON DELETE CASCADE ON UPDATE CASCADE);
Has no column called PrereqTech and therefore your code is rejected by the game along with anything further down within the same file.
 
thanks for the explanation!

do you know how else that effect could be handled? I took the code from Tundra Farms mod and adapted it but I guess it's not working there either :/
 
Terrains work because the table for Improvement_ValidTerrains is defined differently
Code:
CREATE TABLE "Improvement_ValidTerrains" (
		"ImprovementType" TEXT NOT NULL,
		"TerrainType" TEXT NOT NULL,
		"PrereqTech" TEXT,
		"PrereqCivic" TEXT,
		PRIMARY KEY(ImprovementType, TerrainType),
		FOREIGN KEY (ImprovementType) REFERENCES Improvements(ImprovementType) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (TerrainType) REFERENCES Terrains(TerrainType) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (PrereqTech) REFERENCES Technologies(TechnologyType) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (PrereqCivic) REFERENCES Civics(CivicType) ON DELETE CASCADE ON UPDATE CASCADE);
I can't think of any easy way to create the effect.

I can only come up with : create a second version of the Lumbermill which requires the Sanitation tech and which can only be constructed on Jungle tiles. But then you'd have to get the map art for the new improvement to work and this is sometimes a bit more than just a little PITA (and is also something I've not developed any expertise with as yet).
 
I would just make a new improvement altogether. My Combined Tweaks mod does contain a unique improvement for Rainforests, the Brazilian Brazil Wood Camp improvement, based on the art for the in-game camp. It's not easy to do because you have to explicitly reference art files.
 
Back
Top Bottom