Page 1 of 1
Fetching mod runtime settings on save load
Posted: Fri Aug 26, 2022 9:09 am
by M.Colcko
I have a per user mod setting. Changing it while the save is loaded works as it should using the on_runtime_mod_setting_changed event. However, I am unsure how to check the setting on save load. on_runtime_mod_setting_changed doesn't get called when a save is loaded. And now if the user is in the main menu, changes the mods setting and loads the game, this change isn't reflected in game.
The on_load bootstrap event won't work, since that's quite restricted.
How can I fetch my mods setting, and act accordingly on save loadup?
Re: Fetching mod runtime settings on save load
Posted: Fri Aug 26, 2022 12:38 pm
by Rseding91
That is all working correctly. By default the "Use mod settings per save" is enabled which means changing per-player settings from the main menu when a game is not loaded only has an effect on new save files. If the player disables that setting; loading a save will call 'on_runtime_mod_setting_changed', or if a player changes the setting while the save is loaded.
There's nothing you need to do different.
Re: Fetching mod runtime settings on save load
Posted: Fri Aug 26, 2022 10:45 pm
by M.Colcko
Ah, I see. Yeah, turning off per-save mod setting triggers the event. Thank you.
A different question: What would be the best way to run a function on save load, If I want to read/write to global?
Re: Fetching mod runtime settings on save load
Posted: Fri Aug 26, 2022 10:55 pm
by FuryoftheStars
Re: Fetching mod runtime settings on save load
Posted: Fri Aug 26, 2022 11:04 pm
by M.Colcko
I know. I'm not looking to use on_load but rather a way to execute some code somewhere on the first few ticks after the save has been loaded.
Re: Fetching mod runtime settings on save load
Posted: Sat Aug 27, 2022 12:46 am
by robot256
That's not really allowed, though. Code executing inside the game should never change its behavior based on when a game was saved and loaded, or it will lead to desyncs (every client loads the save at a different time when they join, and even their player-specific GUi elements need to exist the same on every client). You get events when settings or mods change, and those sometimes happen coincidentally with save loads, but that's it.
Re: Fetching mod runtime settings on save load
Posted: Sat Aug 27, 2022 12:55 am
by FuryoftheStars
Yeah, unless someone else has a better idea, I’d suggest evaluating what it is that you’re actually trying to accomplish and why, and whether or not it’s actually needed (ie, do you really need to check the status of a mod setting on “load” instead of the change event?).
Re: Fetching mod runtime settings on save load
Posted: Sat Aug 27, 2022 6:27 am
by M.Colcko
That's unfortunate. Thanks for the help! I'll try to find a different approach to my problem