Hi,
I've recently started to try adding option to my mods (so players can pick what part they actually want). Works like a charm, except for when the changes involve Game Defines ...
What I'm trying to do
Have Game Options affect Game Defines.
Issue
- The only way I know how to interact with options is through lua.
- Defines are constants that are finalized during game initialization and cannot be changed afterwards
Question
Either ...
... What event do I need to subscribe to, in order to have my function run as Advanced Game Configuration ends and game initialization starts?
... How else can I affect Game Defines depending on Game Options?
What I tried so far (without success)
When using the SequenceGameInitComplete event, the function will be called and work properly, however changing the GameDefines fails and updates to the Defines table have no effect.
Cheers and thanks,
Bosparan
Ps.: Just to make this absolutely clear:
I know how to implement a constant change to the data, by changing defines using Xml. This however does not mesh with modular options. Going with XML, if I wanted to affect three parameters, each with four options, I'd need to build 125 mods to cover all possible combinations in a single mod, or 12 and have the player select up to three different mods for each game.
I've recently started to try adding option to my mods (so players can pick what part they actually want). Works like a charm, except for when the changes involve Game Defines ...
What I'm trying to do
Have Game Options affect Game Defines.
Issue
- The only way I know how to interact with options is through lua.
- Defines are constants that are finalized during game initialization and cannot be changed afterwards
Question
Either ...
... What event do I need to subscribe to, in order to have my function run as Advanced Game Configuration ends and game initialization starts?
... How else can I affect Game Defines depending on Game Options?
What I tried so far (without success)
Code:
Events.SerialEventStartGame.Add( ImplementOptionTradeRoutes );
Events.PreGameDirty.Add( ImplementOptionTradeRoutes );
GameEvents.PreGameStart.Add( ImplementOptionTradeRoutes );
Events.SequenceGameInitComplete.Add( ImplementOptionTradeRoutes );
Events.GameOptionsChanged.Add( ImplementOptionTradeRoutes );
Cheers and thanks,
Bosparan
Ps.: Just to make this absolutely clear:
I know how to implement a constant change to the data, by changing defines using Xml. This however does not mesh with modular options. Going with XML, if I wanted to affect three parameters, each with four options, I'd need to build 125 mods to cover all possible combinations in a single mod, or 12 and have the player select up to three different mods for each game.