Is there some way of preventing the player from exiting the menu while the menu screen is active?
How to disable exiting the menu?
RPG Maker MV SupportYou would need a small plugin or a few lines of custom code in the method that normallly handles what happens when the B button is pressed at the (Main) Menu screen. Depending on your needs, you could remove all the code from that method to always ignore the Exit, or you could tie its functionality to a Switch (or similar) so that it's only ignored in certain circumstances, like a tutorial.
How will they exit the menu?
I've been looking for this very thing, but cannot find it. There is a callMenu function, but no exitMenu function.
I was thinking of making an rpg using only the menu and battles. The player could select the 'Fight' option to go to the next battle. There wouldn't be any overworld or areas to walk around in.
I haven't tested, but try saving this (name doesn't matter - must be .js)
Although, how are you adding the Fight option? Are you using an existing plugin?
Code:
Window_MenuCommand.prototype.callCancelHandler = function() {
};
Although, how are you adding the Fight option? Are you using an existing plugin?
Tried this. Once the menu is exited, the game appears to freeze. It becomes stuck at the menu screen, and no more input is allowed.
For the 'Fight' option I plan on using the YEP_MenuManager and YEP_CommonEvent, which will add and handle it. Haven't tested this out yet, but I'm hoping it will work.
Common events will only work in battle and on maps. So unless Yanfly has done something to make common events run in the menu, you would need to go back to the map anyway in order for it to run.
That will still allow the cancel handling to do a bunch of things, like deactivating the window and playing the cancel sound effect. To disable it entirely, a better approach is to do something like
Code:
const oldScene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
oldScene_Menu_createCommandWindow.call(this);
this._commandWindow.setHandler('cancel', undefined);
};
Original thread: https://forums.rpgmakerweb.com/threads/how-to-disable-exiting-the-menu.118954/