Civ's UA: Building Holy Sites on a specific terrain

You need to look higher up in Database.log for fatal coding errors.
Code:
[2644949.037] [Gameplay] ERROR: UNIQUE constraint failed: Requirements.RequirementId
[2644949.038] [Gameplay] ERROR: UNIQUE constraint failed: Requirements.RequirementId
Then by comparing these two timestamps to the data in file Modding.log we can see that file(s) are likely those where these errors are being created
Code:
[2644949.033] UpdateDatabase - Loading Core/Civilization_Config.sql
[2644949.036] UpdateDatabase - Loading Core/Civilization_UA.sql
[2644949.038] Warning: UpdateDatabase - Error Loading SQL.
Either or both of these files contain a Unique Constraint error. What this means is that the code within the file(s) is attempting to define something the game's database already contains. SQL Databases never allow this, regardless of whether it is an SQL database being used by Civ6 or one being used to create and track a customer address book.

File "Civilization_Config.sql" is probably generating this error because of this stuff which all looks completely carry-over from the original template and also completely unecessary
Code:
-----------------------------------------------
-- RequirementSets
-----------------------------------------------

INSERT INTO RequirementSets
        (RequirementSetId,					RequirementSetType			)
VALUES	('REQSET_CVS_PLAYER_IS_ROMANIAN',	'REQUIREMENTSET_TEST_ALL'	),
		('REQSET_CVS_LEADER_IS_ROMANIAN',	'REQUIREMENTSET_TEST_ANY'	);

-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
        (RequirementSetId,					RequirementId					)
VALUES	('REQSET_CVS_PLAYER_IS_ROMANIAN',	'REQ_CVS_PLAYER_IS_ROMANIAN'	);

-----------------------------------------------
-- Requirements
-----------------------------------------------

INSERT INTO Requirements
		(RequirementId,					RequirementType						)
VALUES	('REQ_CVS_PLAYER_IS_ROMANIAN',	'REQUIREMENT_REQUIREMENTSET_IS_MET'	);

-----------------------------------------------
-- RequirementArguments
-----------------------------------------------

INSERT INTO RequirementArguments
		(RequirementId,					Name,				Value							)
VALUES	('REQ_CVS_PLAYER_IS_ROMANIAN',	'RequirementSetId', 'REQSET_CVS_LEADER_IS_ROMANIAN'	);

/*
-----------------------------------------------
-- Support for Alternative Leaders
-----------------------------------------------

INSERT INTO RequirementSetRequirements
        (RequirementSetId,					RequirementId					)
VALUES	('REQSET_CVS_LEADER_IS_ROMANIAN',	'REQ_CVS_LEADER_IS_LEADERNAME'	);

INSERT INTO Requirements
		(RequirementId,						RequirementType								)
VALUES	('REQ_CVS_LEADER_IS_LEADERNAME',	'REQUIREMENT_PLAYER_LEADER_TYPE_MATCHES'	);

INSERT INTO RequirementArguments
		(RequirementId,						Name,			Value					)
VALUES	('REQ_CVS_LEADER_IS_LEADERNAME',	'LeaderType',	'LEADER_CVS_LEADERNAME'	);

*/
These invalid reference error messages stem from the same file
Code:
[2644949.342] [Gameplay] ERROR: Invalid Reference on StartBiasTerrains.CivilizationType - "CIVILIZATION_PYTO_MANGORIAN_EMPIRE" does not exist in Civilizations
[2644949.342] [Gameplay] ERROR: Invalid Reference on StartBiasTerrains.CivilizationType - "CIVILIZATION_PYTO_MANGORIAN_EMPIRE" does not exist in Civilizations
because of this
Code:
INSERT INTO	StartBiasTerrains
	(CivilizationType,				TerrainType,		Tier	)
VALUES	('CIVILIZATION_PYTO_MANGORIAN_EMPIRE',	'TERRAIN_TUNDRA',		1		),
	('CIVILIZATION_PYTO_MANGORIAN_EMPIRE',	'TERRAIN_TUNDRA_HILLS',		1		);
But everywhere else you are referring to it as "CIVILIZATION_PYTO_MANGONISTAN"

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

REQUIRES_DISTRICT_IS_HOLY_SITE already exists as a RequirementId in the game: you therefore cannot attempt to re-define it in your file, nor do you need to. You only need to "refer" to it.
Code:
-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
        (RequirementSetId,					RequirementId	)
VALUES	('SUBJECT_PYTO_MANGONISTAN_UA_REQUIRE_HS_TUNDRA',	'REQUIRES_DISTRICT_IS_HOLY_SITE'),
	('SUBJECT_PYTO_MANGONISTAN_UA_REQUIRE_HS_TUNDRA',	'REQUIRES_TILE_TUNDRA'); 

-------------------------------------
-- Requirements
-------------------------------------
INSERT INTO Requirements
	(RequirementId,			RequirementType,				Inverse)
VALUES	('REQUIRES_TILE_TUNDRA',	'REQUIREMENT_PLOT_TERRAIN_TYPE_MATCHES',	0	   );
-------------------------------------
-- RequirementArguments
-------------------------------------
INSERT INTO RequirementArguments
	(RequirementId,			Name,			Value		)
VALUES	('REQUIRES_TILE_TUNDRA',	'TerrainType',		'TERRAIN_TUNDRA');
As written though your requirement will only apply to flat Tundra tiles and will ignore Tundra Hill tiles.
 
The larger issue though is that the Modifier you are attaching to your trait has a collection of "Owner" which would imply it will want to apply itself to the trait rather than the districts the player creates. And a Trait can never be a Holy Site nor be located on a map plot, let alone a tundra one.

Further you've given an amount by which to adjust great people points but never specified the sort of great people this should be applied towards.
 
You need to look higher up in Database.log for fatal coding errors.
Code:
[2644949.037] [Gameplay] ERROR: UNIQUE constraint failed: Requirements.RequirementId
[2644949.038] [Gameplay] ERROR: UNIQUE constraint failed: Requirements.RequirementId
Then by comparing these two timestamps to the data in file Modding.log we can see that file(s) are likely those where these errors are being created
Code:
[2644949.033] UpdateDatabase - Loading Core/Civilization_Config.sql
[2644949.036] UpdateDatabase - Loading Core/Civilization_UA.sql
[2644949.038] Warning: UpdateDatabase - Error Loading SQL.
Either or both of these files contain a Unique Constraint error. What this means is that the code within the file(s) is attempting to define something the game's database already contains. SQL Databases never allow this, regardless of whether it is an SQL database being used by Civ6 or one being used to create and track a customer address book.

File "Civilization_Config.sql" is probably generating this error because of this stuff which all looks completely carry-over from the original template and also completely unecessary
Code:
-----------------------------------------------
-- RequirementSets
-----------------------------------------------

INSERT INTO RequirementSets
        (RequirementSetId,                    RequirementSetType            )
VALUES    ('REQSET_CVS_PLAYER_IS_ROMANIAN',    'REQUIREMENTSET_TEST_ALL'    ),
        ('REQSET_CVS_LEADER_IS_ROMANIAN',    'REQUIREMENTSET_TEST_ANY'    );

-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
        (RequirementSetId,                    RequirementId                    )
VALUES    ('REQSET_CVS_PLAYER_IS_ROMANIAN',    'REQ_CVS_PLAYER_IS_ROMANIAN'    );

-----------------------------------------------
-- Requirements
-----------------------------------------------

INSERT INTO Requirements
        (RequirementId,                    RequirementType                        )
VALUES    ('REQ_CVS_PLAYER_IS_ROMANIAN',    'REQUIREMENT_REQUIREMENTSET_IS_MET'    );

-----------------------------------------------
-- RequirementArguments
-----------------------------------------------

INSERT INTO RequirementArguments
        (RequirementId,                    Name,                Value                            )
VALUES    ('REQ_CVS_PLAYER_IS_ROMANIAN',    'RequirementSetId', 'REQSET_CVS_LEADER_IS_ROMANIAN'    );

/*
-----------------------------------------------
-- Support for Alternative Leaders
-----------------------------------------------

INSERT INTO RequirementSetRequirements
        (RequirementSetId,                    RequirementId                    )
VALUES    ('REQSET_CVS_LEADER_IS_ROMANIAN',    'REQ_CVS_LEADER_IS_LEADERNAME'    );

INSERT INTO Requirements
        (RequirementId,                        RequirementType                                )
VALUES    ('REQ_CVS_LEADER_IS_LEADERNAME',    'REQUIREMENT_PLAYER_LEADER_TYPE_MATCHES'    );

INSERT INTO RequirementArguments
        (RequirementId,                        Name,            Value                    )
VALUES    ('REQ_CVS_LEADER_IS_LEADERNAME',    'LeaderType',    'LEADER_CVS_LEADERNAME'    );

*/
These invalid reference error messages stem from the same file
Code:
[2644949.342] [Gameplay] ERROR: Invalid Reference on StartBiasTerrains.CivilizationType - "CIVILIZATION_PYTO_MANGORIAN_EMPIRE" does not exist in Civilizations
[2644949.342] [Gameplay] ERROR: Invalid Reference on StartBiasTerrains.CivilizationType - "CIVILIZATION_PYTO_MANGORIAN_EMPIRE" does not exist in Civilizations
because of this
Code:
INSERT INTO    StartBiasTerrains
    (CivilizationType,                TerrainType,        Tier    )
VALUES    ('CIVILIZATION_PYTO_MANGORIAN_EMPIRE',    'TERRAIN_TUNDRA',        1        ),
    ('CIVILIZATION_PYTO_MANGORIAN_EMPIRE',    'TERRAIN_TUNDRA_HILLS',        1        );
But everywhere else you are referring to it as "CIVILIZATION_PYTO_MANGONISTAN"

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

REQUIRES_DISTRICT_IS_HOLY_SITE already exists as a RequirementId in the game: you therefore cannot attempt to re-define it in your file, nor do you need to. You only need to "refer" to it.
Code:
-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
        (RequirementSetId,                    RequirementId    )
VALUES    ('SUBJECT_PYTO_MANGONISTAN_UA_REQUIRE_HS_TUNDRA',    'REQUIRES_DISTRICT_IS_HOLY_SITE'),
    ('SUBJECT_PYTO_MANGONISTAN_UA_REQUIRE_HS_TUNDRA',    'REQUIRES_TILE_TUNDRA');

-------------------------------------
-- Requirements
-------------------------------------
INSERT INTO Requirements
    (RequirementId,            RequirementType,                Inverse)
VALUES    ('REQUIRES_TILE_TUNDRA',    'REQUIREMENT_PLOT_TERRAIN_TYPE_MATCHES',    0       );
-------------------------------------
-- RequirementArguments
-------------------------------------
INSERT INTO RequirementArguments
    (RequirementId,            Name,            Value        )
VALUES    ('REQUIRES_TILE_TUNDRA',    'TerrainType',        'TERRAIN_TUNDRA');
As written though your requirement will only apply to flat Tundra tiles and will ignore Tundra Hill tiles.

Oh wow. Thank you for your comprehensive feedback once again. I really appreciate that. First: I did not mention the StartBias Error because I fixed as soon as I saw the Error in the log.

REQUIRES_DISTRICT_IS_HOLY_SITE already exists as a RequirementId in the game: you therefore cannot attempt to re-define it in your file, nor do you need to. You only need to "refer" to it.

I do understand the first part of it. But how can I "refer" to it?
Thanks once again for your help. I am getting a better and better idea of how Civ6 modding works.

EDIT: I think I changed what you meant. Do you mean with "refer" that 'REQUIRES_DISTRICT_IS_HOLY_SITE' only has to be entered once under "RequirementSetRequirements" in the column "RequirementId"?
 
Last edited:
Yes. See my edited code at the bottom of thread comment #21. I edited your code to make it "refer" to the existing RequirementId "REQUIRES_DISTRICT_IS_HOLY_SITE" and to add the new RequirementId "REQUIRES_TILE_TUNDRA" to the game.
 
Back
Top Bottom