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
300
Reaction score
222
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
913
Reaction score
576
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,897
Reaction score
14,526
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

Dragonfly3116 wrote on Redweaver's profile.
i need to ask do you mind sending me a link to tutorial town an legend of ancients Please My new Email is necroboy1973@gmail.com
I Am A Member On The Site Here As Well If Your Still teaching Let Me Know Thanks Joseph
Added store elements.
44JtdpE5n4jQMFkSi7pACW.png

2uqvqT3uCWxcXAhlyZokxg.png

The next step will be to start making props (including distillers).
I just saw one of SigmaSuccor's RPG Maker news videos, it mentioned one of my plugins. Now I kind of wish I'd made a demo project for it, having nothing in that segment but a scroll down the code feels a little underwhelming given what the plugin COULD do. Except I suck at making demo stuff, and my testing project isn't fit for that. :(
Ok, to prepare for the GMTK Game Jam, I'm trying to make a game with the theme "The Cat's out of the Bag" in about 48 hours. I'd make a forum post with a question, but I don't have the time!
Worked over a week on a new BGM, and I'm finally happy with it.

Here are some screenshots of the area it will be used in
EzLHppdVIAMY7DP


EzLHpqsVIAEZ7jt

Forum statistics

Threads
110,516
Messages
1,053,892
Members
143,608
Latest member
Daeja
Top