How take the type id from an armor to equip it

Hellow im triying to equip weapons and armors from the Item menu, the problems is: How can i know the type id from the item when you use it, to know in wich armor slot you will equip the item ?, for weapons is (0), well i got the code for do it from a plugin but in that plugin dont let you equip the Armors, only the weapons:
(plugin OCS Menu - Link)

the code what im using for equip weapons, and try for armors:
The "this.Actor().changeEquip(1...3, this._itemWindow.item());" is where i dont know how to set the armor id for the item you are selecting to use/equip.
Code:
Scene_Menu.prototype.onItemOk = function() {
  if(DataManager.isWeapon(this._itemWindow.item())){
    this.Actor().changeEquip(0, this._itemWindow.item());
    SoundManager.playEquip();
  }else
    if(DataManager.isArmor(this._itemWindow.item())){
      this.Actor().changeEquip(1...3, this._itemWindow.item());
      SoundManager.playEquip();
    }else{
      if(this.isItemEffectsValid()){
        this.Actor().useItem(this._itemWindow.item());
        this.applyItem();
        if ($gameTemp.isCommonEventReserved()) {
          SceneManager.goto(Scene_Map);
        }
        SoundManager.playUseItem();
      }else{
        SoundManager.playBuzzer();
    }
  }
  this._itemWindow.refresh();
//  this._statusWindow.refresh();
  this._itemWindow.activate();
};

Edit: In Scene Equip it uses this:

Code:
this.actor().changeEquip(this._slotWindow.index(), this._itemWindow.item());

If is hard to make i will use the Scene_Equip like normal works xD
Hi NM Play,

In terms of actually equipping the items, there's two things that need to change: actually enabling the item, then actually equipping it.

Code:
//Replace Window_OcsMenuItems.prototype.isEnabled with this function:

    Window_OcsMenuItems.prototype.isEnabled = function(item) {
      
        var Actor = $gameParty.members()[0];
      
        if(DataManager.isWeapon(item) || DataManager.isArmor(item)){
            return Actor.canEquip(item);
        }else{
            return Actor.canUse(item);
        }
    };

Code:
// Replace Scene_Menu.prototype.onItemOk with this function:
    Scene_Menu.prototype.onItemOk = function() {
        if(DataManager.isWeapon(this._itemWindow.item()) || DataManager.isArmor(this._itemWindow.item())){
            var mySlotId = -1;
            for (var i=0; i<this._actor.equipSlots().length; i++) {
                if (this._actor.equipSlots()[i] === this._itemWindow.item().etypeId) {
                    mySlotId = i;
                    break;
                }
            }

            if (mySlotId >= 0) {
                this.Actor().changeEquip(this._itemWindow.item().etypeId-1, this._itemWindow.item());
                SoundManager.playEquip();
            }
        }else{
///Note: the rest of the function after the "else" remains unchanged from the original script.

The main trick here is getting the equipment in the right slot, which is why we have to check the etypeId against the equipSlots variable.

Note that although this correctly equips armor and weapons in their assigned slots, it won't show the equipped armor anywhere visually.
For that, you'll have to do a bit more hacking on the script, or contact the script author and ask about adding this functionality.
It works perfectly,

I think i can do the edit for show the Armors in the MenuStatus

thaks you so much 😀

Original thread: https://forums.rpgmakerweb.com/threads/how-take-the-type-id-from-an-armor-to-equip-it.79622/