Hey guys,
Im trying to find the function that (I believe) triggers whenever you open the menu, which freezes all the events and whatnot. Im looking for this because i wish to create my own inventory system, and some custom pause instances, and i require everything to freeze when doing so.
Any help would be appreciated, thanks in advance!
Looking for the function that stops everything from moving(when opening menu)
● ARCHIVED · READ-ONLY
-
-
There is no such thing, not when opening the menu at least.
The map and the menu are different scenes.
What you're seeing behind the menu isn't the actual map, it's a screenshot taken before opening the menu. -
@Astfgl66 the game does "pause" when you open the menu tho. Im aware that the blurry background is an image, but the game is actually pausing all event movement and whatnot aswell. Id like to know the function thats causing that, to use it in different situations.
-
It does not pause. The map scene simply stops processing and the menu scene takes over. I'm not going to get more technical, just know that there is no pause function, that's not how things work under the hood.
By having an evented menu you're remaining on the map scene, you can't stop it from processing or your menu won't run either.
Putting it simply: the map simply doesn't exist anymore when you open the menu, it is recreated when you close it. It is not paused. You can't do that with eventing.
Your best bet would be to use script calls to stop all interpreters except the one you use for your menu event. Or do something ridiculously complicated with switches. -
@Astfgl66 hmm, are you sure the map is gone tho? When im in the menu, i can still change the values of events that are inside the map through the console. In any case, do you happen to know how to stop or rerun an interpeter?
-
I put it simply by intentionnaly saying something that's completely wrong to give you the gist of why it can't be done.
What actually happens when you open the menu is that the current map scene is stored in the scene stack to be reused later.
It would be unefficient to actually destroy and recreate it.
The thing is only the currently in use scene runs its update function, not the scenes in the stack, so yes you could say that map scene is "paused". However there still is no pause function, it simply does not run. If you were to not run the map update function while you're on it, you'd just brick the game.
Try it in the console, type SceneManager._scene.update = function() {} while on the map.
Congratulations, it's "paused" but you've also made your game completely non functional. -
@Astfgl66 is right - things stop happening on the maps because a new scene has been loaded and the map is not being updated. It's still in memory, which is why you can change stuff, but all processing is halted while the new scene (menu) is open.
If you want your map to be visible while your inventory system is open, you have two options:
If you want ALL processing to be halted, set up your system as a new scene, and use a snapshot of the map as the background.
If you want SOME events to be halted but others to continue, you'll have to use something like a switch to say when to stop moving, and use event notes to identify the events you want to stop moving when that switch is on, then modify the event class to only do its update when the switch is off or the event is not influenced by the switch. -