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!
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.
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.
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.