Quick Modding Questions Thread

@Zyxpsilon : not sure what your exact question is, but below two code snippets so that you may ask from looking at them (both from EDR):

Header of EDR lua file, checks for DLCs:
Code:
-- ===========================================================================
-- Base File to be extended
-- ===========================================================================
include("DiplomacyRibbon");

-- ===========================================================================
-- Cached Base Functions
-- ===========================================================================
BASE_AddLeader = AddLeader;

-- ===========================================================================
-- Rise & Fall check
-- ===========================================================================
local m_isRiseAndFall:boolean = Modding.IsModActive("1B28771A-C749-434B-9053-D1380C553DE9"); -- Rise & Fall Expansion check
local m_isGatheringStorm:boolean = Modding.IsModActive("4873eb62-8ccc-4574-b784-dda455e74e68"); -- Gathering Storm Expansion check


Entire modinfo file, acts according to which game started:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="382a187f-c8ba-4094-a6a7-0d5315661f32" version="1">
  <Properties>
    <Name>Extended Diplomacy Ribbon</Name>
    <Stability>Final</Stability>
    <Teaser>A better diplomacy ribbon with extended information.</Teaser>
    <Description>This mod extends the Diplomacy Ribbon to display all the relevant diplomatic information in one place. All the information displayed is available in-game in vanilla Civ6, but in different places of the UI and not readily at hand. EDR combines all that information into a simple, readable and always present combination of tooltips, mouse overs and clicks. An essential mod for every serious diplomat.</Description>
    <Authors>Aristos</Authors>
    <AffectsSavedGames>0</AffectsSavedGames>
    <CompatibleVersions>2.0</CompatibleVersions>
  </Properties>
 
  <ActionCriteria>
        <Criteria id="Vanilla">
            <RuleSetInUse>RULESET_STANDARD</RuleSetInUse>
        </Criteria>
        <Criteria id="Expansion1">
            <GameCoreInUse>Expansion1</GameCoreInUse>
        </Criteria>
        <Criteria id="Expansion2">
            <GameCoreInUse>Expansion2</GameCoreInUse>
        </Criteria>
       
  </ActionCriteria>

  <InGameActions>
   
    <ImportFiles id="EDR_IMPORT_FILES">
      <Properties>
        <LoadOrder>13000</LoadOrder>
      </Properties>
      <Items>
        <File>EDR_DiplomacyRibbon_Expansion2.lua</File>
        <File>ExtendedDiplomacyRibbon.lua</File>
        <File>leadericon.xml</File>
      </Items>
    </ImportFiles>
    <ReplaceUIScript id="ExtendedDiplomacyRibbon_Vanilla" criteria="Vanilla">
        <Properties>
            <LoadOrder>13001</LoadOrder>
            <LuaContext>DiplomacyRibbon</LuaContext>
            <LuaReplace>ExtendedDiplomacyRibbon.lua</LuaReplace>
        </Properties>
    </ReplaceUIScript>
    <ReplaceUIScript id="ExtendedDiplomacyRibbon_RaF" criteria="Expansion1">
        <Properties>
            <LoadOrder>13001</LoadOrder>
            <LuaContext>DiplomacyRibbon</LuaContext>
            <LuaReplace>ExtendedDiplomacyRibbon.lua</LuaReplace>
        </Properties>
    </ReplaceUIScript>
    <ReplaceUIScript id="ExtendedDiplomacyRibbon_GS" criteria="Expansion2">
        <Properties>
            <LoadOrder>13001</LoadOrder>
            <LuaContext>DiplomacyRibbon</LuaContext>
            <LuaReplace>EDR_DiplomacyRibbon_Expansion2.lua</LuaReplace>
        </Properties>
    </ReplaceUIScript>
  </InGameActions>

  <Files>
    <File>EDR_DiplomacyRibbon_Expansion2.lua</File>
    <File>ExtendedDiplomacyRibbon.lua</File>
    <File>leadericon.xml</File>
  </Files>
</Mod>
 
@Aristos .. Yep.. i had already scanned through these files and couldn't detect any hints on WHY there's no "obvious" instruction which clearly states we'll still have any Steam Achievements trigger as they should -- so, maybe there is a specific hidden principle inside native code that does the trick. Except we don't get any onscreen-feedback proof about/of what we activate via the usual Additional Content options (enable/disable). I knew these two GS/RF boolean checks (with active ID-Tag references) are fine though as long as their red "NOT COMPATIBLE" strings can toggle on/off as intended.

That's what i meant... between showing us "Not Compatible" or/and "Blocks Achievements" (for each Mods we have on the list) -- there's a wacky difference. We can always verify instinctively that something that alters the ruleset or core mechanics would block the process.. Civ6 simply doesn't give any clear indications which i think it should.
 
@Aristos .. Yep.. i had already scanned through these files and couldn't detect any hints on WHY there's no "obvious" instruction which clearly states we'll still have any Steam Achievements trigger as they should -- so, maybe there is a specific hidden principle inside native code that does the trick. Except we don't get any onscreen-feedback proof about/of what we activate via the usual Additional Content options (enable/disable). I knew these two GS/RF boolean checks (with active ID-Tag references) are fine though as long as their red "NOT COMPATIBLE" strings can toggle on/off as intended.

That's what i meant... between showing us "Not Compatible" or/and "Blocks Achievements" (for each Mods we have on the list) -- there's a wacky difference. We can always verify instinctively that something that alters the ruleset or core mechanics would block the process.. Civ6 simply doesn't give any clear indications which i think it should.

As far as I know, nothing blocks achievements in civ 6... did that change?
 
Alright then.. maybe i'm just confusing C6 with other recent games like GC3 or even XCom2+WotC+TLE - silly me! Blame this week switch towards a fresh stormy gameplay gathering up in my old sluggish mind. :mischief:
Sooooo -- i'm sorry for bothering you with this .. but i've still got my work cut-off to re-integrate a custom version of Sco_R_ow. From what i've seen they simply swapped folders into a "DLC/.../Replacements" sub for various LUA/XML contexts while throwing in some wicked adjustments related to GS features.
 
With another expansion, I am again confused by the whole load order thing, and cannot get the new version of my mod to work. This is so frustrating!
So I am counting again on you to help me. Here is a zip file with my mod - it contains two mods, the original one, which works, and the new one, which doesn't, and must depend on the Gathering Storm expansion pack and the original version of the mod.
What am I doing wrong?
 

Attachments

  • NeedHelp.zip
    18.2 KB · Views: 244
Code:
  <InGameActions>
    <UpdateDatabase id="DatabaseUpdate">
      <Properties>
        <LoadOrder>500</LoadOrder>
      </Properties>
      <File>Database GS.xml</File>
    </UpdateDatabase>
    <UpdateText id="CityListTextUpdate">
      <Properties>
        <LoadOrder>500</LoadOrder>
      </Properties>
      <File priority="-1">City Lists GS.xml</File>
      <File priority="-1">Names.xml</File>
    </UpdateText>
  </InGameActions>
Ought to do it because I don't think GS has any LoadOrder numbers that high. But you have two files within the same action with the same "priority" setting.

Use "Custom Properties" in an Action. Add a Custom Property. When the pop-up occurs use literally the text LoadOrder for the "Name" field and the number you want for the "Vaue" field.
 
Code:
  <InGameActions>
    <UpdateDatabase id="DatabaseUpdate">
      <Properties>
        <LoadOrder>500</LoadOrder>
      </Properties>
      <File>Database GS.xml</File>
    </UpdateDatabase>
    <UpdateText id="CityListTextUpdate">
      <Properties>
        <LoadOrder>500</LoadOrder>
      </Properties>
      <File priority="-1">City Lists GS.xml</File>
      <File priority="-1">Names.xml</File>
    </UpdateText>
  </InGameActions>
Ought to do it because I don't think GS has any LoadOrder numbers that high. But you have two files within the same action with the same "priority" setting.

Use "Custom Properties" in an Action. Add a Custom Property. When the pop-up occurs use literally the text LoadOrder for the "Name" field and the number you want for the "Vaue" field.
Thank you very much. It works.
I guess I'll never understand this load order thing.
 
Thank you very much. It works.
I guess I'll never understand this load order thing.
I think you may be over complicating it. A higher number will load after lower number. I use a high number like 500 or 600 in my mods to ensure it always loads last.
 
Code:
<Row>
            <ModifierId>PETRA_YIELD_MODIFIER</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_FOOD,YIELD_GOLD,YIELD_PRODUCTION</Value>
        </Row>
        <Row>
            <ModifierId>PETRA_YIELD_MODIFIER</ModifierId>
            <Name>Amount</Name>
            <Value>2,2,1</Value>

How do you replicate this with INSERT INTO in SQL? For context, I'm trying to give every player city Petra and Ruhr Valley's buff after they've built it. I tried all the obvious methods but none of them work and they even make the original effects malfunction.
 
Well, first your problem is this
Code:
<Value>YIELD_FOOD,YIELD_GOLD,YIELD_PRODUCTION</Value>

<Value>2,2,1</Value>
You can't give more than one Value within one row.

Code:
INSERT INTO ModifierArguments (ModifierId, Name, Value)
VALUES	('PETRA_YIELD_MODIFIER_FOOD', 'YieldType', 'YIELD_FOOD'),
('PETRA_YIELD_MODIFIER_FOOD', 'Amount', 	2);
 
I snipped that above code from line 1434 to line 1444 of Bulidings.xml of the base game. I assume I should use MODIFIER_PLAYER_ADJUST_PLOT_YIELD for ModifierType?
 
I'm use to nodding Civ by just making back ups of XML files, and then directly editing the XML files. How does one make XML edits a "proper" mod (I.e one that goes in the mods folder, and shows up in-game to enable/disable)?
 
Hi, I'm trying to update my mods for the new expansion, I added the "Players:Expansion2_Players" thing to the config file, and I added "<CompatibleVersions>2.0</CompatibleVersions>" to Properties in the .modinfo file. I thought this was all I needed, but my leader doesn't show up in the leader selection for some reason. It does appear when selecting "Standard Rules" or "Expansion: Rise and Fall", but when selecting "Expansion: Gathering Storm" it isn't there. Does someone know what I am missing? Thanks.
 

Thanks, but this resource seems to focus on creating new content (e.g new civs), but I'm just looking to edit existing stuff (like how many of which slots a government has). I know how to do this, by directly editing files, but I'm not sure how to make it a mod. Do I just copy the files, edit the copies, put them in a folder, and put that folder in the mods folder? I assume there's more to it than that.
 
Thanks, but this resource seems to focus on creating new content (e.g new civs), but I'm just looking to edit existing stuff (like how many of which slots a government has). I know how to do this, by directly editing files, but I'm not sure how to make it a mod. Do I just copy the files, edit the copies, put them in a folder, and put that folder in the mods folder? I assume there's more to it than that.

You can use parts of that tutorial. Anyway, answering your question, you copy all you want to your files and then build a modinfo which connects all your files to work as a mod, then copy to a folder in mods. The above tutorial explains how you go to core files to copy and also how to build a modinfo and how to put in mod folder.
 
I'm starting my civ6 modding journey and am slowly putting together the pieces that form the rather sparsely documented civ6 API. Two quick LUA questions.

1 ) How do I get the current turn number other than just starting at 1 and incrementing every time a new turn starts?

2 ) What is the best (or any) way for my mod to store data between saving and loading? My mod needs to keep track of a given block of dynamic data troughout the game (say for example keeping a log of culture per turn for a spefic player over the course of the game). It's trivial to do so while the game is running, but is there any way of storing data in the game savefile or keep hold of it when the game is closed?
 
Did you scroll down right? (I had this problem the first time...) since with the expansions, last released leaders appear first, and not in alphabetical order.
Yes I did, it's not there. Thanks for the reply though.
 
Top Bottom