Is there a reason why just cancelling out is no good?
Yea... I have a d-pad with an a and b game buttons in there and it's not intuitive to the players to not use the d-pad and buttons. So I wanted to add a "close menu" option there so they can just slide the d-pad down to select "close menu" and then press the a button like they do with all the built in menu choices.
This can be done using the menu command manager.
Here is the code that will create a "Close" command for your menu
var TH_SceneMenu_closeMenu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
TH_SceneMenu_closeMenu_createCommandWindow.call(this);
this._commandWindow.setHandler('closeMenu', this.commandCloseMenu.bind(this));
};
Game_Unit.prototype.addMenuCommand_closeMenu = function() {
var command = new Data_MenuCommand("closeMenu", "Close");
this.addMenuCommand(command);
};
Window_MenuCommand.prototype.addCommand_closeMenu = function(cmd) {
this.addCommand(cmd.name, cmd.symbol, cmd.isEnabled(), cmd.ext);
};
Scene_Menu.prototype.commandCloseMenu = function() {
SceneManager.pop();
};
You can either create a new plugin file, or add this to the end of menu command manager.
Then, to add the command to the party, you would use the script call
$gameParty.addMenuCommand_closeMenu()
Which will add the command to the end of the party menu.
This is how it will look
If you want to change the name of the command, look at the code and look for "Close".
You can also rename menu commands using script calls provided by the menu command manager.
Thanks so much! This solves my issue! I will implement your suggestion! Thanks again!