How to automatically navigate to Y menu when exiting X menu?

Morning all,

I am trying to set up a sequence where players closing the Equip Menu are then navigated to the Skills Menu(or whatever menu I choose) before being brought back to the Main Menu.

Is there a way to do this natively or will it require a plugin/altering of Main Menu Core VS (which I'm not married to)
By default when closing a menu scene, the engine "pops" to the scene on top of its stack. Typically the equip scene is opened like this:
JavaScript:
SceneManager.push(Scene_Equip);
You could change it to this:
JavaScript:
SceneManager.push(Scene_Equip);
SceneManager._stack.push(Scene_Skill);
I.e. go to the equip scene as usual (which implicitly puts the current scene on top of the stack), then add the skill scene to the top of the stack. So the menus will exit in order: Equip -> Skill -> (current).

Since you mentioned it, I believe VisuStella Main Menu Core lets you customise the code for each of the pause menu commands.
JavaScript:
SceneManager.push(Scene_Equip);
SceneManager._stack.push(Scene_Skill);
I.e. go to the equip scene as usual (which implicitly puts the current scene on top of the stack), then add the skill scene to the top of the stack. So the menus will exit in order: Equip -> Skill -> (current).

Since you mentioned it, I believe VisuStella Main Menu Core lets you customise the code for each of the pause menu commands.


If I wasn't going the VS route, I should be able to simply alias in a "plugin" to create this effect without altering original files right?
Yes, you could try this (untested):
JavaScript:
/*:
 * @target MZ
 * @plugindesc Equip scene will always exit to Skill scene first.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/154986/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (alias => {
  Scene_Equip.prototype.create = function() {
    alias.apply(this, arguments);
    SceneManager._stack.push(Scene_Skill);
  };
})(Scene_Equip.prototype.create);
Assuming it works, this will apply regardless of how you enter the equip scene.
/*: * @target MZ * @plugindesc Equip scene will always exit to Skill scene first. * @author Caethyril * @url https://forums.rpgmakerweb.com/threads/154986/ * @help Free to use and/or modify for any project, no credit required. */ void (alias => { Scene_Equip.prototype.create = function() { alias.apply(this, arguments); SceneManager._stack.push(Scene_Skill); }; })(Scene_Equip.prototype.create);


Spot On!

Will play around with it to fit my exact needs with a special scene.

Much appreciated @caethyril
You're welcome! 👋

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 at OP's request
1676778769614.png
Extremely helpful!, Thank you Nao. Now I don't need a sep little plugin if I stick with Main Menu Core lol.

Had this reopened because I have a follow up question.

The purpose of this redirect is to make sure Players double check their Equipped Skills whenever they switch gear. Similar to how Final Fantasy 7 went from the Equip screen to the materia screen.

What I would like to do to further enhance this functionality is select the actual "Equip Skill" section in the skills menu (labeled "Grimoire" in my project).

The default view that is shown:

1676779373646.png


What i want the default view to be:

1676779404231.png


Any ideas on this?



I am also working on redirecting to the standalone menu for the plugin i'm using but its having compatibility issues with MZ, so this would be the workaround
regarding the section you just edited: JS: Personal Code
Spoiler: Menu setting
Code:
SceneManager.push(Scene_Equip);
SceneManager._stack.push(Scene_Skill);
Window_SkillType.prototype.selectLast = function() {
    const skill = this._actor.lastMenuSkill();
    if (skill) {
        this.selectExt(skill.stypeId);
    } else {
        this.forceSelect(1);
        Input.virtualClick('ok');
    }
};

Then back up to JS: Ext
Code:
Window_SkillType.prototype.selectLast = function() {
    const skill = this._actor.lastMenuSkill();
    if (skill) {
        this.selectExt(skill.stypeId);
    } else {
        this.forceSelect(0);
    }
};
regarding the section you just edited: JS: Personal Code
Spoiler: Menu setting
Code:
SceneManager.push(Scene_Equip);
SceneManager._stack.push(Scene_Skill);
Window_SkillType.prototype.selectLast = function() {
    const skill = this._actor.lastMenuSkill();
    if (skill) {
        this.selectExt(skill.stypeId);
    } else {
        this.forceSelect(1);
        Input.virtualClick('ok');
    }
};

Then back up to JS: Ext
Code:
Window_SkillType.prototype.selectLast = function() {
    const skill = this._actor.lastMenuSkill();
    if (skill) {
        this.selectExt(skill.stypeId);
    } else {
        this.forceSelect(0);
    }
};


That did it. Thank you! Hopefully I can get the proper menu working soon but this does what I need just fine.
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/how-to-automatically-navigate-to-y-menu-when-exiting-x-menu.154986/