Disabling The Custom Game Difficulty Switch


RolandJ

Recommended Posts

Hello,

I am seeking help to disable the auto-switch to "custom difficulty" while selecting campaign options. I enjoy using mods for various game play enhancements and I find it genuinely upsetting to not be able to even change the options of my mods, like guard overhaul or starting agents - not the core difficulty options (like credits multiplier, guard count, daemon quantity, starting power, KO duration, etc), without being unceremoniously demoted to "custom" difficulty and so I am trying to work around the auto difficulty-switch mechanic.

So far I've found a few promising functions in scripts.zip/client/states/state-generation-options.lua.

local function onChangedOption( self, setting, widget )
    if not self.updatingDifficulty then
        -- If current difficulty is not CUSTOM, and an option was change to the non-default value...
        -- automatically switch to CUSTOM DIFFICULTY.
        --self:selectDifficulty( simdefs.CUSTOM_DIFFICULTY )
    end

    updateRetries(self)
end

local function onChangedComboOption( self, setting, widget )
    -- Iron man setting is special: it links to the iron man checkbox, and does not imply custom difficulty.
    if setting.ironManCheck then
        local options = {}
        setting:apply( options, widget:getIndex()  )

        updateRewinds(self)
    elseif not self.updatingDifficulty then
        -- If current difficulty is not CUSTOM, and an option was change to the non-default value...
        -- automatically switch to CUSTOM DIFFICULTY.
        --self:selectDifficulty( simdefs.CUSTOM_DIFFICULTY )
    end

    updateRetries(self)
end

 

The comment lines before self:selectDifficulty( simdefs.CUSTOM_DIFFICULTY ) were added by me. However, changing any option still triggers the automatic difficulty switch. I'll keep trying to find how to stop this switch but I am quite oblivious as to where it would be. Any help in the right direction would be appreciated.

You might notice that I didn't change the iron man check. I'm not trying to make a no-limits easy mode - it's just that I don't agree that modifying the settings of mods like guard overhaul or starting agents should demote me to custom difficulty. I don't have all of my achievements yet and I'd like to earn them while using some quality-of-life mods with custom settings. Honestly I'd prefer an adaptive custom-difficulty switch that only triggers when core settings are changed (like credits multiplier, guard count, daemon quantity, starting power, KO duration, etc) but that might be too over-the-top code-labor-wise for me and so I'll settle for simply killing the auto-switch instead if I have to.

Thanks so much for reading!

Link to comment
Share on other sites

Did you make this a mod, or did you cange the base game file?

If you put this in a mod, then simply defining those functions is not going to do anything, you need to make the game know that it should refer to those functions, which unfortunately is not easy, since those functions are local, you can't simply write

stateGenerationOptions.onChangedOption = onChangedOption

you need to change all the functions which refer to those local functions, which can possibly conflict with Sim Constructor.

 

If you changed the base files, then the most likely possibility I can think of is that you have the Sim Constructor mod installed, since Sim Constructor overrides all changes done to states/state-generation-options.lua. You can fix this by opening your mods folder and editing Sim Constructor's files (Sim Constructor has id 580661011)

Also, before anything goes wrong, I'm going to say that editing the base game's files prevents you from unlocking any achievements. This can be solved by deleting the contents of hashes.dat (just the contents, not the file itself). If it went ok, you can open the game's log, which can be found in Documents\Klei\InvisibleInc\logs and there should be a few lines close to the top that say something like this:

-- Hash validate: hashes.dat
--  0 fails for 0 hashes.

 

Link to comment
Share on other sites

I think the files with local functions are keeping me from changing the loot tables for safes.  I've done a test of changing the base file procgen_context, and it is the only thing that has made a difference.  I'm thinking of creating a new file with global functions, and changing the procgen_context's loot table to reference it.

Link to comment
Share on other sites

2 hours ago, SteelCrow said:

I think the files with local functions are keeping me from changing the loot tables for safes.  I've done a test of changing the base file procgen_context, and it is the only thing that has made a difference.  I'm thinking of creating a new file with global functions, and changing the procgen_context's loot table to reference it.

That doesn't work, local variables have priority over global variables.

If you want to I could make a module for Sim Constructor that does what you are asking for. It's things like this I created it for :) That way other people can add things to that table too.

Link to comment
Share on other sites

On 12/28/2016 at 10:46 AM, Cyberboy2000 said:

That doesn't work, local variables have priority over global variables.

If you want to I could make a module for Sim Constructor that does what you are asking for. It's things like this I created it for :) That way other people can add things to that table too.

0.0 woah

I didn't realize it did that.  I have your Sim Constructor, but I haven't ever delved into its workings, so I don't really understand what it does.  I know sequential modloader fixes something about load orders; that's all I know.  The two are part of the same mod, right?

If it isn't too much trouble, it would be so fantastic to have that function.  For a few days, I was practically pulling out my hair trying to figure out how to change the loot inside safes, until I gave up.

I also tried to change sim/inventory.lua to insert modifiers into useItem(), but I ran into the same local functions problem.

Link to comment
Share on other sites

@SteelCrow Sim Constructor has been updated. All variables local to procgen_context have been moved to simdefs, and I've changed LOOT_TABLES to use strings instead of templates, so as long as you only want to change the items that already spawn in safes you don't need to do anything except have Sim Constructor installed :) 

@RolandJ The new Sim Constructor version lets mod users add a noUpdate trait to generation options, and options with that trait won't set your difficulty to custom. It's optional though so you'll have to ask mod creators to update their mods if they want to use it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.