Plugin that opens a specific part of equipment.

I don't know if this is possible to do without plugins, but currently, I have no idea on how to do this without a plugin.

Basically I want to make an NPC that opens the list of characters in your party, and then after you select it, it opens a specific part
of equipment menu (for example Weapon & Accessory) and enable the players to change it. This will cause the Weapon & Accessory can't be changed from the main menu, but the other parts of equipment can still be changed.
(For those who played Suikoden, this works pretty much like the Rune Shop where you can change a character's rune only from a specific NPC while it can only be checked at from the main menu.)

Edit: To make it clearer, I will include example of rune management from Suikoden 2, because it is very close to my intention.

Spoiler
QqMScn0.png

FcVrjpW

This is the main menu screen from Suikoden II. Notice that the Rune and Equipment are separated (To simplify things, the "Rune" is just another Armor, so in MV, the rune is displayed together with all other Equipments)

CahHK23.png

rhvx8MS.png

OyvgwtW

sy5lX3X

This is what happened if you open the "Rune" and "Equipment" option from the main menu. And if it's possible, I want to make the main menu separate the "Rune" and "Equipment" menu like this, and in addition to that, make the "Runes" unable to be equipped and/or removed from the menu.

GEAzUzf.png

OmoctOQ.png

AeFVI75

OmoctOQ

Thus, the way that players can equip and/or remove the runes is by visiting a Rune Master where the Rune Master can equip and/or remove the rune.

The best thing I can do currently is hiding the equipment option from the main menu and make an NPC that calls the equip menu, but it will make all equipment parts inaccessible while I only want weapon & accessory that are inaccessible from the main menu. Thus, I reckon this needs either a plugin or tweaking of the codes, which I can't really do.
this can technically be done in one line of code my friend , if i understand what you want correctly,
Bascially you want to edit the MainMenu Command Window, find where is says "addCommand("Equip'," select that whole function copy it to a new file, set that new file up as a plugin

However i do believe Yanfly has a Main Menu Manager that allows one to do this via the plugin menu. if for some reasson that script is incompatible with something else you have.

outside of Yanfly's script you could do it like this

Code:
Window_MenuCommand.prototype.addMainCommands = function() {
    var enabled = this.areMainCommandsEnabled();
    if (this.needsCommand('item')) {
        this.addCommand(TextManager.item, 'item', enabled);
    }
    if (this.needsCommand('skill')) {
        this.addCommand(TextManager.skill, 'skill', enabled);
    }
    if (this.needsCommand('equip')) {
      //  this.addCommand(TextManager.equip, 'equip', enabled);
    }
    if (this.needsCommand('status')) {
        this.addCommand(TextManager.status, 'status', enabled);
    }
};

as you can see this is the original function from Window_MenuCommand, all i did was comment out the part where it tells the window to show the Equip command.

now to enter the Equip menu, use 'SceneManager.push(Scene_Equip) as a script command.
Now to lock a specfic Slot for a character, so it cannot be changed and unlock so you can, this requires a modification of that characters traits. RPGmakerMV stipulates in several places that they do not like us doing this because you would 'modifying a database object'.
the alternative is to modify Game_Actors 'IsChangeEquipOk' function.

Code:
/*:
 * @plugindesc Locks specific equipment Slots
 * @author Silver Knight Dragon
 *
 *
 *
 * @help
 *
 * to start locking, set up the Equipment Slots
 * parameter below and then set the switch you want
 * to use to control when the locking is active
 *
 * RPGmaker MV uses an index to identifiy equipment slots called SlotID
 * Weapon is usually zero, and it counts upwards until
 * you reach the last equiment slot, usually accessory.
 * SlotID differs from the numbers you see on Equipment Types.
 *
 * by defualt
 * Weapon is 0
 * Sheild is 1
 * Head is 2
 * Body is 3
 * Hands is 3
 * Legs is 5
 * Accessory is 6
 *
 * be sure to add all necessary slots ID's
 *
 *
 *  @param EquipSwitch
 *  @default 2
 *  @type switch
 * @desc the switch when ON will lock Equipment Slots
 *
 * @param LockingSlots
 * @default ["0","6"]
 * @type number[]
 * @desc the SlotID's you want to lock
 *
*/

var DSE = DSE || {};
DSE.AutoParse = function(string) {
    try {
        return JSON.parse(string, function(key, value) {
            try {
                return this.AutoParse(value);
            } catch (e) {
                return value;
            }
        }.bind(this));
    } catch (e) {
        return string;
    }
};
DSE.EquipmentLocker = function () {
    var Module = {};
    //Plugin Paramer processing
    PluginManager.parameters('EquipmentLocker');


    Module.lockedSlots =
    DSE.AutoParse(PluginManager.parameters('EquipmentLocker')['LockingSlots']);

    Module.equimentLockSwitch = 2;

//-----------------------------------------------------------------------------
// Game_Actor.isEquipChangeOk
//-----------------------------------------------------------------------------
    Module.GameActor_isEquipChangeOk =  Game_Actor.prototype.isEquipChangeOk;
    Game_Actor.prototype.isEquipChangeOk = function (slotId) {
        return (Module.GameActor_isEquipChangeOk.call(this, slotId) &&
            !DSE.EquipmentLocker.isSlotLocked(slotId));


    };

    Module.isSlotLocked = function (slotId) {
        return $gameSwitches.value(this.equimentLockSwitch) && this.lockedSlots.includes(slotId);
    };
    return Module;
}();

crap double post,
@Fornoreason1000 Thank you so much for replying. This looks very promising. I will try it ASAP 🙂

Edit: @Fornoreason1000 So, the second plugin that lock the equipment worked quite well, but the first plugin didn't really work. I'm sure it's because I'm messed up, but then again, I did not very clear about my intention, so I edited the first post to add an example from Suikoden 2 which is pretty much what I aim for.
@Fornoreason1000 Thank you so much for replying. This looks very promising. I will try it ASAP 🙂

Edit: @Fornoreason1000 So, the second plugin that lock the equipment worked quite well, but the first plugin didn't really work. I'm sure it's because I'm messed up, but then again, I did not very clear about my intention, so I edited the first post to add an example from Suikoden 2 which is pretty much what I aim for.

yeah that first one, i though you only wanted to lock out the equip menu. which is does by removing the option form the main menu, but you can still call it directly via scriptcalls.

the second one, was that exactly what you wanted or is it still missing something
@Fornoreason1000 The second plugin works fine. Now I only need something that opens up the equip screen, but shows only the specific equipment that has been locked, because when I use the default equipment window script call, it displays all equipment from weapon to accessory, while in this case I only want it to show the accessory part and nothing else. (Is that make sense? I'm sorry if it's confusing again)

Edit: I'm sorry, but when I tried the equipment lock plugin in my project, it suddenly crashed. Did I make some mistakes?
https://i.imgur.com/ziJv.png
nQ65z3g.png
Yes you did kinda, the plugin is named wrong, so PluginManager doesn't know where "locked slots' array is.
re name it to "DSEEquipmentLocker.js". im going to take the blame for this because
1. i didn't specify the name in the code.
2. i didn't include a fallback

Ive also posted an updated file, please delete that one and use this one instead. ive tested this and it does work according to your description

As for you equipment screen, that i can do but should you choose to use a custom equip menu it will immediately be broken as Window_EquipSlot needs to be be completely rewritten
Thank you for the update 👋
Although I guess I messed it up again, but I'm sorry that I don't know how exactly I messed it up :oswt:
7c6kTx2.png

DBRbIdy.png


I tried it on a fresh project with no other plugins to make sure, and it still crashed.

OC0OjJs.png

mhDeHEA.png


For the equipment screen, I'm using Yanfly's Equip Core. Will it cause any trouble?
Okay, i can immedialtely tell it crashed becuase you are using YEP Equip Core. so the answer is yes it will cause you alot of trouble. it appears you are using a few of Yanfly's scripts. If I knew that earlier i could of based my code on Yanfly's Engine instead of MV vanilla :asad::aswt2:

so yeah, i have to make something else, so that script i sent you is actually completely useless. sorry i had no idea you were using any plugins.

what i find odd is your crashing in a blank project, i teseted that script in a blank project and i cant reproduce that crash.
Ah, I see. Sorry for not mentioning it soon. :oswt:
Thank you for being patient with me, tough. :uswt:
I really have no idea whatsoever on tweaking plugins & javascript, so I really appreciate your help 😂

Original thread: https://forums.rpgmakerweb.com/threads/plugin-that-opens-a-specific-part-of-equipment.102621/