1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

CIv6 ModInfo Schema

Discussion in 'Civ6 - Modding Tutorials & Reference' started by PlotinusRedux, Dec 5, 2016.

  1. PlotinusRedux

    PlotinusRedux Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    196
    Something I just wasted an hour discovering:

    If the optional "id" attribute is used for a component, it must start with a letter and contain no spaces or special characters, as it is sent directly to sqlite to create a save point.
     
  2. General Tso

    General Tso Panzer General

    Joined:
    Oct 12, 2007
    Messages:
    1,525
    Location:
    U. S. of A.
    Thank you for posting this information. It's been real helpful.
     
  3. Random Dude

    Random Dude Chieftain

    Joined:
    Feb 20, 2017
    Messages:
    5
    A useful thingy I found that's not mentioned in the OP:

    Code:
    <Properties>
    	<AffectsSavedGames>0</AffectsSavedGames>
    </Properties>
    I added this to all installed mods - of course it's a bad idea to add this to mods that add new units etc., but I don't use any of these, only UI, AI and map generation ones - so it became possible to switch mods on and off on a game in progress without the game complaining.
     
    Merri likes this.
  4. Fuyu

    Fuyu Chieftain

    Joined:
    Nov 5, 2009
    Messages:
    1,220
    Location:
    Austria
    I take a break from this game a bit and now the modinfo structure seems completely different, with ActionCriteria (wth that might be), InGameActions etc.
    Is that new schema explained somewhere?
     
  5. Caleb Caraway

    Caleb Caraway Chieftain

    Joined:
    Jul 28, 2017
    Messages:
    1
    It appears that the Summer '17 update broke dependencies. I say "appears", because they were working yesterday and today they're completely ignored. This is the best place I've found for info on the modinfo structure.
     
  6. skodkim

    skodkim Chieftain

    Joined:
    Jan 16, 2004
    Messages:
    2,150
    Location:
    Denmark
    Yes, Id really like to gear about this too. I have a personal mod that alters the Apadana slightly and I need to how how to do "dependencies" now. Included my modinfo file.

    \Skodkim
     

    Attached Files:

  7. Merri

    Merri Chieftain

    Joined:
    Aug 18, 2007
    Messages:
    226
    It seems to me that the new way of managing dependencies is via ActionCriterias combined with LoadOrder. Using both you can create a mod that works with both vanilla game and Rise & Fall, or any other DLC.

    Here is what I use with Finnish language pack:

    HTML:
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="8ED00BF3-99F6-4360-81BF-709791A90FBF" version="5">
       <Properties>
           <Name>LOC_MOD_TITLE</Name>
           <Teaser>LOC_MOD_TEASER</Teaser>
           <Description>LOC_MOD_DESCRIPTION</Description>
           <Authors>LOC_MOD_AUTHORS</Authors>
           <EnabledByDefault>1</EnabledByDefault>
           <AffectsSavedGames>0</AffectsSavedGames>
       </Properties>
       <!-- enable detection of Rise & Fall expansion by a criteria -->
       <ActionCriteria>
           <Criteria id="Expansion1">
               <GameCoreInUse>Expansion1</GameCoreInUse>
           </Criteria>
       </ActionCriteria>
       <!-- these are loaded before displaying the main menu, but not before the initial "Loading game, please wait" -->
       <FrontEndActions>
           <!-- Vanilla -->
           <UpdateText id="FrontendTextFinnish">
               <Properties>
                   <LoadOrder>10</LoadOrder>
               </Properties>
               <!-- <File /> ... -->
           </UpdateText>
           <!-- Rise & Fall -->
           <UpdateText id="Expansion1TextFinnish" criteria="Expansion1">
               <Properties>
                   <LoadOrder>20</LoadOrder>
               </Properties>
               <!-- <File /> ... -->
           </UpdateText>
       </FrontEndActions>
       <!-- these are loaded when starting to play a game -->
       <InGameActions>
           <!-- Vanilla -->
           <UpdateText id="TextFinnish">
               <Properties>
                   <LoadOrder>10</LoadOrder>
               </Properties>
               <!-- <File /> ... -->
           </UpdateText>
           <!-- Rise & Fall -->
           <UpdateText id="Expansion1TextFinnish" criteria="Expansion1">
               <Properties>
                   <LoadOrder>20</LoadOrder>
               </Properties>
               <!-- <File /> ... -->
           </UpdateText>
       </InGameActions>
       <LocalizedText>
           <Text id="LOC_MOD_TITLE">
               <en_US>Civilization VI suomeksi</en_US>
           </Text>
           <Text id="LOC_MOD_TEASER">
               <en_US>Finnish Language Pack</en_US>
           </Text>
           <Text id="LOC_MOD_DESCRIPTION">
               <en_US>This language pack providers the glorious Finnish language to the game.</en_US>
           </Text>
           <Text id="LOC_MOD_AUTHORS">
               <en_US>Vesa Piittinen</en_US>
           </Text>
       </LocalizedText>
       <Files>
           <!-- <File /> ... -->
       </Files>
    </Mod>
    
    With LoadOrder I ended up with values 10 and 20: both texts are loaded after all other texts. Using negative LoadOrder can cause game not to begin when a lot of DLCs.

    Then, with Expansion1 criteria I can tell to only load Rise & Fall text if there is Rise & Fall available in the game. This works perfectly: the game loads the correct strings in both cases :) For DLCs it is easy enough to clone these criterias; for other mods, well, I don't know: I'm outside the regular modding ring of people so there are probably conventions that I do not know of. Anyway, I think the criteria system is far superior to the old dependencies system since you can actually have conditional loading of files.

    Note that Rise & Fall uses a LoadOrder of -100, but it is not related to LocalizationDatabase.

    There doesn't seem to be a lot of interest for localizations, but I'll add some additional info below for those who are interested in that.

    I had to use FrontEndActions to load new strings for main menu, while InGameActions are executed as soon as you start to load a game. It seems the game reloads localizations in both of these cases so when doing a language pack as a mod you have to do both as well. Also, since a mod does not allow to add an actual new language you have to replace English. This is not possible possibly because LocalizationDatabase tables are locked except for LocalizedText once the game is initialized (before any mods are applied). You can add a new language via Civ 6 user Text directory, but that defeats the purpose of easiness with Steam Workshop as you'd force users to locate a specific directory, add a new directory and download a file there from elsewhere. This sucks.

    Final notes: I use EnabledByDefault as I find it just silly if a language pack is not enabled automatically. Also, AffectsSavedGames is a great feature for language packs :)
     
    Last edited: Feb 27, 2018
  8. Laurana Kanan

    Laurana Kanan Queen's

    Joined:
    Apr 10, 2014
    Messages:
    989
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    Isn't it -100, not +100?
     
    Merri likes this.
  9. Merri

    Merri Chieftain

    Joined:
    Aug 18, 2007
    Messages:
    226
    Could be, I didn't double check that one when I added LoadOrder to fix a bug :) I'll update the post (and my mod) once I check it. Partially incorrect LoadOrder didn't happen to break things with the language pack as I'm running just a lot of <Replace /> and not things like <Row />.

    Edit!
    And that is done, thanks for pointing it out. It actually has no relation to LocalizationDatabase at all, so proper values to use appear to be -10 (to load before any R&F texts) and 10 (to load after R&F texts). I'm not sure if Priority attributes have any meaning between mods/DLCs, and if you can use negative Priority values. Those might be the other way to control localization order. Maybe I end up testing that sometime if I ever throw an attempt to change from <Replace /> to <Row /> (in an attempt to make the language pack work better as both a mod and alternatively as a bunch of files in Text folder, since you can actually add a real new language via user Text folder).

    Rise & Fall runs a couple of <Delete />s which is why LoadOrder matters a bit if using <Row /> to add stuff. <Row /> throws if trying to add a duplicate Tag.
     
    Last edited: Feb 25, 2018
  10. Seven05

    Seven05 Warmonger

    Joined:
    Dec 5, 2005
    Messages:
    2,016
    Gender:
    Male
    Location:
    USA
    Has anybody figured out how to get this to work with Rise & Fall?

    Code:
        <AddMap id="DWContinents">
          <Properties>
            <Name>Continents - Detailed</Name>
            <Description>Continental maps with a few larger continents and generally two distict areas divided by oceans</Description>
            <Group>StandardMaps</Group>
          </Properties>
          <File>Maps/DWContinents.lua</File>
        </AddMap>
    
    The nice thing about using Addmap in the modinfo is that you don't need to modify the maps.xml file and you can force the map to work without needing the extra XML file. I just can't get it to appear in the Rise & Fall ruleset without going back to the old XML config file method. I've tried everything I could think of for <Group> - StandardMaps matches the xml file name in the base game, changing it to Expansion1_StandardMaps (and many variations of that) doesn't work, nor does using <Domain> instead of <Group>.

    Hopefully I'm just missing something simple :)
     
  11. Merri

    Merri Chieftain

    Joined:
    Aug 18, 2007
    Messages:
    226
    Here are a few guesses since I've only done localization stuff and nothing else:
    • <AddMap /> needs to be in <FrontEndActions /> (although Viking scenario seem to work with the older <Settings /> tag with files within <Items />)
    • <Group /> might be Expansion1Maps (this based on Expansion1_EarthMaps.xml)
    • You may need to copy <ActionCriteria /> to modinfo and have <AddMap criteria="Expansion1" ...> if the map targets Rise & Fall specifically (but this may make the map only work with R&F)
    There is probably a trick to make map work with both Vanilla and R&F but maybe try to get something working first before figuring that one out :)
     
  12. Seven05

    Seven05 Warmonger

    Joined:
    Dec 5, 2005
    Messages:
    2,016
    Gender:
    Male
    Location:
    USA
    I have my mod working, I just had to resort to the "old" way of having the settings xml file so the game would let you select the map, I just saw a new way and wanted to use it :)

    I tried all sorts of variations on the "Expansion1Maps" based on what I could find in the other xml and lua files without luck. I am able to control map visibility using the <AddMap> blocks for the standard ruleset and scenarios without any issues, just can't seem to figure out what R&F is expecting.
     
  13. Tiramisu

    Tiramisu Chieftain

    Joined:
    Aug 16, 2013
    Messages:
    127
    Location:
    Leonberg (BW, Germany)
    Your example is great, but it lacks FrontEndActions. My problem is that I have found no way to include FrontEnd-XMLs and UI-context Lua-scripts in one modinfo file.

    Edit: Ok, sorry! The solution is simply using <FrontEndActions> outside of <Components>. So your modinfo file can look something like this:
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="4b05c20e-b4ef-4080-92a2-c7973a7d5000" version="1">
      <Properties>
        <Name>Tiras [COLOR_FLOAT_CULTURE]Test[ENDCOLOR] Script</Name>
        <Description>For test purposes only!!!</Description>
        <Teaser>For test purposes only!!!</Teaser>
        <Authors>Tiramisu</Authors>
      </Properties>
        <Settings />
        <FrontEndActions>
        <UpdateDatabase id="ModdedMapSettings">
           <Properties>
                <LoadOrder>100</LoadOrder>
           </Properties>
           <Items>
                <File>MapSizes.sql</File>
           </Items>  
        </UpdateDatabase>
      </FrontEndActions>
        <Components>            
            <AddGameplayScripts id="TirasTestScript">
              <File>TirasTestScript.lua</File>  
              <File>TirasEnhancedAStar.lua</File>  
            </AddGameplayScripts>
            <ImportFiles id="Import">
              <File>TutorialScenarioBase.lua</File>
            </ImportFiles>
            <UserInterface id="TirasUIFunctions">
              <Properties>
                <Context>InGame</Context>
              </Properties>
              <Items>
                <File>TirasUIFunctions.xml</File>
              </Items>
            </UserInterface>
        </Components>
      <Files>
        <File>TirasTestScript.lua</File>
        <File>TirasEnhancedAStar.lua</File>
        <File>TutorialScenarioBase.lua</File>
        <File>TirasUIFunctions.xml</File>
        <File>TirasUIFunctions.lua</File>
        <File>MapSizes.sql</File>
      </Files>
    </Mod>

    The only problem you get is when you are trying to use <Components> and <InGameActions> environments in the same modinfo file. In this case the files in the <InGameActions> environment would be not loaded correctly and you would get the
    Code:
    ERROR: Attempted to evaluate a path for a mod that doesn't actually contain that path.
    error.
     
    Last edited: Jul 4, 2018

Share This Page

Ebates: Get Paid to Shop