Changing difficulty midgame - is it possible?

Exsertis

Chieftain
Joined
Sep 30, 2017
Messages
8
Hi folks,

Is it possible to change difficulty in the middle of a game? I'm familiar with Lua/SQL/XML, but I'm not sure if what I want is possible.

My rough understanding so far:
  • Difficulty-related settings are persisted to a SQL database.
  • The SQL database cannot be modified during the game by Lua code. (It can only be read.)
  • After a game has started, Lua code can achieve UI manipulations, but scope for modifying gameplay is limited.

I did find a method in PlayerConfigurations called 'SetHandicapTypeID'. I've tried using this method during a game to adjust the difficulty.

When you press ESC during the game, there is an icon which reflects the current difficulty. This icon does change when the SetHandicapTypeID method is called.

For example, I can use the SetHandicapTypeID method to change difficulty from Settler to Deity, and the icon (& its tooltip) are visibly changed in the ESC menu. This is to be expected though, since the code for populating that icon is clearly visible in Lua, and it calls GetHandicapTypeID during its execution.

Unfortunately, the combat bonuses visible in the UI remain unchanged. For example, if I change Deity difficulty down to Settler, there is still a +4 combat bonus visible in the UI for enemy units.

If I save and load the game after changing the difficulty, the icon in the ESC menu reflects the changed difficulty after loading the game, but the combat bonuses visible in the UI remain unchanged.

Any other ideas from anyone? Or am I out of luck? :)
 
Last edited:
'SetHandicapTypeID' appears so far only in the UI side on Gedemon's lua objects spreadsheet. This may have changed for the expansion but I doubt it. So all you are able to do is change what is displayed in the UI, but this has no effect whatever on actual gameplay.
 
Top Bottom