Tutorial: Modding with SQLLite Studio (PC)

Okay.. i'm right back with the CHMZ mod while preparing to insert the NFP assets from all six finalized packages.

Another tricky component i've been stuck with (for months!) is the GP custom Small-Moments which needs to specify their types once recruited straight into each of their unique DDS.. refer to this sample for details...
Sample_REF.png


At first.. i thought the default runtime hooks would respond to direct ID tagging (either via Types or Names) of the Parameters as pulled via their regular generic LUA -- but nothing was tied with whatever defined "data" i had presumed was going to parse them through on every Moments activation(s).

Code:
--CHMZ(GPCT)_Bonus Init Phase

--GPCT section...
INSERT INTO MomentIllustrationTypes (  'MOMENTILLUSTRATIONTYPE'  )
      VALUES (  'MOMENT_ILLUSTRATION_GPCT'  );

INSERT INTO MomentIllustrations (  MomentIllustrationType, MomentDataType, GameDataType, Texture  )
--Great Persons by Class Types(9)
       VALUES
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_ADMIRAL', 'CHMZ_MomentSmall_GPCT_Admiral.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_ARTIST', 'CHMZ_MomentSmall_GPCT_Artist.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_ENGINEER', 'CHMZ_MomentSmall_GPCT_Engineer.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_GENERAL', 'CHMZ_MomentSmall_GPCT_General.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_MERCHANT', 'CHMZ_MomentSmall_GPCT_Merchant.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_MUSICIAN', 'CHMZ_MomentSmall_GPCT_Musician.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_PROPHET', 'CHMZ_MomentSmall_GPCT_Prophet.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_SCIENTIST', 'CHMZ_MomentSmall_GPCT_Scientist.dds'  ),
       (  'MOMENT_ILLUSTRATION_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_WRITER', 'CHMZ_MomentSmall_GPCT_Writer.dds'  );

--"Replacer Hooks of the default Small/Moments cycle" for each Great Persons (GPCT) as declared above!

--GPCT/GAME-ERA
UPDATE [Moments]
SET [InterestLevel] = '1', [BackgroundTexture] = NULL, [MomentIllustrationType] = 'MOMENT_ILLUSTRATION_GPCT'
WHERE ([MomentType] = 'MOMENT_GREAT_PERSON_CREATED_GAME_ERA');

--GPCT/PAST-ERA
UPDATE [Moments]
SET [InterestLevel] = '1', [BackgroundTexture] = NULL, [MomentIllustrationType] = 'MOMENT_ILLUSTRATION_GPCT'
WHERE ([MomentType] = 'MOMENT_GREAT_PERSON_CREATED_PAST_ERA');

Consult the zip (CHMZ_Wondering) to check how i managed to integrate the Wonders.. with their own big Moments rather than the default small(s) of "Liberty Statue snap symbol". I always thought such process would also work for GP stuff.. but it seems the "GAME_ERA" parser dual step either blocks any other tagging system i try to implement, or outright cuts off any replacement attempts based on transiting DATA.

Any ideas how to proceed.. correctly?
 

Attachments

  • CHMZ_Wondering.zip
    1.6 KB · Views: 99
Last edited:
Soooooo.. still trying to push the tricks MUCH further into risky flaws & silly attempts.
Code:
-----------------
--GPCT section...
INSERT INTO MomentIllustrationTypes (  'MOMENTILLUSTRATIONTYPE'  )
       VALUES (  'MOMENTSMALL_GPCT'  );

INSERT INTO MomentIllustrations (  MomentIllustrationType, MomentDataType, GameDataType, IconTexture  )
--INSERT INTO MomentIllustrations (  MomentIllustrationType, MomentDataType, GreatPersonClassType, IconTexture  )
--Great Persons by Class Types(9)
       VALUES
--       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_INDIVIDUAL_GALILEO_GALILEI', 'CHMZ_MomentSmall_GPCT_Scientist.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_ADMIRAL', 'CHMZ_MomentSmall_GPCT_Admiral.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_ARTIST', 'CHMZ_MomentSmall_GPCT_Artist.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_ENGINEER', 'CHMZ_MomentSmall_GPCT_Engineer.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_GENERAL', 'CHMZ_MomentSmall_GPCT_General.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_MERCHANT', 'CHMZ_MomentSmall_GPCT_Merchant.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_MUSICIAN', 'CHMZ_MomentSmall_GPCT_Musician.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_PROPHET', 'CHMZ_MomentSmall_GPCT_Prophet.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_SCIENTIST', 'CHMZ_MomentSmall_GPCT_Scientist.dds'  ),
       (  'MOMENTSMALL_GPCT', 'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', 'GREAT_PERSON_CLASS_WRITER', 'CHMZ_MomentSmall_GPCT_Writer.dds'  );

--"Replacer Hooks of the default Small/Moments cycle" for each Great Persons (GPCT) as declared above!

--GPCT/GAME-ERA
UPDATE [Moments]
SET [InterestLevel] = '1', [BackgroundTexture] = NULL, [IconTexture] = 'MOMENTSMALL_GPCT'
WHERE ([MomentType] = 'MOMENT_GREAT_PERSON_CREATED_GAME_ERA');

--GPCT/PAST-ERA
UPDATE [Moments]
SET [InterestLevel] = '1', [BackgroundTexture] = NULL, [IconTexture] = 'MOMENTSMALL_GPCT'
WHERE ([MomentType] = 'MOMENT_GREAT_PERSON_CREATED_PAST_ERA');

Small or Illustration .. might be the whole culprit of wacky conditional defines that keep failing.
Even [IconTexture].. tagging isn't recognized by INSERT or UPDATE instructions.

Integrating a swift test with true INDIVIDUAL feed-through (Galileo) didn't work either.

No LUCK -- this is rapidly becoming a horrific nightmare.
 
Last edited:
Gosh.. i really have to wonder if this little trick by @ChimpanG could be re--used with a few proper edits to solve the above "problems";
Code:
--CHMZ(X)_Supporting other Mods (by Zyxpsilon)

--Chimpan'G; Give this file a load order of 150 or something and that should cover everything.

REPLACE INTO MomentIllustrations (MomentIllustrationType, MomentDataType, GameDataType, Texture)
SELECT    'MOMENT_ILLUSTRATION_NATURAL_WONDER',
        'MOMENT_DATA_FEATURE',
        FeatureType,
        'CHMZ_MOMENT_'||FeatureType||'.dds'
FROM    Features
WHERE    FeatureType
IN        (
        -- Terra Mirabilis 19 Natural Wonders
        'FEATURE_BARRINGER_CRATER',
        'FEATURE_BIOLUMINESCENT_BAY',
        'FEATURE_CERRO_DE_POTOSI',
        'FEATURE_DALLOL',
        'FEATURE_GIBRALTAR',
        'FEATURE_GRAND_MESA',
        'FEATURE_KAILASH',
        'FEATURE_KRAKATOA',
        'FEATURE_LAKE_VICTORIA',
        'FEATURE_MOSI_OA_TUNYA',
        'FEATURE_MOTLATSE_CANYON',
        'FEATURE_NAMIB',
        'FEATURE_OLD_FAITHFUL',
        'FEATURE_OUNIANGA',
        'FEATURE_SALAR_DE_UYUNI',
        'FEATURE_SINAI',
        'FEATURE_SRI_PADA',
        'FEATURE_VREDEFORT_DOME',
        'FEATURE_WULINGYUAN',
        -- Sukritact's 4/4 Natural Wonders
        'FEATURE_SUK_GRANDCANYON',
        'FEATURE_SUK_GREATBLUEHOLE',
        'FEATURE_SUK_NGORONGORO_CRATER',
        'FEATURE_SUK_TONLESAP');
        -- Anything else?!

Opinions?
 
Last edited:
Okay.. last gasp of fresh decisions.
This is my final remark unless someone shares anything else that would lead to a proper SQL code.
====================
--GPCT section...
--NOTES
--LUA-Ref : [MomentDataTypes.MOMENT_DATA_GREAT_PERSON_INDIVIDUAL] = function(i) return GameInfo.GreatPersonIndividuals.GreatPersonIndividualType end,
--Option #1) Re-Use ChimpanG's .. [REPLACE INTO-SELECT-FROM-WHERE-IN] .. cyclic "Supporting TM" code
--Option #2) CASE(s) for GreatPersonClassType(i) Data linked to INDIVIDUALS
--Option #3) Declare every possible GP Textures (200+) straight into some [GREATPERSONINDIVIDUALS] new column instead of [GREATPERSONCLASSTYPE]

=====================
NFP packages get finalized next week with Portugal & i must integrate what i **DO** have in hand that actually works.
 
Last edited:
From what I can tell by trying to read the pertinent lua file that constructs the historical moments display it looks like the issue is not necessarily in the SQL code but in the data that is sent from the gamecore to the lua system via the Notifications related systems. There are several functions within the pertinent lua file that look to be receiving data from the gamecore that is specifically packaged based on the type of moment it is.

The pertinent lua file is one of the more brutal ones to figure out the "source" of the data being sent, but it appears for great people there is no data being sent to the instance "data" for anything more than the name of the great person recruited and their basic great person class. So the lua code does not "build" anything related to the historial moment "illustration" related to a specific great person. I could be wrong because as already mentioned it is a bit of a booger lua file to follow, but I think that is the root of the issue.

The natural wonders thing that Chimps global table insert works on works because the game is sending the specific needed instance "data" for the specific natural wonder discovered and is including the instance data needed to look up the specific illustration for that natural wonder. I think.

In essence, if my reading of the lua file is not in error, the game lua file and the data it is being sent by the gamecore is coded already to take into account the specific natural wonder or unique unit or governor or whatever, but not already coded to do anything more with specific great people than to pull the name of the specific great person individual and use the generic great person image.
 
Yup.. that is precisely what i've been concluding too for many months. Glad i'm not the only one reaching those conclusions
They build a custom string by snatching the GP names and toss the concatenated results straight into the SmallMoments HUD structure while scooping the GAME/PAST Eras status of GP activations to rephrase a duo of different contexts as shown by this snaphot;

SQLite_Snap1.png


My goal is then to find a direct way to parse within the DebugGameplay Table(s) and pick through the large assets (200+ names) while specifying which Class Group (1/9) is currently in effect.
It's the (valid) SQL necessary logic and instructions that escape me.. so far. Any probable LUA "fix" is far too limited for me.

Fairly sure the mystery stands in three specific terms... GreatPersonIndividuals (as a pre-defined Table) + GreatPersonIndividualType + GreatPersonClassType.
Followed by some relevant data push/pull tasks via inter-connectivity flow between two distinct Tables... MOMENTS (multi-columns with IconTexture being the key element) & the above GPI.

Thus, why i am hunting for help from fellow modders -- before i go completely insane for all the crazy attempts stacking into my burnt-out brain. :crazyeye:
 
Last Call!
Code:
--CHMZ(GPCT)_Validation
--LOAD:ORDER = 150+
--Inspired by previous Chimpan'G code for indirect "Terra Mirabilis" Texture swaps.

REPLACE INTO Moments ( IconTexture )
SELECT
'MOMENT_GREAT_PERSON_CREATED_GAME_ERA', -- (MomentType)
'MOMENT_DATA_GREAT_PERSON_INDIVIDUAL', -- (id Process)
GREATPERSONCLASSTYPE, --(gathered from active INDIVIDUAL-ID)
'CHMZ_MOMENTSMALL_GP_'|| ?? CLASSTYPE(name) ?? ||'.dds'

FROM    GREATPERSONINDIVIDUALS

WHERE   GREATPERSONCLASSTYPE

IN 
(
        -- GPCT "Class Name string insert(s)"
?? Which Table DATA exactly ?? );
        -- This LOGIC would simply fail! Anything else?!

That's all for me..
 
Top Bottom