Plugin to remove Items, Guard, Attack etc. from battlescreen

Hello everybody.

Since this was some issue to me, I asked somebody to help me and he gave me a nice code which works as intended to disable items etc. from the battlescreen.

Now I simply want to add onto the code to make this a little more comfortable and release this plugin. But I am not good at javascript at all, I only know some C#. But that does not really help me here even tho it is quite similar to javascript.

The piece of code is as followed:
(I added onto it already! And yes it works)

var addItemCommand = Window_ActorCommand.prototype.addItemCommand;
Window_ActorCommand.prototype.addItemCommand = function() {
if (!$gameSwitches.value(5)) { addItemCommand.call(this) }
}

var addGuardCommand = Window_ActorCommand.prototype.addGuardCommand;
Window_ActorCommand.prototype.addGuardCommand = function() {
if (!$gameSwitches.value(6)) { addGuardCommand.call(this) }
}

var addAttackCommand = Window_ActorCommand.prototype.addAttackCommand;
Window_ActorCommand.prototype.addAttackCommand = function() {
if (!$gameSwitches.value(7)) { addAttackCommand.call(this) }
}

And what I want now is to make it so, that I can change the value of the switch number within the Plugins Parameter.

upload_2019-1-20_0-20-16.png


I have done some basic information and added the basic parameter. But in the script it's obviously not called / connected to the value yet.

And if possible, it would be nice if somebody could also add the ''Escape'' mechanic to it. So that Escape can be completly removed with a switch as well.
I did not figure out how to do it yet.

The Plugin then can just be downloaded from anywhere for everyone! I just personally found it important to have something ''New'' which works with all current plugins out there without any errors.

Thanks in advance.
You should have shown what you've already done. Without that, someone has to start from scratch and redo the work you've already done.

Who gave you the original script, so I can add their name to the credits?

edit: Try this ... I haven't tested it
Code:
/*:
 * Battle Options by Shaz
 * Ver 1.00 2018.01.13
 * BattleOptions.js
 *
 *
 * @plugindesc Allows you to condition the actor's battle menu.
 * @author Shaz
 *
 * @param Attack Switch
 * @desc When this switch is ON, the Attack option will not be available.
 * @type number
 * @default 11
 *
 * @param Guard Switch
 * @desc When this switch is ON, the Guard option will not be available.
 * @type number
 * @default 12
 *
 * @param Skill Switch
 * @desc When this switch is ON, the Skill option will not be available.
 * @type number
 * @default 13
 *
 * @param Items Switch
 * @desc When this switch is ON, the Items option will not be available.
 * @type number
 * @default 14
 *
 * @param Escape Switch
 * @desc When this switch is ON, the Escape option will not be available.
 * @type number
 * @default 15
 *
 * @help This plugin allows you to condition the battle menu so options can
 * be removed by turning on the appropriate switch.
 *
 * USAGE:
 * Save to your plugins folder (file name must be BattleOptions.js)
 * Set the required switches for each option.
 * If you never want to disable an option, set its switch number to 0.
 *
 */

 params = PluginManager.parameters('BattleOptions');
 params.AttackSwitch = parseInt(params['Attack Switch'] || 11);
 params.GuardSwitch = parseInt(params['Guard Switch'] || 12);
 params.SkillSwitch = parseInt(params['Skill Switch'] || 13);
 params.ItemSwitch = parseInt(params['Items Switch'] || 14);
 params.EscapeSwitch = parseInt(params['Escape Switch'] || 15);

 function() {

    Window_PartyCommand.prototype.makeCommandList = function() {
        this.addCommand(TextManager.fight,  'fight');
        if (params.EscapeSwitch === 0 || !$gameSwitches.value(params.EscapeSwitch)) {
            this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape())
        };
    };

    var _shaz_BO_addAttackCommand = Window_ActorCommand.prototype.addAttackCommand;
    Window_ActorCommand.prototype.addAttackCommand = function() {
        if (params.AttackSwitch === 0 || !$gameSwitches.value(params.AttackSwitch)) {
            _shaz_BO_addAttackCommand.call(this);
        }
    };

    var _shaz_BO_addSkillCommand = Window_ActorCommand.prototype.addSkillCommands;
    Window_ActorCommand.prototype.addSkillCommands = function() {
        if (params.SkillSwitch === 0 || !$gameSwitches.value(params.SkillSwitch)) {
            _shaz_BO_addSkillCommand.call(this);
        }
    };

    var _shaz_BO_addGuardCommand = Window_ActorCommand.prototype.addGuardCommand;
    Window_ActorCommand.prototype.addGuardCommand = function() {
        if (params.GuardSwitch === 0 || !$gameSwitches.value(params.GuardSwitch)) {
            _shaz_BO_addGuardCommand.call(this);
        }
    };

    var _shaz_BO_addItemCommand = Window_ActorCommand.prototype.addItemCommand;
    Window_ActorCommand.prototype.addItemCommand = function() {
        if (params.ItemSwitch === 0 || !$gameSwitches.value(params.ItemSwitch)) {
            _shaz_BO_addItemCommand.call(this);
        }
    };

 }();
Sorry for the inconvenience. But there was not much added to it other than this and obviously the function itself and only some parameters for the switch.
I only tried it similar than in your code right now which didn't work too well.
So I will be testing what you just posted!

The original was posted by "Aloe Guvner". But I do not know if he wrote it himself or copied it from somewhere else either.

Also Aloe Guvner gave me this only:

Code:
(function() {
 
    var addItemCommand = Window_ActorCommand.prototype.addItemCommand;
    Window_ActorCommand.prototype.addItemCommand = function() {
        if (!$gameSwitches.value(5)) { addItemCommand.call(this) }
    }
 
})();

I added the rest to it.



Code:
//=============================================================================
// AloeBattle.js
//=============================================================================

/*:
 * @plugindesc v1.0 Plugin made with the help of Aloe Guvner.
 *
 *
 *
 * @author Aloe Guvner
 *
 *
 * @help
 *
 * This Plugin will let you disable: Attack, Guard and Items from the
 * Battlescreen with a simple Switch.
 *
 * @param Item Switch
 * @desc Switch for enabling or disabling Items.
 * Default: 5
 * @default 5
 *
 * @param Guard Switch
 * @desc Switch for enabling or disabling Guard.
 * Default: 6
 * @default 6
 *
 *
 * @param Attack Switch
 * @desc Switch for enabling or disabling Attack.
 * Default: 7
 * @default 7
 */


//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================


(function() {
 
    var addItemCommand = Window_ActorCommand.prototype.addItemCommand;
    Window_ActorCommand.prototype.addItemCommand = function() {
        if (!$gameSwitches.value(5)) { addItemCommand.call(this) }
    }
 
           var addGuardCommand = Window_ActorCommand.prototype.addGuardCommand;
    Window_ActorCommand.prototype.addGuardCommand = function() {
        if (!$gameSwitches.value(6)) { addGuardCommand.call(this) }
    }
 
       var addAttackCommand = Window_ActorCommand.prototype.addAttackCommand;
    Window_ActorCommand.prototype.addAttackCommand = function() {
        if (!$gameSwitches.value(7)) { addAttackCommand.call(this) }
    }
 
})();


EDIT:
Alright. I have now tested your version and it does not seem to work. I have tried the default switches you implemented and also some custom changes.
Renamed the file to BattleOptions.js as well.

Another Edit:
This AloeBattle.js I made works. But I would really like to know how to add parameters, so that you can just change them in the plugin for each switch.
So can't we just add this to it?
This AloeBattle.js I made works. But I would really like to know how to add parameters, so that you can just change them in the plugin for each switch. So can't we just add this to it?

Well, we could have, if you'd posted what you'd already done when making your request. As I already said, because you didn't provide that, I had to start from scratch.

Here's the fixed (and tested) version.

Code:
/*:
 * Battle Options by Aloe Guvner, extended by Shaz
 * Ver 1.00 2019.01.20
 * BattleOptions.js
 *
 *
 * @plugindesc Allows you to condition the actor's battle menu.
 * @author Aloe Guvner, Shaz
 *
 * @param Attack Switch
 * @desc When this switch is ON, the Attack option will not be available.
 * @type number
 * @default 11
 *
 * @param Guard Switch
 * @desc When this switch is ON, the Guard option will not be available.
 * @type number
 * @default 12
 *
 * @param Skill Switch
 * @desc When this switch is ON, the Skill option will not be available.
 * @type number
 * @default 13
 *
 * @param Items Switch
 * @desc When this switch is ON, the Items option will not be available.
 * @type number
 * @default 14
 *
 * @param Escape Switch
 * @desc When this switch is ON, the Escape option will not be available.
 * @type number
 * @default 15
 *
 * @help This plugin allows you to condition the battle menu so options can
 * be removed by turning on the appropriate switch.
 *
 * USAGE:
 * Save to your plugins folder (file name must be BattleOptions.js)
 * Set the required switches for each option.
 * If you never want to disable an option, set its switch number to 0.
 *
 */

 params = PluginManager.parameters('BattleOptions');
 params.AttackSwitch = parseInt(params['Attack Switch'] || 11);
 params.GuardSwitch = parseInt(params['Guard Switch'] || 12);
 params.SkillSwitch = parseInt(params['Skill Switch'] || 13);
 params.ItemSwitch = parseInt(params['Items Switch'] || 14);
 params.EscapeSwitch = parseInt(params['Escape Switch'] || 15);

 (function() {

    Window_PartyCommand.prototype.makeCommandList = function() {
        this.addCommand(TextManager.fight,  'fight');
        if (params.EscapeSwitch === 0 || !$gameSwitches.value(params.EscapeSwitch)) {
            this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape())
        };
    };

    var _shaz_BO_addAttackCommand = Window_ActorCommand.prototype.addAttackCommand;
    Window_ActorCommand.prototype.addAttackCommand = function() {
        if (params.AttackSwitch === 0 || !$gameSwitches.value(params.AttackSwitch)) {
            _shaz_BO_addAttackCommand.call(this);
        }
    };

    var _shaz_BO_addSkillCommand = Window_ActorCommand.prototype.addSkillCommands;
    Window_ActorCommand.prototype.addSkillCommands = function() {
        if (params.SkillSwitch === 0 || !$gameSwitches.value(params.SkillSwitch)) {
            _shaz_BO_addSkillCommand.call(this);
        }
    };

    var _shaz_BO_addGuardCommand = Window_ActorCommand.prototype.addGuardCommand;
    Window_ActorCommand.prototype.addGuardCommand = function() {
        if (params.GuardSwitch === 0 || !$gameSwitches.value(params.GuardSwitch)) {
            _shaz_BO_addGuardCommand.call(this);
        }
    };

    var _shaz_BO_addItemCommand = Window_ActorCommand.prototype.addItemCommand;
    Window_ActorCommand.prototype.addItemCommand = function() {
        if (params.ItemSwitch === 0 || !$gameSwitches.value(params.ItemSwitch)) {
            _shaz_BO_addItemCommand.call(this);
        }
    };

 })();
This one works indeed. And compared to the other one it also works with Yanfly's ChangeBattleEquip plugin. Thank you a lot.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Moderator note: Reopened to allow an edit

EDIT
Moderator note: And now closed again following completion of the edit.

Original thread: https://forums.rpgmakerweb.com/threads/plugin-to-remove-items-guard-attack-etc-from-battlescreen.104657/