It is possible to remove the guard command but not as we did for cancel.
When we removed the cancel, we removed the command that is triggered when the cancel button is pressed.
If you do the same with guard (delete win._handler.guard), this will removes the command that is triggered when guard is selected in the actorCommand window. Then, selecting guard will just do nothing.
I assume that what you want is to remove the guard option in the window.
So keep in mind that on one hand you have to setup the selection option in a window and on the other hand you have to bind a function to this command.
I think the best here is to directly edit the function used to add command and just say to do nothing if the command that is about to be added has the "guard" symbol. See the code below.
One other option is to let the program adding the guard command and then remove it. But it will involved more executions...
The last option is to overwrite the function that add command in the actor command window and just don't add the guard command. While this method is the best, it has a very bad compatibility with other plugins since the default code is overwrite...
JavaScript:
var Imported = Imported || {};
var Lay = Lay || {};
Lay.forumRequest = {} || Lay.forumRequest;
//=============================================================================
// Window_ActorCommand
//=============================================================================
Lay.forumRequest.Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList;
Window_ActorCommand.prototype.makeCommandList = function() {
Lay.forumRequest.Window_ActorCommand_makeCommandList.call(this);
if (this._actor) {
this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
};
};
Window_ActorCommand.prototype.addCommand = function(name, symbol, enabled, ext) {
if (symbol === "guard") return;
// above if the symbol of the command is guard, stop the execution of the function
Window_Command.prototype.addCommand.call(this,name,symbol,enabled,ext);
// if not, just run the function as usual
};
//=============================================================================
// Scene_Battle
//=============================================================================
Lay.forumRequest.Scene_Battle_createActorCommandWindow = Scene_Battle.prototype.createActorCommandWindow;
Scene_Battle.prototype.createActorCommandWindow = function() {
Lay.forumRequest.Scene_Battle_createActorCommandWindow.call(this);
var win = this._actorCommandWindow;
delete win._handlers.cancel // Remove the command cancel
win.setHandler('escape', this.commandEscape.bind(this) ); // Add the command escape
};
//=============================================================================
// BattleManager
//=============================================================================
if (Imported.YEP_X_BattleSysCTB) {
Lay.forumRequest.BattleManager_processEscapeCTB = BattleManager.processEscapeCTB;
BattleManager.processEscapeCTB = function() {
BattleManager.setCTBPhase();
Lay.forumRequest.BattleManager_processEscapeCTB.call(this);
};
};