Item usable only by an actor

Good morning,
I'm looking for a solution so that an item can only be used by a single character during combat.
Other characters won't even be able to select this item (ideally it would be grayed out in this case).
Is there a plugin that can do this?
I need the item to be in inventory, it can't become a skill.
With a default project, this plugin should ensure that, when selecting items in combat, they are only enabled for selection for certain actors if there's a note tag indicating so:
Code:
/*:
* @plugindesc Allows the user to tag items as usable only by a specific actor.
* @author Zevia
*
* @help In the note box of an item, add <actorRestricted: x> where x is the Id
* of the actor that's allowed to use the item.
* Additional actors can be specified with comma separation. For example,
* <actorRestricted: 1, 4> would mean only actors 1 and 4 can use the item.
* If an actor cannot use the item, it will be greyed out in the item menu.
*/

(function(module) {
    'use strict';

    var Zevia = module.Zevia || {};

    Zevia.isItemEnabled = Window_ItemList.prototype.isEnabled;
    Window_ItemList.prototype.isEnabled = function(item) {
        return Zevia.isItemEnabled.call(this, item) &&
            (
                !item.meta ||
                !item.meta.actorRestricted ||
                !BattleManager.actor() ||
                item.meta.actorRestricted.split(',').map(function(actorId) {
                    return parseInt(actorId.replace(/\s+/, ''));
                }).indexOf(BattleManager.actor().actorId()) !== -1
            );
    };
})(window);

Just go to an item's definition in the database and add in the notebox "<actorRestricted: x>" or "<actorRestricted: x, y, z>", where x, y, and z are the Ids of actors you want to restrict the item to.

If the actorRestricted tag is not in the note box, then it's assumed the item should behave as usual.

Won't have any effect on item selection and usage out of combat.

May have compatibility issues with Plugins that significantly change how combat works, specifically where the current character selecting an action is no longer represented by the BattleManager.actor() method.

Example images:
Spoiler
example-note.PNG

actor-1-selecting.PNG

actor-2-selecting.PNG

actor-3-selecting.PNG
I have moved this thread from RPG Maker MV Support to JS Plugin Requests.
Thank you very much, it works perfectly.
I use a lot of plugins that relate to combat but I don't feel like it's annoying. I put yours at the top of the plugin list, I imagine that if there was an incompatibility, yours would not work.
I would be surprised if most turn-based combat plugins overwrote the BattleManager.actor() method, since, even if modified, it's handy to figure whose turn it currently is - but I can't speak to every Plugin or design decision. 🙂

Glad it works for you!

Original thread: https://forums.rpgmakerweb.com/threads/item-usable-only-by-an-actor.162036/