How to know Class of selected Actor before opening Status Scene?

● ARCHIVED · READ-ONLY
Started by Kima_Prince 3 posts View original ↗
  1. I've been playing with rpg_scene.js, rpg_windows.js and I have YEP_MainMenuManager.js and YEP_StatusMenuCore.js installed that I suspect may be affecting what I want to do.

    I want to be able to know the class of the actor the player selects before opening the Status Menu (I have a class that does not use any of the status/equip/etc menus and I want to prevent the player from opening those menus when trying to select actors with said class)

    Closest thing I've seen that may help is in rpg_windows.js

    Code:
    Window_MenuStatus.prototype.processOk = function() {
        Window_Selectable.prototype.processOk.call(this);
        $gameParty.setMenuActor($gameParty.members()[this.index()]);
    };

    I'm at a loss as to where to edit any plugin/script to achieve what I want to do. Does anyone have any idea?
  2. You can check the class and make pressing "ok" play a buzzer instead if the actor has the forbidden class:
    Code:
    Window_MenuStatus.prototype.processOk = function() {
        const currentActor = $gameParty.members()[this.index()];
        const forbiddenClasses = [4, 8, 10];  // Add class # for any that can't open the equip menu
        if (!forbiddenClasses.includes(currentActor._classId)) {
            Window_Selectable.prototype.processOk.call(this);
            $gameParty.setMenuActor(currentActor);
        } else {
            SoundManager.playBuzzer();
        }
    };
  3. Aloe Guvner said:
    You can check the class and make pressing "ok" play a buzzer instead if the actor has the forbidden class:
    Code:
    Window_MenuStatus.prototype.processOk = function() {
        const currentActor = $gameParty.members()[this.index()];
        const forbiddenClasses = [4, 8, 10];  // Add class # for any that can't open the equip menu
        if (!forbiddenClasses.includes(currentActor._classId)) {
            Window_Selectable.prototype.processOk.call(this);
            $gameParty.setMenuActor(currentActor);
        } else {
            SoundManager.playBuzzer();
        }
    };

    I played with that, even adding it into a plain 'new project' to make sure that no other plugins would interfere, but it didn't work. HOWEVER, it did send me into the right direction looking into the javascript and I found the part of rpg_windows.js that it DID work. I got it to run in the plain project then put it into my current project (edited it for my project) and IT WORKED. So THANK YOU.

    This is where I got it working:
    Code:
    Window_MenuStatus.prototype.isCurrentItemEnabled = function() {
        if (this._formationMode) {
            var actor = $gameParty.members()[this.index()];
            return actor && actor.isFormationChangeOk();
        } else {
            const forbiddenClasses = 1; 
            if (forbiddenClasses != $gameParty.members()[this.index()]._classId) {
            return true;
            }
            else
            {return false}
        }
    };