RMMV YEP_ClassChangeCore Edit: Auto-Adjust HP / MP upon Class Change

Status
Not open for further replies.

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
308
Reaction score
97
First Language
English
Primarily Uses
RMMV
I have a request which would be really helpful.

I use YEP_ClassChangeCore but the downside to changing classes is that you aren't at full HP / MP if the class had more MHP / MMP.

I want to auto-adjust HP / MP upon class change. If I'm at full HP and I change class that has higher Mhp, adjust the HP to that Mhp.

However, even if I'm not at full HP / MP, I still want that auto-adjusted just so there won't be a bigger gap between the amount of HP I had and the Class's Mhp.

=================

Edit: To be clear, I really want to retain the HP percentage when changing class.

If I'm 80% HP and then change class, I'll still be 80% HP in the other class.
 
Last edited:

Kenen

Veteran
Veteran
Joined
Apr 3, 2012
Messages
298
Reaction score
220
First Language
English
Primarily Uses
RMMZ
I'm not 100% sure from the way you've phrased your request, but it sounds like you want to maintain the actor's HP/MP percentage when changing classes? In other words, if the actor was at 50% HP prior to the class change, he remains at 50% HP after the class change regardless of how his actual HP totals have changed.

If my guess is incorrect, you should consider editing your post with some actual numerical examples of what currently happens versus what you want to happen. The more details that you provide, the more likely it is that someone will pick up your request.
 
Last edited:

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
308
Reaction score
97
First Language
English
Primarily Uses
RMMV
That's what it was. Retain the HP percentage when changing class, this is what what I'm wanting to have done with Class Change Core.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
910
Reaction score
574
First Language
English
Primarily Uses
RMMV
I haven't tested this, but it should work for what you need.

JavaScript:
var ccc_changeClass = Game_Actor.prototype.changeClass

Game_Actor.prototype.changeClass = function(classId, keepExp) {
    var currentHpRate = this.hpRate()
    var currentMpRate = this.mpRate()
    ccc_changeClass.call(this, classId, keepExp)
    this.hp = Math.round(this.mhp * currentHpRate)
    this.mp = Math.round(this.mmp * currentMpRate)
    this.refresh()
    $gamePlayer.refresh();
};

Copy the text into a blank .js file, and import it into your plugin manager below ClassChangeCore and Subclass if you're using that. Basically it caches the current hprate of the actor before changing class, and then sets their new hp to equal the rate they had before they changed.

No credit necessary.
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
308
Reaction score
97
First Language
English
Primarily Uses
RMMV
Oh, this is much appreciated. They're maintaining the HP percentage now!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,867
Reaction score
14,521
First Language
English
Primarily Uses
RMMV

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.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

For anyone interested in my project M - i finally made a gamethread about it :D

Yay. I turned 39 today. Another year older, another year closer to the grave.
I'm sure the latest post/thread in the sidebar used to have 5 posts. Was it always been like this?

Made it to the 10th video doing this! :kaocry:

renderTimingPixel.png
Made the "My Beating Mystery" board today:
3ENFLSC.png

in Grim Trigger episodes 3 & 4, the main characters play a Clue rip-off board game called "My Beating Mystery" (haha), so of course I had to draw the board for it. Can't decide if I wanna add blood or not

Forum statistics

Threads
110,406
Messages
1,053,057
Members
143,468
Latest member
oldj
Top