Quick Modding Questions Thread

Hi,
tried the "ReplaceUIScript"-functioniality, got an error and being a bit clueless, tried several combinations, somebody has an idea?
This is a game with XP2 enabled.

Error
Code:
 TutorialUIRoot: Tutorial: Firaxis in game tutorial prompts.
 TutorialUIRoot: Version: 1
 TutorialUIRoot: Loading bank of items for tutorial scenario: 'BASE'
 LoadScreen: OnLoadGameViewStateDone
 Runtime Error: C stack overflow: too many (128) nested C function calls.

stack traceback:
    [C]: in function 'lInclude'
    C:\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\UI\Replacements\DiplomacyActionView_Expansion2.lua:6: in function '(main chunk)'
    [C]: in function 'lInclude'
    C:\Users\fampa\Documents\My Games\Sid Meier's Civilization VI\Mods\GiftItToMe\Base\Assets\UI\Replacements\DiplomacyActionView.lua:1: in function '(main chunk)'
    [C]: in function 'lInclude'
    C:\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\UI\Replacements\DiplomacyActionView_Expansion1.lua:6: in function '(main chunk)'
    [C]: in function 'lInclude'
    C:\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\UI\Replacements\DiplomacyActionView_Expansion2.lua:6: in function '(main chunk)'
    [C]: in function 'lInclude'
    C:\Users\fampa\Documents\My Games\Sid Meier's Civilization VI\Mods\GiftItToMe\Base\Assets\UI\Replacements\DiplomacyActionView.lua:1: in function '(main chunk)'
Lua callstack:

@C:\Users\fampa\Documents\My Games\Sid Meier's Civilization VI\Mods\GiftItToMe\Base\Assets\UI\Replacements\DiplomacyActionView.lua:1
@C:\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\UI\Replacements\DiplomacyActionView_Expansion1.lua:6
@C:\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\UI\Replacements\DiplomacyActionView_Expansion2.lua:6
@C:\Users\fampa\Documents\My Games\Sid Meier's Civilization VI\Mods\GiftItToMe\Base\Assets\UI\Replacements\DiplomacyActionView.lua:1
@C:\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\UI\Replacements\DiplomacyActionView_Expansion1.lua:6

Modinfo
Code:
    <ReplaceUIScript id="GiftItToMe_UI_Replacements">
        <Properties>
            <LuaContext>DiplomacyActionView</LuaContext>
            <LuaReplace>Base/Assets/UI/Replacements/DiplomacyActionView.lua</LuaReplace>
        </Properties>
    </ReplaceUIScript>
    <ImportFiles id="GiftItToMe_ImportFiles_All">
        <Properties>
            <LoadOrder>12</LoadOrder>
        </Properties>
        <File>Base/Assets/UI/Replacements/DiplomacyActionView.lua</File>
    </ImportFiles>
    <Files>
      <File>Base/Assets/UI/Replacements/DiplomacyActionView.lua</File>
   </Files>

Base/Assets/UI/Replacements/DiplomacyActionView.lua
Code:
include("DiplomacyActionView_Expansion2");

-- nothing more yet
-- also tried DiplomacyActionView_Expansion2.lua or DiplomacyActionView
-- similar results :(
 
Last edited:
@Fampat You have a circular reference because you actually overwritten original DiplomacyActionView.lua. Your files must have a different, unique name, like DiplomacyActionView_fampa.lua. Now your DAV.lua is calling DAV_xp2, which calls DAV_xp1, which calls DAV.lua, which is your file, and you get an error.
 
Sorry to bump this message, but I really hope someone can answer this :)

How do I replace a file in : "\Sid Meier's Civilization VI\DLC\Expansion2\Maps\Utility"? Specifically I want to replace the "CoastalLowlands.lua" file.

I have seen that YNAMP has replaced the "AssignStartingPlots.lua" file and tried to nose around in the .modinfo and do the same thing, but I cant get it to work. When I start up a new game it's effects is not active and the mod is not shown in the Esc menu, but it is enabled in the Additional Content in the main menu. I have tested the actual code by directly modifying the file in my game install folder so I know that part works.
 
So far as I'm aware InGameActons -> ImportFiles still works. It's the method I use to replace the ProductionPanel.lua file.
Code:
  <InGameActions>
    <ImportFiles id="LUA_Replacers">
      <Properties>
        <LoadOrder>150000</LoadOrder>
      </Properties>
      <File>LUA/Replacers/ProductionPanel.lua</File>
    </ImportFiles>
  </InGameActions>
The customized version of ProductionPanel.lua within my mod replaces the base-game one. Because I have a very high load order value it will also tend to replace any other version added by other mods.
 
Hi, so if I make a new custom civ and give it a Civilization Trait that allows it to build Chateaus (TRAIT_CIVILIZATION_IMPROVEMENT_CHATEAU), Missions (TRAIT_CIVILIZATION_IMPROVEMENT_MISSION), etc. (all civilization-specific improvements from the base game), everything works great. However, I've noticed that when I do the same thing with Golf Courses (TRAIT_CIVILIZATION_IMPROVEMENT_GOLF_COURSE), Polders (TRAIT_CIVILIZATION_IMPROVEMENT_POLDER), etc (basically any civ-specific improvement from the DLC or expansions) gameplay-wise everything works, but the art is missing in-game and is replaced with a red exclamation mark. Does anyone know what's going on here? I have all expansions and DLCs, and they're definitely all activated. The improvements look normal when I build them with their native civs.
 
Last edited:
Thanks for the help @Infixo. It appear to be caused by the XML file not being used in the update database action. Seemed weird. It so happened that the XML had some compiling errors, so I don't know if that was somehow blocking the rest of the mod but without the usual prompt because it was not technical used? Anyway, fixing the XML file and re-adding the UpdateDatabase call made it work. So thank you :)
 
Is there a simple way to give gurus the ability to initate reglious combat? I can't see anything in the database about apostles that lets them do this.
 
Code:
local iPlayerHandicap = PlayerConfigurations[iPlayer]:GetHandicapTypeID()
print("iPlayerHandicap is " .. iPlayerHandicap .. " which translates to " .. GameInfo.Difficulties[iPlayerHandicap].DifficultyType .. " (" .. Locale.Lookup(GameInfo.Difficulties[iPlayerHandicap].Name) .. ")")
You'll want to be sure that iPlayer is referencing to the/a human player when executing the code.
 
@Fampat I am not aware of such a mechanism, except the case for GameCoreInUse and LeadersPlayable. The first one allows for expansion detection, the latter allows to run various parts of the mod depending on enabled leaders (so, DLCs, custom civs, etc.)
 
Hi!
somebody knows if it might be possible to set/check criteria in .modinfo for other mods (like how its possible to set/check criteria for basegame, xp1 and xp2 at the moment)?

The intention is to skip loading/overwriting files with my mod if specific other mods are installed /used.


Thanks!
The .exe seems to have checks for RuleSetInUse, LeaderPlayable, MapInUse, ModInUse, GameCoreInUse and GameModeInUse.

Not sure how to set something with those that are not already referenced in Firaxis .modinfo, but my first guess would be the modID.
 
Quick question. How would I write the SQL modifiers for a pantheon that gives 100 faith upon capturing a city?

Here's what I have and it's not working. I used the Goody Hut modifiers.

Code:
INSERT INTO Types (Type, Kind) VALUES
                  ('OP_MODIFIER_CAPTURED_CITIES_YIELD', 'KIND_MODIFIER') ;
INSERT INTO DynamicModifiers (ModifierType, CollectionType, EffectType) VALUES
                             ('OP_MODIFIER_CAPTURED_CITIES_YIELD', 'COLLECTION_ALL_CAPTURED_CITIES', 'EFFECT_GRANT_YIELD') ;

INSERT INTO BeliefModifiers (BeliefType, ModifierID) VALUES
                            ('OP_ARES', 'OP_ARES_FAITH_FROM_CONQUER') ;
INSERT INTO Modifiers (ModifierId, ModifierType, SubjectRequirementSetId, RunOnce, Permanent) VALUES
                      ('OP_ARES_FAITH_FROM_CONQUER', 'OP_MODIFIER_CAPTURED_CITIES_YIELD', 'CITY_FOLLOWS_PANTHEON_REQUIREMENTS', 1, 1) ;
INSERT INTO ModifierArguments (ModifierId, Name, Value) VALUES
                              ('OP_ARES_FAITH_FROM_CONQUER', 'Amount', 100),
                              ('OP_ARES_FAITH_FROM_CONQUER', 'Scale', 1),
                              ('OP_ARES_FAITH_FROM_CONQUER', 'YieldType', 'YIELD_FAITH') ;

Thanks!

Kind regards,
DB
 
Last edited:
I would think 'CITY_FOLLOWS_PANTHEON_REQUIREMENTS' would require the captured city follows the 'OP_ARES' pantheon

This is probably a detailed enough question you'd likely have better luck asking it as a help request thread
 
When I get an error like "Syntax error near ;", whom should I be gnashing my teeth at for the complete lack of help the message provides? Put another way, who has the power to make error messages include n characters either side of the offending article in order to make bug fixing much less work?
 
Top Bottom