Tutorial: Modding with SQLLite Studio (PC)

SaintsSinners, Thank you very much for these tutorial. I tried to create my own customised mod to play but do not know how. Borrowed books on sql and xml, and read the basics. Tried creating the mods both in xml and sql format but was unsuccessful. Then I came across this discussion and found a great relief. Thank you very much.

I have not started your tutorial yet but surely, this informations is what I needed.

I have purchased SQLite from AppStore recently. Do we need SQLite Studio specifically to create the mod.
 
isau, I tried creating my own customised mod but noticed from the modding.log that it is not successful. There was a comment "Game configuration needs to change to match target config". I am not a programmer but able to understand basic. Appreciate if could provide some guidance. The mod I created was a simplified one to understand the modding process. I have attached my mod and log details.
 

Attachments

  • Archive 80.zip
    10.6 KB · Views: 250
1. Is it entire Database.log? Because you've got errors in .sql files and there's nothing about them in database.log. There are no rows that correspond to timestamp: [3721739.703] Warning: UpdateDatabase - Error Loading SQL.
2. Multiple rows in INSERT INTO are separated with comma not semicolon.
3. Text updates should be done in a separate component UpdateText, not UpdateDatabase.
 
1. Is it entire Database.log? Because you've got errors in .sql files and there's nothing about them in database.log. There are no rows that correspond to timestamp: [3721739.703] Warning: UpdateDatabase - Error Loading SQL.
2. Multiple rows in INSERT INTO are separated with comma not semicolon.
3. Text updates should be done in a separate component UpdateText, not UpdateDatabase.
1. Is it entire Database.log? Because you've got errors in .sql files and there's nothing about them in database.log. There are no rows that correspond to timestamp: [3721739.703] Warning: UpdateDatabase - Error Loading SQL.
2. Multiple rows in INSERT INTO are separated with comma not semicolon.
3. Text updates should be done in a separate component UpdateText, not UpdateDatabase.

Infixo, thanks. But I quite don't understand what you mean for s/n 3 "Text updates.......not UpdateDatabase".
 
Infixo, Thank you for your reply. I'll understand now. I change the modinfo file and try again.
 
Infixo, can you help me with some guidance on building mod. Although I have played from Civ 1 till Civ 5, I have never used mods or created my own mods before. I have followed through this tutorial and was successful in creating the tutorial mod. Thereafter, I am now trying to create my own unique mod. I am only trying a simple basic mod to understand the mod building process. I know some basic sql and xml program only. I am using the mod on website as reference to learn and build my own. I created same mods several times with changes but was unsuccessful in the final gameplay. I am not able to fully understand the nature of error in the log files. I believe there are some missing linkage file that may be required to be build or error in my file which cause the mod to fail. I only request your professional advise/guidance to help me to highlight my error and how to solve it. Appreciate if you could help me with your guidance. Thanks
 
@Rajendran As for starter, here are few suggestions that will help solve whatever problems you have now or in the future.
1. Create a separate thread in proper forum. I believe the purpose of this thread is somewhat different.
2. Describe your problem. Describe expected results vs. results you get. The more info you provide, the better.
3. Attach your mod and key log files (at least database.log and modding.log, Lua.log if you are programming and gameeffects.log if you are creating modifiers). Make sure you post actual mod, not modbuddy project.
 
Noted Infixo. Thank for your reply. I complete my latest mod, create a thread and continue from there. Thanks
 
Isau, I have re-read your Chapter 2: Dynamic modifiers, effects, collections and arguments. I have a query. Can create the code/command for
  1. Founding Fathers (America’s special ability) increases the rate of border expansion by 20% in all cities.
  2. Mimar Sinan’s (Great Engineer) ability instantly grants +4 Population.
In one sql/xml file or do we need to create specific sql/xml files.
 
Hey! I know it's months late, but this tutorial was great! I want to attempt to add back in the ability for regional buildings effects to stack on top of one-another. Any idea what I'd do? I've been fishing around in a whole load of tables looking for hints but so far haven't found anything that I would consider useful in achieving this.
 
Hiya, in order to insert anything that has a Type, the game itself has to make a Hash record. This is done by performing an INSERT into the Types table like you mentioned. This operation will fail in SQLite but will work in the game.

FYI you can get around this by running the following at the start of your SQLite session:

Code:
DROP TRIGGER OnTypeInsert;
CREATE TRIGGER OnTypeInsert AFTER INSERT ON Types BEGIN UPDATE Types SET Hash = random() Where Type = New.Type; END;

This simply generates a random number instead of a hash but there is a very low likelihood that the same number will be generated twice. If you run this you can fully test scripts include inserts into the Types table i.e. fully test your Mod SQL outside of the game.

To enable Foreign keys I run this too, but you've probably covered that:
Code:
PRAGMA foreign_keys = ON;
 
FYI you can get around this by running the following at the start of your SQLite session:

Code:
DROP TRIGGER OnTypeInsert;
CREATE TRIGGER OnTypeInsert AFTER INSERT ON Types BEGIN UPDATE Types SET Hash = random() Where Type = New.Type; END;

This simply generates a random number instead of a hash but there is a very low likelihood that the same number will be generated twice. If you run this you can fully test scripts include inserts into the Types table i.e. fully test your Mod SQL outside of the game.

To enable Foreign keys I run this too, but you've probably covered that:
Code:
PRAGMA foreign_keys = ON;



Great tips. Thanks @Deliverator!
 
Hello. Could you give me advice for changing game text?

I've found the LocalizedText database and noticed that most of in-game texts are included in the DB. The problem is, however, I could not find the new texts which has been added at the Rise and Fall expansion. Specifically, I want to change/update the text related Kotoku-in. Thanks in advance!
 
Hello. Could you give me advice for changing game text?

I've found the LocalizedText database and noticed that most of in-game texts are included in the DB. The problem is, however, I could not find the new texts which has been added at the Rise and Fall expansion. Specifically, I want to change/update the text related Kotoku-in. Thanks in advance!


If you want to find any text in the game you can just hook SQLite Studio up to the DebugLocalization database instead of DebugGameplay following the same instructions in this tutorial. Once connected to that database use the pulldown window in the SQL Editor to choose the database to run queries against.

upload_2018-3-17_23-14-58.png
 
The TEXT for Expansion1 is added only if that DLC is running and the RULE_SET is set to Expansion1 which is strange to me!!!
-jeff
 
@isau Hey man. Thanks so much for this tutorial and guide. It's excellent.

I haven't actually got anything I've modded to work properly yet... but that's probably me being slow ... heh heh, ... because otherwise this guide has been very, very helpful!
 
Top Bottom