Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ArAdev | |
Old Version | Published before Godot 3 was released. |
Hi I´m having problems with the programming of my game with the death of the player. The thing is that I´m trying to use the get_tree().reload_current_scene() in my world node, it just works fine but the problem is that the auto load scripts that I have get their variables cleared, making unplayable my game, because there´s a crash when some action happened in them because the variables are null.
The question is how can I make the “global” scripts to be updated(“recapture” the variables again) when I restart the world scene? Consider that this scripts are stored in the “root node” and not in my “world” scene. Thanks in anticipation
Edit: I commented the response of eons giving some important details to this question, if someone knows how to fix it, I would appreciate a lot.
The method reload_current_scene
should not affect the autoloaded scripts, how is that variables get cleared on them too?
eons | 2018-01-03 02:34
I checked again and apparently , the only variables that are cleared are the ones that have a node inside them( with get_node()), the others are fine(they are arrays and dictionaries and variables from the inside of the node). Apparently I can fix this by getting the nodes inside the process code, but that would mean I have to rewrite a lot of code. If someone know if you can make the auto load scripts to “reload it´s call to the get_nodes and another external variables” I would appreciate it a lot.
ArAdev | 2018-01-03 03:00