Level up restore based on MHP difference

SmeeDucks

Villager
Member
Joined
Jan 19, 2020
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMMV
I was looking for a plugin/method that would restore HP (and MP) based on the increase of MHP between levels after level up. This is similar to what happens in Pokemon where if a actor is at 245/250 HP and they level up with a MHP increase of 5, their HP becomes 250/255. If they leveled up again with a MHP increase of 7, then their HP becomes 257/262. All the plugins I have looked at involve a full heal, which is not what I am looking for. There is Hime's Level Up Event's (http://himeworks.com/2015/10/level-up-events) though that seems to skip levels if you level up multiple times in a battle.

As far as I see my best bet is to create an event that runs after every battle, and using variables that track actor levels, when there is a difference in their level, calculate the difference between the new level MHP and the old MHP and add that to the actors current HP.

Thoughts?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,669
First Language
German
Primarily Uses
RMMV
though that seems to skip levels if you level up multiple times
Tsulihime has another script for queuing common events, that is exactly to prevent this overwrite of one common event call with the next one.

you can do this with your common event after each battle, you only need to have different variables for each actor.
just make that common event a parallel process with the switch turned on on turn 0 of the battle and turned off as soon as all calculations are complete.
 
Joined
Feb 29, 2020
Messages
2
Reaction score
0
First Language
German
Primarily Uses
RMMV
Hello Smee,

what do you mean by "MHP"? Is it a variable?

In pseudo code I would say:
Code:
function onLevelUp (newLevel, oldLevel) {
    var currentHp = getCurrentHp(); // e.g. 200
    var fullHp = getFullHp(); // e.g. 250
    var mhp = getMhp(); // Whatever this is, e.g. 5

    setCurrentHp(currentHp += mhp); // So currentHp would be 205
    setFullHp(fullHp += mhp); // So fullHp would be 255
}
How to hook into an event after levelUp and how to get and save current/full HP is up to your project, I guess.

Updating the HP after the battle would be very unusual.

Best regards
Nick
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top