So I have some classes that have 0 max mp. Whenever I change to a class that has any mp, the amount stays at zero out of their max, requiring me to use an item or something to regain the mp. How do I make it so when I change to another class that their mp goes to the max so as to not have to use an item?
Class MP Issue
RPG Maker MV Supporthow is your class change handled? if its some event, then just restore the actor's mp afterwards. if its some other means, a quick edit to Game_Actor.changeClass() can be made to restore mp to full after use
My class change is handled by yanfly's class change plugin. However, the plugin is not the issue, as it doesn't say anything in the parameters about the mp. At least not that I have found.
Class Change Core (YEP) - Yanfly.moe Wiki
better to change the function that gets called when you confirm the choice there then. the menu calls the changeClass function for the stat comparison window.
Save this as a .js file and make sure its loaded after the class change plugin.
Save this as a .js file and make sure its loaded after the class change plugin.
Code:
Scene_Class.prototype.onItemOk = function() {
SoundManager.playEquip();
var classId = this._itemWindow.item();
var hpRate = this.actor().hp / this.actor().mhp;
//var mpRate = this.actor().mp / Math.max(1, this.actor().mmp);
this.actor().changeClass(classId, Yanfly.Param.CCCMaintainLv);
var max = this.actor().isDead() ? 0 : 1;
var hpAmount = Math.max(max, parseInt(this.actor().mhp * hpRate));
this.actor().setHp(hpAmount);
this.actor().setMp(this.actor().mmp);
this._itemWindow.activate();
this.refreshWindows();
};
That worked. Thanks.
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.
Original thread: https://forums.rpgmakerweb.com/threads/class-mp-issue.166248/