1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Quick Modding Questions Thread

Discussion in 'Mod Creation Help' started by Leyrann, Oct 28, 2018.

  1. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,833
    Location:
    Illinois, USA
    You can swap back and forth between the game and for example an SQL fie and make edits to it, but none of these edits will be implemented within the game's database until you save and then reload that saved game. Game Data that is in the database is locked for the duration of that session of a game. You have to exit the game you are playing and at least return to the main menu and then reload before any alterations can be made to the game's database.

    Certain types of game data should never be altered once a game is started, however. You should not add for example a new unit to the game once you have started a game because this can cause desynch issues between the ID #'s assigned to the units in the database when the game was saved, and the new set of ID #'s and etcetera when the saved game is reloaded with an altered database. This sort of thing is also the root cause of why updates to mods can often make a saved game unrecoverable -- the process of updating the mod can cause a user's list of mods to load in a different order than when the game was first created, and now the assignments of row #s and Id #'s is different simply because the total set of mods currently being run load in a different order. The basic rule here is that you should never add or remove anything that must be registered within gametable <Types>, and you should never alter the order mods load when they are adding new elements or adjusting elements of the game that must be registered in table <Types>.

    Unfortunately Steam don't pay any attention whatever to this rule. Firaxis does not control how mod updates are handled for a user -- Steam does.

    Lua User Interface files and "context" XML files can be edited in realtime and the changes will be reflected in the correct UI panel or poop up. But this is not gameplay data, this is display code for the interface between the human user and the game.
     
    robal1991 likes this.
  2. pauljinyong

    pauljinyong Chieftain

    Joined:
    Jul 12, 2019
    Messages:
    7
    Gender:
    Male
    As these codes are not working, anyone has any idea to write a compensate code on traitmodifier or somewhere else to realize similar functions?
    Code:
    <Replace Name="CIVIC_COST_PERCENT_CHANGE_AFTER_GAME_ERA" Value="20" />
            
            <Replace Name="CIVIC_COST_PERCENT_CHANGE_BEFORE_GAME_ERA" Value="-20" />
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,225
    Location:
    France
    Any idea why this is happening ?

    On first setup, everything's fine
    Spoiler :
    upload_2020-4-16_10-3-35.png


    Launching a game, exit back to main menu then go to setup:
    Spoiler :
    upload_2020-4-16_10-9-11.png


    In game the player color is always white, but all other players use the correct colors.

    The test was made with or without Prismatic.
     

    Attached Files:

  4. ewindmill

    ewindmill Chieftain

    Joined:
    Apr 14, 2020
    Messages:
    9
    Gender:
    Male
    Is there an easy way to open other peoples mods that I've downloaded from the workshop? Because of Visual Studio's "solution" based projects, I can't just open a directory of code and change it, it seems. Do the solutions ship with the mods themselves?

    I'm just starting with modding, and right now I'm learning by editing mods locally. Unfortunately that means copy and pasting all files
     
  5. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,833
    Location:
    Illinois, USA
    The solutions are never uploaded to Steam Workshop. Nor when zipped and posted to a file sharing site like CFC's mod download section are the solutions included.

    Mods that are uploaded to Steam Workshop (or anywhere else) have a main folder for the mod, and within that folder there might or might not be sub-folders depending on the scope of the mod. But in the first and primary folder of the mod is a file called XXX.modinfo -- this is just a text only file organized as an XML file. It can be opened using any text editor, as can any of the xml, sql, or lua files contained within a mod. The modinfo file contains the instructions to the game as to what the game should do with the files contained within the mod. The modinfo file does not exist as a file within a Modbuddy project -- it is created by Modbuddy when the mod author uses the Modbuddy Project to create a usable mod (this process is referred to as "Build" of the mod in the Modbuddy menus).

    Other files such as dds files and the like often require a program like GIMP or Photoshop to open. But since these are image files they would need to be edited in an image editing application like GIMP or Photoshop (which is why you need something like one of these to open the file). Other Art/Animation files can really only be opened by the SDK Asset Previewer tool.

    But you can't take a mod you've downloaded (from whatever Site source), plop the mod folder into your Modbuddy folder in MyDocuments, and then open that mod as a Modbuddy Project in Modbuddy because there's nothing to open. There's no project file, no solution file, etc. This is because these only exist for the creator of a mod within their project on their computer. What is shared via Steam or other file-sharing methods is the "Built" version of the mod, which never contains any of the modbuddy project files or solution files because the version of the mod the game uses (the Built version) does not need them and they would just be extra clutter and download size bloating.
     
    Last edited: Apr 16, 2020
  6. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,225
    Location:
    France
    Ok.

    So...

    One XML file was not (re?)loading because of that :
    Code:
    [2286600.398] [ColorManager] ERROR: UNIQUE constraint failed: Colors.Type
    [2286600.398] [ColorManager]: While executing - 'insert into Colors('Type', 'Color') values (?, ?);'
    [2286600.398] [ColorManager]: In XMLSerializer while inserting row into table insert into Colors('Type', 'Color') with  values (COLOR_UNKNOWN, 255,255,255,255, ).
    [2286600.398] [ColorManager]: In XMLSerializer while updating table Colors from file [...]/Documents/My Games/Sid Meier's Civilization VI/Mods/YnAMP - Basic Modern Civilizations/Data/Colors.xml.
    but... Colors.xml was using only <Replace> tags, and no "COLOR_UNKNOWN" string in the file...

    :hmm:

    moved from xml to sql for that file, seems fine on return to main menu and in game now.
     
  7. Jeppetto

    Jeppetto Prince

    Joined:
    Dec 23, 2018
    Messages:
    337
    Gender:
    Male
    Cannot it be Jersey system doing some updates of its own or something? I don't quite understand this, but I know issues with it has been mentoined previously.
     
  8. robal1991

    robal1991 Chieftain

    Joined:
    May 2, 2011
    Messages:
    90
    Location:
    Poland
    Are LOC texts from R&F and GS also in the Cache/DebugLocalization.sqlite database? The file is the same size no matter if I run a game with standard rules, rise and fall or gathering storm. It's always 59.8MB.
    Thanks for help.
     
  9. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,833
    Location:
    Illinois, USA
    No, they are not added to it. Also from experimentation done by various people, UPDATE or REPLACE statements for LOC_KEYS added by RaF and GS don't implement properly. Generally it is necessary to redirect a "Name", "Description", etc. to an entirely new Tag and then add that new Tag to the Localization Database from your mod's <UpdateText> action.

    All the X.sqlite files in the "Cache" folder appear to be just copies of what the game interenally actually uses, and we do not have direct access to these. DebugConfiguration.sqlite and DebugGameplay.sqlite properly reflect anything added by the two expansions, but DebugLocalization.sqlite does not. From experimentation it appears that DebugLocalization.sqlite is re-generated after Vanilla and the DLC load but then is not "handled" anymore for Firaxis content so we get bupkiss for the stuff added by the two expansions. But everything added by community-made mods is reflected in DebugLocalization.sqlite so all these different "handling" methods are just a recipe to make all modders want to :gripe: and :wallbash: :badcomp: :wallbash:
     
  10. Zagaroth

    Zagaroth Chieftain

    Joined:
    Nov 27, 2009
    Messages:
    60
    That is exactly what you need to do if you want to modify someone else's mod, such as by tweaking a value or names etc. Personally, I use notepad++ if I'm going to do this (there are a few mods that are designed to be tweaked, such as Radiant's presets), rather than dealing with the overhead of running Modbuddy.

    If you want to seriously create a mod by modelling off of someone else's, create a new mod in Mod Buddy and copy/Paste into files there. Technically, I believe you can do it *all* via Notepad++ or something similar, but then you'd need to generate your own random string for mod ID and a whole lot of other tedious crap. Personally, I've taken to writing up new files in Notepad++ for my initial draft (keep it nice and big/visible), then when I'm satisfied with my setup, copy and paste into a file in ModBuddy.
     
  11. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,225
    Location:
    France
    Just a side note, we can alter the Configuration Database during setup and the changes are reflected on refresh (which occurs when you change a setting on screen or when they are initialized)

    (using SQL queries from a moddified AdvancedSetup.lua, not tried to edit the DebugConfiguration.sqlite directly with an editor, so I don't know if the changes are applied on a DB in memory or the debug file)
     
  12. DuskDancer

    DuskDancer Chieftain

    Joined:
    Jul 8, 2012
    Messages:
    29
    Hey y'all...hoping this is a quick question. I tried to build a mod with the following update statement:

    Code:
    UPDATE Units SET BuildCharges = 4 WHERE UnitType = 'UNIT_BUILDER';
    But when I go to load my game, builder build charges are still set at 3.

    DebugGameplay.sqlite indicates that nothing has changed:

    Code:
    sqlite3> select buildcharges from units where unittype='UNIT_BUILDER';
    3
    
    I set LoadOrder in the modinfo XML, and that appears to be working as Mods.sqlite shows it last in the list in the ModFiles table:

    Code:
    <LoadOrder>990</LoadOrder>
    Database.log shows no errors.

    Modding.log shows no obvious errors (at least none that were obvious to me).

    I'm just curious if anyone's run into this before and if I'm missing something stupid obvious. I'm old hat at Civ4 modding but I'm completely new to Civ6 and the structure's really thrown me for a loop.
     
  13. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,374
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    Your code is fine, however...
    Where'd you place the LoadOrder? It needs to be set for the UpdateDatabase Action rather than globally for the whole mod if that's what you've done.
     
  14. DuskDancer

    DuskDancer Chieftain

    Joined:
    Jul 8, 2012
    Messages:
    29
    I set it under the Mod -> Properties tags, so that's probably setting it globally for the mod.

    Wouldn't that have the same effect?

    Alternatively, what's the UpdateDatabase action? That's the first I've heard of it... >_>
     
  15. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,374
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    No, you used to be able to set a global LoadOrder and it would work, but it was changed in one of the patches. Now it needs be set for each individual InGameAction (e.g. Database, Text, Icons, Art, etc.).
    In your modinfo file - the LoadOrder properties need to be set under each subsection.

    Spoiler :
     
  16. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,833
    Location:
    Illinois, USA
    Yeah it seems that whenever anything at all is changed in any of the Pregame menus (like adding a mod to the list of enabled mods) the entire FrontEnd Database is recreated. This lua "change" to the database also appears as you've observed from changes in settings in the game setup screens as near as I can tell.

    The result for one thing is LoadOrder settings for FrontEnd Actions aren't very reliable.
     
  17. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,833
    Location:
    Illinois, USA
    Simply adding a file to a mod does not make the game do anything with the file.

    Given your message your root problem is almost certainly that you have never told the game what to do with your file(s) so it does nothing with them.

    See the chapter on creating a simple "New Building" mod in the Modding Guide linked in my signature. The chapter goes through the steps needed in modbuddy to activate the contents of a file in-game. The chapter also covers how to create the same simple mod if not using modbuddy.
     
  18. DuskDancer

    DuskDancer Chieftain

    Joined:
    Jul 8, 2012
    Messages:
    29
    Annnnnnnd this is precisely the sort of thing I expected - something simple and dumb that I missed.

    Thank you for the tutorial link, that's extremely helpful - and answered a lot of my questions. You guys rock.

    Now if only that had resolved my problem! :)
     
    Last edited: Apr 21, 2020
  19. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,833
    Location:
    Illinois, USA
    See the chapter on Dependancies, References, LoadOrders, and Blocks. Add a LoadOrder value of at least 300 to your InGame UpdateDatabase action and see if that does not cure the issue.

    If not, start a new thread so that a more-detailed help discussion can be made and upload your mod as a zipped archive attached to your OP.

    Boiler Plate Instructions:
    1. Zip the version of the mod the game is actually trying to use, which will be found as a sub-folder in ~\Documents\My Games\Sid Meier's Civilization VI\Mods. Zip the whole sub-folder for your mod.
      • Do not (unless specifically asked by someone trying to help diagnose your problem) zip the modbuddy project folder
        Spoiler why not :
        1. This is useless in most cases and requires us to dump it into our modbuddy folder and then start modbuddy and then attempt to analyse what you are doing wrong.
        2. If we cannot spot the issue we then have to create the built and usable version of the mod on our end, which is what we really needed in the 1st place.
        3. And in all this process we have to hope that we are not wasting our time in the event the modbuddy project does not contain the same code as the built version of the mod that is non-functional
        4. People completely corrupt via fix-attempts the built version of the mod in the game's MODS folder and then package and send the modbuddy solution all the time. This results in what we see being different from what the novice mod-maker is seeing in-game.
    2. To attach the zip to a forum post, look for a button called Upload A File when composing your thread reply: this button opens a browse menu where you can select the zipped folder to attach directly to a forum post.
    3. If the zipped folder is too large for the forum to accept then upload the zipped mod to a file-sharing site such as dropbox and provide a link where the mod can be downloaded.
      • Mediafire is not really a very good choice any more because they have become rife with spam and malware, as well as attempts to get you to download unwanted and uneeded kludge by confusing the layout of the download pages. You'll note for example that Mediafire links are no longer allowed on Steam, whereas CFC (this site) and dropbox links are still allowed.
     
  20. DuskDancer

    DuskDancer Chieftain

    Joined:
    Jul 8, 2012
    Messages:
    29
    You're gonna laugh...once I added in the UpdateDatabase action and started and it wasn't working, I was so frustrated that I almost gave up entirely. But for kicks I opened Database.log and at that moment saw that another mod had an error - and nothing loaded after that.

    So once I fixed that error everything worked like a charm. :)
     

Share This Page