TheLunarArmy
Chieftain
Hi all,
Doing a unique civ mod with a building that functions similar to Japan's Electronics factory (+4 Culture when Electronics is researched); trying to get a hang of using Modifiers, and got the requirements working similarly to how ..\Gameplay\Data\Buildings.xml is setup, but using SQL. Somehow I get a "[Gameplay] ERROR: CHECK constraint failed: Modifiers" error at load screen. I assume this is due to a unique ID conflict, but the things is the ModifierId name I chose is quite unique, so I think it might be the ordering of my SQL file or any other input is greatly appreciated.
The exact error, from Database.log, is as follows:
My UB sql file is as follow:
(For debugging purposes I am trying to give +10 Culture after Apprenticeship Tech has been researched)
Doing a unique civ mod with a building that functions similar to Japan's Electronics factory (+4 Culture when Electronics is researched); trying to get a hang of using Modifiers, and got the requirements working similarly to how ..\Gameplay\Data\Buildings.xml is setup, but using SQL. Somehow I get a "[Gameplay] ERROR: CHECK constraint failed: Modifiers" error at load screen. I assume this is due to a unique ID conflict, but the things is the ModifierId name I chose is quite unique, so I think it might be the ordering of my SQL file or any other input is greatly appreciated.
The exact error, from Database.log, is as follows:
[1001581.536] [Configuration]: Validating Foreign Key Constraints...
[1001581.537] [Configuration]: Passed Validation.
[1001588.665] [Gameplay] ERROR: CHECK constraint failed: Modifiers
[1001588.665] [Gameplay] ERROR: CHECK constraint failed: Modifiers
[1001589.376] [Gameplay]: Validating Foreign Key Constraints...
[1001589.412] [Gameplay]: Passed Validation.
My UB sql file is as follow:
(For debugging purposes I am trying to give +10 Culture after Apprenticeship Tech has been researched)
Code:
-- iNcontroL_UB
-- Author: TLA
-- DateCreated: 3/15/2018 6:57:54 PM
--------------------------------------------------------------
INSERT INTO Types
(Type, Kind )
VALUES ('TRAIT_CIVILIZATION_TLA_INCONTROL_UB', 'KIND_TRAIT' ),
('BUILDING_TLA_INCONTROL_UB', 'KIND_BUILDING' );
-----------------------------------------------
-- Traits
-----------------------------------------------
INSERT INTO Traits
(TraitType, Name, Description )
VALUES ('TRAIT_CIVILIZATION_TLA_INCONTROL_UB', 'LOC_BUILDING_TLA_INCONTROL_UB_NAME', 'LOC_BUILDING_TLA_INCONTROL_UB_DESCRIPTION');
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------
INSERT INTO CivilizationTraits
(CivilizationType, TraitType )
VALUES ('CIVILIZATION_TLA_INCONTROL', 'TRAIT_CIVILIZATION_TLA_INCONTROL_UB' );
INSERT INTO BuildingReplaces
(CivUniqueBuildingType, ReplacesBuildingType )
VALUES ('BUILDING_TLA_INCONTROL_UB', 'BUILDING_ARENA' );
INSERT INTO Buildings
(BuildingType, Name, Description, PrereqCivic, PrereqDistrict, PurchaseYield, Cost, AdvisorType, Maintenance, Entertainment, Housing, TraitType )
VALUES ( 'BUILDING_TLA_INCONTROL_UB', -- Building Type
'LOC_BUILDING_TLA_INCONTROL_UB_NAME', -- Name
'LOC_BUILDING_TLA_INCONTROL_UB_DESCRIPTION', -- Description
'CIVIC_GAMES_RECREATION', -- PrereqCivic
'DISTRICT_ENTERTAINMENT_COMPLEX', -- PrereqDistrict
'YIELD_GOLD', -- Purchase Yield
'150', -- Cost
'ADVISOR_GENERIC', -- AdvisorType
'1', -- Maintenance
'1', -- Entertainment
'1', -- Housing
'TRAIT_CIVILIZATION_TLA_INCONTROL_UB' --TraitType
);
--INSERT INTO Building_YieldChanges
-- (BuildingType, YieldType, YieldChange)
--VALUES ('BUILDING_TLA_INCONTROL_UB', 'YIELD_CULTURE', '5'); --Testing for now
INSERT INTO Modifiers
(ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId)
VALUES ('MODIFIER_TLA_INCONTROL_UB_APPRENTICESHIP','MODIFIER_BUILDING_YIELD_CHANGE', 'false', 'true', 'PLAYER_HAS_APPRENTICESHIP_TECH_REQUIREMENTS' );
INSERT INTO ModifierArguments
(ModifierId, Name, Value)
VALUES ('MODIFIER_TLA_INCONTROL_UB_APPRENTICESHIP','BuildingType', 'BUILDING_TLA_INCONTROL_UB'),
('MODIFIER_TLA_INCONTROL_UB_APPRENTICESHIP','Amount', '10'),
('MODIFIER_TLA_INCONTROL_UB_APPRENTICESHIP','YieldType', 'YIELD_CULTURE');
INSERT INTO BuildingModifiers
(BuildingType, ModifierId)
VALUES ('BUILDING_TLA_INCONTROL_UB','MODIFIER_TLA_INCONTROL_UB_APPRENTICESHIP');
INSERT INTO Requirements
(RequirementId, RequirementType)
VALUES ('REQUIRES_PLAYER_HAS_APPRENTICESHIP_TECH','REQUIREMENT_PLAYER_HAS_TECHNOLOGY');
INSERT INTO RequirementArguments
(RequirementId, Name, Value)
VALUES ('REQUIRES_PLAYER_HAS_APPRENTICESHIP_TECH','TechnologyType', 'TECH_APPRENTICESHIP' );
INSERT INTO RequirementSets
(RequirementSetId, RequirementSetType)
VALUES ('PLAYER_HAS_APPRENTICESHIP_TECH_REQUIREMENTS','REQUIREMENTSET_TEST_ALL' );
INSERT INTO RequirementSetRequirements
(RequirementSetId, RequirementId)
VALUES ('PLAYER_HAS_APPRENTICESHIP_TECH_REQUIREMENTS','REQUIRES_PLAYER_HAS_APPRENTICESHIP_TECH' );