An add-on for the Command Manager is available for party menu commands. The party menu is the menu where you manage your party, such as using items or skills outside of battle, equipping your actors, changing your formation, or saving/quitting the game.
The basic functionality is to allow you to easily choose what commands you want in the menu and what order they should appear in.
The Command Manager’s API can be used to define new menu commands as well, providing a 4-step process to defining complex commands that you can use in your own game or share with the community.
In the script editor, place this script below Command Manager and above Main
Choosing your Menu Commands
In the configuration, you can choose which menu commands will be displayed.
They will appear in the order that you specify. The built-in list of commands is as follows:
- :item – opens the item menu
- :skill – opens the skill menu
- :equip – opens the equip menu
- :status – opens the status menu
- :formation – change your party formation
- :save – opens the save menu
- :game_end – end the game
All custom commands, such as :load, are added as separate scripts, but it is easy to add them to your game after downloading the script.
Defining Menu Commands
The 4-step process to defining your own menu command is described below. I will create a Load command and add it to the party menu.
- Register your command
Choose a symbol for your command. This will be used throughout your command plugin, so you should pick something unique and intuitive. I will use :load in this case. Register the command like this:
- Define a class for your command
You will define a class and inherit from the Game_Command defined by the Command Manager. This allows you to add custom conditions to your command such as when it is enabled or hidden. The name of the class doesn’t matter, but you should try to make it unique:
class MenuCommand_Load < Game_Command end
Note that I didn’t write any methods here, but you can look at the Game_Command class to see what you can alias or overwrite.
- Add a handler for the party
To use your command, you need to first create a handler in the party. The handler begins with the prefix “add_menu_command_” followed by the symbol you chose.
You will determine the text to display for this command, and the handle symbol to use. This symbol should be the same as the one you registered in step 1.
class Game_Party < Game_Unit def add_menu_command_load(args) cmd = MenuCommand_Load.new("Load", :load) add_menu_command(cmd) end end
- Define the control method
This is where you define what happens when the player selects your command. It is defined in Scene_Menu, and uses the command symbol in the method name.
class Scene_Menu < Scene_MenuBase def command_load SceneManager.call(Scene_Load) end end
This is just the basics for defining a menu command. The Command Manager documentation contains more information about the framework itself.
Handling command arguments
If you look at the example at the top with the 4 menu commands, you’ll notice that each command is specified as an array. This is how you pass arguments to the commands.
When defining the command handler in step 3, you will see that it takes an “args” parameter. This is an array of arguments extracted from the user’s input. You can use these arguments to build your command as “extra data”. See the Command Manager documentation for more information on how to work with this extra data.