Page 1 of 1

script.on_load_finished

Posted: Thu Sep 22, 2016 5:34 pm
by AntiElitz
I tried for a long time to run code on the first tick after a game is finisched loading, but there seems to be no clean workaround, without the game desyncing in MP.

Requested features:
-Should fire on the first tick after a game was loaded, so you can edit global.variables
-Should NOT fire when another player joins the game (and load it just for him) to prevent desyncs

Why do I need this?:
-I want to check my config file for changes
-I want to set a global timer that hides the gui after 10 seconds
-I want to react to changes of the config and set active=true for some entities

Re: script.on_load_finished

Posted: Thu Sep 22, 2016 6:13 pm
by Rseding91
What you're asking for is the entire reason we changed on_load to prevent modification of the game state. Loading a map is not meant to change anything about the game. If it did, then replays wouldn't work, and MP wouldn't work.

As for why you want this: I'm already working on a mod config system that will allow you to do all of this without needing to even restart the game.

Re: script.on_load_finished

Posted: Thu Sep 22, 2016 6:31 pm
by AntiElitz
I see. Good to hear about the new system! Any idea on how one could implement a gui button to timeout after 10 seconds for a player than? There is pobably still no way to do so with the new config changes, is there?

Re: script.on_load_finished

Posted: Thu Sep 22, 2016 7:57 pm
by Rseding91
AntiElite wrote:I see. Good to hear about the new system! Any idea on how one could implement a gui button to timeout after 10 seconds for a player than? There is pobably still no way to do so with the new config changes, is there?
Spawn the button on_player_created and 10 seconds later remove it. It will be created for any new player and then ever again.