Changing classes based on an item

I am new to RPG Maker so I am still trying to get a handle on some things.

I created an event with conditional branches which correctly changes classes based on the equipped item. I currently have that event being called in "rpg_scenes" on all equipment changes using "$gameTemp.reserveCommonEvent(1);" which does not run the event while a menu is open.

Is there an easy way for the equipment menu to still be open after the event runs so values are all updated? I thought I might be able to force it with the SceneManager to go to map then to previous scene quickly but even that did not work.
if(this.actor().equips()[5] == null){ //default
this.actor().changeClass(5, true);
}
else{
if(this.actor().equips()[5].id == 5){//hero
this.actor().changeClass(1, true);
}
if(this.actor().equips()[5].id == 6){//warrior
this.actor().changeClass(2, true);
}
}

Working with it I was able to figure out class change with equipment that works in the menu. My new problem is that I can't seem to find a way to keep HP and MP from going to the max after the class change instead of staying at the previous value.
var currentHP = this.actor().hp;
var currentMP = this.actor().mp;
you're code
this.actor().setHp(currentHP);
this.actor().setMp(currentMP);
var currentHP = this.actor().hp;
var currentMP = this.actor().mp;
you're code
this.actor().setHp(currentHP);
this.actor().setMp(currentMP);

This is still keeping their hp at max after the class change.
so you did this?

var currentHP = this.actor().hp;
var currentMP = this.actor().mp;
if(this.actor().equips()[5] == null){ //default
this.actor().changeClass(5, true);
}
else{
if(this.actor().equips()[5].id == 5){//hero
this.actor().changeClass(1, true);
}
if(this.actor().equips()[5].id == 6){//warrior
this.actor().changeClass(2, true);
}
}

this.actor().setHp(currentHP);
this.actor().setMp(currentMP);
so you did this?

var currentHP = this.actor().hp;
var currentMP = this.actor().mp;
if(this.actor().equips()[5] == null){ //default
this.actor().changeClass(5, true);
}
else{
if(this.actor().equips()[5].id == 5){//hero
this.actor().changeClass(1, true);
}
if(this.actor().equips()[5].id == 6){//warrior
this.actor().changeClass(2, true);
}
}

I found the problem appears to be related to the yanfly equip plugin I was using to make the equip menu look better. I will have to dive into that when I get the chance to find the cause.

Thank you for your help.
Happy to Help 🙂

Original thread: https://forums.rpgmakerweb.com/threads/changing-classes-based-on-an-item.80135/