Trouble understanding Database.log errors

Ullik

Chieftain
Joined
Mar 27, 2021
Messages
2
Location
Norway
Hi, I'm super new to modding and have realized I am way over my head here.
I was following These mod creation videos by Keniisu, and since they are incomplete I decided to just try and work things out.

I am trying to create a custom civilization and leader, with unique units and abilities. The error seems to be in relation to the unique civilization ability, where I am trying to make the Lighthouse, Shipyard and Seaport to give additional production.
----------------------------------------------
The database.log errors:
Code:
 [1957228.758] [Gameplay] ERROR: Invalid Reference on TraitModifiers.ModifierId - "MODIFIER_ULLIK_NORWAY_UA_LIGHTHOUSE_PRODUCTION" does not exist in Modifiers
[1957228.758] [Gameplay] ERROR: Invalid Reference on TraitModifiers.ModifierId - "MODIFIER_ULLIK_NORWAY_UA_SHIPYARD_PRODUCTION" does not exist in Modifiers
[1957228.758] [Gameplay] ERROR: Invalid Reference on TraitModifiers.ModifierId - "MODIFIER_ULLIK_NORWAY_UA_SEAPORT_PRODUCTION" does not exist in Modifiers
[1957228.772] [Gameplay]: Failed Validation.

as well as a BUNCH of these
Code:
 [1957227.744] [Localization] ERROR: near "   
    ": syntax error
-----------------------------------------------

For the first errors, I don't understand what's wrong, as to my (limited) knowledge everything looks right. This is an excerpt from my Civilization_UA.sql file:
Code:
---------------------------------------------------------
-- TraitModifiers
---------------------------------------------------------               

INSERT INTO TraitModifiers
        (TraitType,                                        ModifierId                    )
VALUES ('TRAIT_CIVILIZATION_ULLIK_NORWAY_UA',        'MODIFIER_ULLIK_NORWAY_UA_LIGHTHOUSE_PRODUCTION'    ),
        ('TRAIT_CIVILIZATION_ULLIK_NORWAY_UA',        'MODIFIER_ULLIK_NORWAY_UA_SHIPYARD_PRODUCTION'    ),
        ('TRAIT_CIVILIZATION_ULLIK_NORWAY_UA',        'MODIFIER_ULLIK_NORWAY_UA_SEAPORT_PRODUCTION' );

---------------------------------------------------------
-- DynamicModifiers
---------------------------------------------------------   

INSERT INTO DynamicModifiers
        (ModifierType,                                                    CollectionType,
                    EffectType                                                    )
VALUES ('MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',
    'COLLECTION_PLAYER_CITIES',        'EFFECT_ADJUST_BUILDING_YIELD_CHANGE'
    );

---------------------------------------------------------
-- Modifiers
---------------------------------------------------------   

INSERT INTO Modifiers
        (ModifierId,                                        ModifierType,                        OwnerRequirementSetId,    SubjectRequirementSetId,    RunOnce,        Permanent    )
VALUES    ('MODIFIER_ULLIK_NORWAY_UA_LIGHTHOUSE_PRODUCTION',    'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',    NULL,        NULL,                        0,                    0,            ),
        ('MODIFIER_ULLIK_NORWAY_UA_SHIPYARD_PRODUCTION',    'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',    NULL,        NULL,                        0,                    0,            ),
        ('MODIFIER_ULLIK_NORWAY_UA_SEAPORT_PRODUCTION',     'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',    NULL,        NULL,                        0,                    0,            );

The second error, the syntax one, I just don't understand at all since I am so unfamiliar with sql.

If I need to provide any more context or code please let me know!
Thanks in advance for any help!
 
Look higher up in Database.log for syntax error messages. This chuunk of code is not formatted correctly. You have an extra comma in each line which SQL is probably interpretting as an attempt to state an additional column value:
Code:
INSERT INTO Modifiers
        (ModifierId,                                        ModifierType,                        OwnerRequirementSetId,    SubjectRequirementSetId,    RunOnce,        Permanent    )
VALUES    ('MODIFIER_ULLIK_NORWAY_UA_LIGHTHOUSE_PRODUCTION',    'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',    NULL,        NULL,                        0,                    0,            ),
        ('MODIFIER_ULLIK_NORWAY_UA_SHIPYARD_PRODUCTION',    'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',    NULL,        NULL,                        0,                    0,            ),
        ('MODIFIER_ULLIK_NORWAY_UA_SEAPORT_PRODUCTION',     'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',    NULL,        NULL,                        0,                    0,            );
Delete the unnecessary extra comma between the last 0 in each line and before the ) in each line
Code:
INSERT INTO Modifiers
        (ModifierId,						ModifierType,					OwnerRequirementSetId,	SubjectRequirementSetId,    RunOnce,	Permanent    )
VALUES	('MODIFIER_ULLIK_NORWAY_UA_LIGHTHOUSE_PRODUCTION',	'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',	NULL,		        NULL,                        0,		0),
        ('MODIFIER_ULLIK_NORWAY_UA_SHIPYARD_PRODUCTION',	'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',	NULL,			NULL,                        0,		0),
        ('MODIFIER_ULLIK_NORWAY_UA_SEAPORT_PRODUCTION',		'MODTYPE_ULLIK_NORWAY_UA_BUILDING_PRODUCTION',	NULL,			NULL,                        0,		0);
The other syntax errors you are seeing are related to at least one mistake in a file you are loading under an UpdateText action-type. However, before looking for syntax errors in that file make sure the "id" names of all your actions regardless of whether they are UpdateText, UpdateDatabase, or whatever have no spaces and start with a letter of the alphabet.

The problem with excerpts of code rather than the mod itself as it is in the game's Mods folder zipped and attached to a post (or at the very least a copy/paste of the entire contents of the file where the issue appears to be) is that any single syntax error between the Insert into table TraitModifiers and table Modifiers will cause the game to stop reading anything else within that file, and the Invalid Reference error you are getting will be the result. Without all your code to look at the problem is like trying to diagnose a fatal disease using a Oujia Board from 1,000 miles away.
 
Last edited:
I removed the extra commas, and now it loads, with no "Invalid Reference" error!
Like I mentioned, I am entirely new to modding and SQL, so had no idea that was even wrong lol. Thank you so much for the help though, really appreciate it! :)
 
Top Bottom