• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

[SOLVED!] Custom civilization lacks unique bonuses, background art, and icons

SpaceCommunist

Warlord
Joined
Apr 11, 2016
Messages
119
Location
Malachor V
Basically it's all in the title. I've been working on a civ but there are issues with both the civ's abilities and artwork. I'm using Josh's Custom Civ template as a reference. I'm fully aware that there are problems with the template itself, however, and have done what is suggested elsewhere to work around it - but more on that later.

So I do actually use custom artwork for this mod (excluding the improvement, which, aside from not being able to build it as the civ's unique, has surprisingly been no trouble at all), but the only bit of it that shows up is the leader portrait (the image of the leader on the left-hand side of the screen when you select your civ/leader) and the leader's diplomacy image. Otherwise, there are either ?'s for the icons or just plain black screens elsewhere, despite having artwork dedicated towards them.

As for the uniques themselves, I have them fully coded, and have managed to prevent any crash-to-main-menu bugs through development. But strangely, the custom civ doesn't actually have the uniques available to it at all - in the loading screen, below the DoM text, there's just...nothing. And the bonuses are available in-game either, understandably.

I've checked the Database.txt, and this is all that comes up:

Database.txt said:
[461852.973] [Localization]: Validating Foreign Key Constraints...
[461852.974] [Localization]: Passed Validation.
[461852.985] [Configuration]: Validating Foreign Key Constraints...
[461852.986] [Configuration]: Passed Validation.
[461865.099] [FullTextSearch]: Initializing FullTextSearch
[461866.316] [Gameplay]: Validating Foreign Key Constraints...
[461866.332] [Gameplay]: Passed Validation.
[461868.181] [Configuration] ERROR: no such table: Types
[461868.181] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[461868.181] [Configuration]: In XMLSerializer while updating table Types from file SC_Mississippi_Uniques.xml.
[461868.184] [Configuration]: Validating Foreign Key Constraints...
[461868.185] [Configuration]: Passed Validation.
[461887.277] [FullTextSearch]: FTS - Creating Context
[461961.387] [Configuration] ERROR: no such table: Types
[461961.387] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[461961.387] [Configuration]: In XMLSerializer while updating table Types from file SC_Mississippi_Uniques.xml.
[461961.389] [Configuration]: Validating Foreign Key Constraints...
[461961.389] [Configuration]: Passed Validation.
[461963.835] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[461963.835] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[461963.869] [Gameplay]: Validating Foreign Key Constraints...
[461963.886] [Gameplay]: Passed Validation.
[461974.917] [FullTextSearch]: FTS - Creating Context
[461976.340] [FullTextSearch]: FTS - Creating Context
[461978.994] [FullTextSearch]: FTS - Creating Context

I really don't know what else to do. Maybe one of y'all can figure out what the issue is?
 

Attachments

Thanks for the help so far.

I created a new mod from scratch using that template, and so far it's been a "one step forward, two steps back" situation. I managed to get the icons and most of the other artwork functioning properly, however it's started crashing to the desktop during the loading screen. I have no idea if this has to do with the artwork (likely not, as I've done everything I can think of regarding it so that it should match perfectly with the code and the template) or the code itself.

Speaking of which, the uniques still don't attach to the civilization. At all. And now I'm having to deal with crashes.

Here's the Database.txt again:

Database.txt said:
[499601.038] [Localization]: Validating Foreign Key Constraints...
[499601.039] [Localization]: Passed Validation.
[499601.050] [Configuration]: Validating Foreign Key Constraints...
[499601.050] [Configuration]: Passed Validation.
[499614.187] [FullTextSearch]: Initializing FullTextSearch
[499615.715] [Gameplay]: Validating Foreign Key Constraints...
[499615.731] [Gameplay]: Passed Validation.
[499618.128] [Configuration] ERROR: no such table: Types
[499618.128] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[499618.128] [Configuration]: In XMLSerializer while updating table Types from file Template_Buildings.xml.
[499618.129] [Configuration] ERROR: no such table: Types
[499618.130] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[499618.130] [Configuration]: In XMLSerializer while updating table Types from file Template_Units.xml.
[499618.131] [Configuration]: Validating Foreign Key Constraints...
[499618.131] [Configuration]: Passed Validation.
[499638.562] [FullTextSearch]: FTS - Creating Context
[499642.445] [FullTextSearch]: FTS - Creating Context
[499650.385] [Configuration]: Validating Foreign Key Constraints...
[499650.385] [Configuration]: Passed Validation.
[499655.534] [Configuration] ERROR: no such table: Types
[499655.534] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[499655.534] [Configuration]: In XMLSerializer while updating table Types from file Template_Buildings.xml.
[499655.535] [Configuration] ERROR: no such table: Types
[499655.535] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[499655.535] [Configuration]: In XMLSerializer while updating table Types from file Template_Units.xml.
[499655.537] [Configuration]: Validating Foreign Key Constraints...
[499655.537] [Configuration]: Passed Validation.
[499685.885] [Configuration] ERROR: no such table: Types
[499685.885] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[499685.885] [Configuration]: In XMLSerializer while updating table Types from file Template_Buildings.xml.
[499685.887] [Configuration] ERROR: no such table: Types
[499685.887] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[499685.887] [Configuration]: In XMLSerializer while updating table Types from file Template_Units.xml.
[499685.888] [Configuration]: Validating Foreign Key Constraints...
[499685.889] [Configuration]: Passed Validation.
[499687.861] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[499687.861] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[499687.899] [Gameplay]: Validating Foreign Key Constraints...
[499687.923] [Gameplay]: Passed Validation.
[499694.179] [FullTextSearch]: FTS - Creating Context
[499695.474] [FullTextSearch]: FTS - Creating Context
[499698.293] [FullTextSearch]: FTS - Creating Context

For simplicity's sake, I haven't changed the Unit/Building files (aside from removing the second Unit template altogether) and haven't added in the original Improvement file in any way. Yet, the same issues I had with my Improvement file (the "Uniques.xml" one) seems to appear again with Units.xml and Buildings.xml - specifically, that "Types" doesn't appear to exist (???). Furthermore, the same issue as in the first post's Database.txt report appears again, without any details to explain it: apparently some ModifierIds are just flat out failing with no explanation to them. The only ones I can think of are the ones for the Leader trait and the Civilization trait, both within the same file (GameDefines.sql). Yet, I've tinkered with them all I can, and still nothing changes.

But now there's this new crash-to-desktop issue, and I haven't got a clue what to do about it.

Here's a link to the current build.
 
You are getting these errors
Code:
[499618.128] [Configuration] ERROR: no such table: Types
 [499618.128] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
 [499618.128] [Configuration]: In XMLSerializer while updating table Types from file Template_Buildings.xml.
 [499618.129] [Configuration] ERROR: no such table: Types
 [499618.130] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
 [499618.130] [Configuration]: In XMLSerializer while updating table Types from file Template_Units.xml.
because the code within files Template_Buildings.xml and Template_Units.xml is wrong for the <FrontEndActions> (Configuration) database.

Most of these templates I see floating around have this basic and fundamental file-usage error of attempting to load code that does not belong in the FrontEndActions database into the FrontEnd. While this does not actually hurt anything in nearly all cases it certainly kludges up the database.log file with meaningless error messages that inexperienced modders then attempt to chase down or are utterly confused by. It also teaches bad habits in that inexperienced modders might tend to believe anything can be chucked in anywhere that has an <UpdateDatabase> type of action in ModBuddy and the modinfo file. But this will cause a cascading error effect if you place something in the InGame or FrontEnd that does not belong there along with needed mod code that does belong in the database to which the file is being loaded.

This file C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Configuration\Data\Schema/AdditionalTables.sql lists every table and its correct columns for everything that belongs in a file loaded via a <FrontEndActions> <UpdateDatabase> action. Table "Types" does not appear within the list for the FrontEnd.

This file C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data\Schema/01_GameplaySchema.sql lists every table and its correct columns for everything that belongs in a file loaded via a <InGameActions> <UpdateDatabase> action. Table "Types" does appear within the list for the InGame.

In Database.log an error message with:
[Configuration]: at the beginning
means the file where the error occured was being loaded into the <FrontEndActions>​
[Gameplay]: at the beginning
means the file where the error occured was being loaded into the <InGameActions>​

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

also for whatever reason your link to the current build won't allow me to get to the download without signing in to dropbox, which seems strange since I both have a dropbox account and you usually don't have to sign in to dropbox just to download a file (even though they try to get you to sign up for dropbox)
 
That's weird what dropbox is doing. Not sure why that is, but hey, as long as it's able to be downloaded...

So! With a bit of tinkering, I've gotten rid of the crash-while-loading problem. I believe the problem was related to the ART_LEADER_[name] file being referenced in the Leaders.artdef file, so I put in ART_LEADER_MONTEZUMA just as a backup in case the ART_LEADER_SC_TUSKALOOSA file doesn't work (which it does now, as it's referenced in GameDefines.sql).

That only leaves one problem, which is the one that's consistently popped up in Database.txt. I took what you suggested, Lee, and removed the Buildings.xml and Units.xml out of the FrontEnd area, if only for the sake of cluttering up the area. Now Database.txt only shows the one final issue:

Database.txt said:
[536483.629] [Localization]: Validating Foreign Key Constraints...
[536483.630] [Localization]: Passed Validation.
[536483.651] [Configuration]: Validating Foreign Key Constraints...
[536483.652] [Configuration]: Passed Validation.
[536495.677] [FullTextSearch]: Initializing FullTextSearch
[536496.942] [Gameplay]: Validating Foreign Key Constraints...
[536496.958] [Gameplay]: Passed Validation.
[536499.228] [Configuration]: Validating Foreign Key Constraints...
[536499.229] [Configuration]: Passed Validation.
[536519.136] [FullTextSearch]: FTS - Creating Context
[536544.821] [Configuration]: Validating Foreign Key Constraints...
[536544.821] [Configuration]: Passed Validation.
[536547.217] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId (emphasis mine)
[536547.217] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId (emphasis mine)
[536547.268] [Gameplay]: Validating Foreign Key Constraints...
[536547.287] [Gameplay]: Passed Validation.
[536553.627] [FullTextSearch]: FTS - Creating Context
[536554.890] [FullTextSearch]: FTS - Creating Context
[536557.190] [FullTextSearch]: FTS - Creating Context
[536668.596] [FullTextSearch]: FullTextSearch - Shutting down

As it stands, the ModifierId issue appears to be what's wrong here. The only place where I've consistently used Modifiers in all builds of the mod is GameDefines.sql, so I narrowed it down to two areas: the Leader trait and the Civilization trait. So with a bit of tinkering, I temporarily removed both traits' Modifiers and just left them as empty traits with no function. The problem disappeared and the uniques attached to the civ when I did that, confirming that the problem lies with them. I repeated this process again and only removed the Civilization trait's modifiers, and again the results were the same - the uniques attached to the civ just fine. For a third time I built the mod but added back the Civilization trait's modifiers, but this time, the above error appeared once again, confirming that this is in fact an issue with the Civilization trait's modifiers.

Going from that, there's only one thing that makes the Civilization trait's modifiers stand out from the rest - in that I am using a custom modifier (the coding to create it is at the bottom of the GameDefines.sql file) to grant an adjacency bonus to districts based on adjacent terrain types (in this case, Hills). I based it off the coding used in Sukritact's Ethiopia mod (Ethiopia's civ bonus grants faith to City Centers based on adjacent Hills and Mountains) - and as far as I can tell, there's nothing different between the two codes that should make the custom modifier work in that mod and not mine.

Once again, here's a link to the current build. To look for what I'm talking about in regards to the custom modifier, just CTRL+F "MODIFIER_SC_PLAYER_CITIES_TERRAIN_ADJACENCY" in Template_GameDefines.sql (the one in the Core Files, not Temporary Files).
 
You are attempting to use the same ModifierId in table Modifiers in more than one row, or you are trying to re-define one that is already assigned in the base game.

And what I meant with re your dropbox link is that unlike normal you are not able to get past the opening page to the actual download. I think maybe your settings in dropbox are to not allow anyone but dropbox members to access the download. And I can't for the life of me remember what my dropbox password and stuff are since I never sign out, but the page I get does not recognize me as being signed in.
 
Last edited:
That did the trick! Thank you both so very much for the help, now I'll finally be able to complete this project (and others) without any more major hiccups (at least, none that should be game-breaking :P). Plus, the bonuses for the civ (the ones I've coded in at least) are functioning just as I'd like them to!

And on the dropbox issue, yeah I'll have to check and see if my sharing settings are locked to certain users. Last I checked it was public/free use, but things can always change I suppose.

Once again, thank you both very much!
 
Back
Top Bottom