Joined
Aug 5, 2021
Messages
2
Reaction score
0
First Language
english
Primarily Uses
RMMZ
hi there, curenntly trying to modifie max hp values throught the use of states. I want to have my character loses 20% max hp per turn when the status is applied and stops when the status when removed. i am using mz with the base vizustella plugins, any help is realty appreciated
 

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
70
Reaction score
72
First Language
English
Primarily Uses
RMMZ
If you're looking to reduce the max HP by 20% per turn, you'll have to change how HP regeneration works, as it's coded to give a value based on max HP. Currently it can restore or 'damage' based on max HP but it doesn't change the max HP value, if that makes sense.

I don't know how it looks in visustella since I don't use it, but the vanilla method is:

JavaScript:
Game_Battler.prototype.regenerateHp = function() {
    const minRecover = -this.maxSlipDamage();
    const value = Math.max(Math.floor(this.mhp * this.hrg), minRecover);
    if (value !== 0) {
        this.gainHp(value);
    }
};
 
Joined
Aug 5, 2021
Messages
2
Reaction score
0
First Language
english
Primarily Uses
RMMZ
If you're looking to reduce the max HP by 20% per turn, you'll have to change how HP regeneration works, as it's coded to give a value based on max HP. Currently it can restore or 'damage' based on max HP but it doesn't change the max HP value, if that makes sense.

I don't know how it looks in visustella since I don't use it, but the vanilla method is:

JavaScript:
Game_Battler.prototype.regenerateHp = function() {
    const minRecover = -this.maxSlipDamage();
    const value = Math.max(Math.floor(this.mhp * this.hrg), minRecover);
    if (value !== 0) {
        this.gainHp(value);
    }
};
Sweet thanks for your help.
 

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
70
Reaction score
72
First Language
English
Primarily Uses
RMMZ
You may also need to work with mhp. The script call for that is param(0).

A state as you may or may not know can further affect the maximum value(actually change it), and thats done by Traits -> Parameter: Max HP. With the new maximum being the result of MaxHP * Pct(Ex. 1900 x 0.5 = 950). I've no way of knowing how to make it turn based, turns are only duration. This is why that code I supplied above might be the right direction. Regeneration applies at every turn.

One last thing you need to be aware of incase you've tried setHp(). Under the hood it restricts changes to the maximum(you can't set hp higher than the maximum) but it doesn't lower the maximum, only the current HP.
 

Latest Threads

Latest Posts

Latest Profile Posts

Anyone going to talk about Chris Pratt Mario?
My friend just gave me chocolate milk at lunch today! My day is now 1000x better. Yay, choco milky!! :kaojoy:
RivalRamen_Games wrote on jacobv1014's profile.
I really like your profile picture! Who is that in it? is she an OC?
Making his first game

Forum statistics

Threads
115,332
Messages
1,089,091
Members
150,003
Latest member
Zeuslord11
Top