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
309
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
301
Reaction score
226
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
309
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
916
Reaction score
578
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
309
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,940
Reaction score
14,562
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 Profile Posts

It seems that I have to change the order with which I make the fantasy games on my bucket list, because the intended title is used as a story element in the first two games in the line, and somebody else might take the title for their own game because the term uses real words. I can't risk going over the apparent three year limit for registering trademark ahead of time.
I am interested in collaborations so if you like my art, hit up my messages! :wub
unknown.png

Making good progress with the second chapter. :)

Still work in progress.

(Real life, it is chronically the fourth chapter that I am making.)
constructionworkconcept.pngezgif-2-0acb620ecf8d.gifezgif-2-afeaf16ebb8d.gif "The Great Wall is great. But, most people can only be the slaves who built it, leaving their bones underneath that wall. They spent their whole life to build that wall and the empire, an empire that enslaves them." :kaoswt2: I'm just going to turn it into a modern-day sad tale.

Forum statistics

Threads
110,676
Messages
1,055,107
Members
143,796
Latest member
ShadyBrain_Entertainment
Top