sheeshkebab1812

Veteran
Veteran
Joined
Feb 3, 2022
Messages
68
Reaction score
12
First Language
English
Primarily Uses
RMMV
The way i aim for life steal to work in my game is for it to have an upper limit equal to a percentage of the battlers health. The actor may have 5% life steal but can only heal up to 10% of their maximum health. Is there anyway to set this up so that there is an upper limit to what health can be regained and to be able to alter the limit with states so it could be higher or lower

 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,799
Reaction score
6,623
First Language
English
Primarily Uses
RMMV
It's always appreciated for you to provide links to any plugins or tips you're referencing :wink:

The trick is that for whatever reason, the Life Steal plugin is structured such that the code for the custom steal notetags doesn't have access to the damage being done. That means you have no way to say "steal this much percentage of the damage, but cap it at this value."

If you want to do it this way, I think you'll have to ditch Life Steal and do it with Buffs & States tags. e.g.:
Code:
<Custom Establish Effect>
if (value>0 && this.isHpEffect())
{
    user.gainHp(0-Math.round(Math.min(value*.05, user.mhp*.1)));
    user.startDamagePopup();
}
</Custom Establish Effect>

That will heal them for 5% of all HP-damaging skills, with a max of 10% of their HP each time. You can add additional checks for isStateAffected() and modify the equation appropriately.
 

sheeshkebab1812

Veteran
Veteran
Joined
Feb 3, 2022
Messages
68
Reaction score
12
First Language
English
Primarily Uses
RMMV
It's always appreciated for you to provide links to any plugins or tips you're referencing :wink:

The trick is that for whatever reason, the Life Steal plugin is structured such that the code for the custom steal notetags doesn't have access to the damage being done. That means you have no way to say "steal this much percentage of the damage, but cap it at this value."

If you want to do it this way, I think you'll have to ditch Life Steal and do it with Buffs & States tags. e.g.:
Code:
<Custom Establish Effect>
if (value>0 && this.isHpEffect())
{
    user.gainHp(0-Math.round(Math.min(value*.05, user.mhp*.1)));
    user.startDamagePopup();
}
</Custom Establish Effect>

That will heal them for 5% of all HP-damaging skills, with a max of 10% of their HP each time. You can add additional checks for isStateAffected() and modify the equation appropriately.
Thank you, i updated the post to have the link to the plugin
If i were to have several different ways of increasing or decreasing the amount healed and the cap would the best way be for me to denote a variable using if statements to alter it then replace the ".05" and ".1" with said variables?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,799
Reaction score
6,623
First Language
English
Primarily Uses
RMMV

Latest Threads

Latest Posts

Latest Profile Posts

It was fun while it lasted, but guess it's time to say goodbye to my antidepresants. My body is immune to their good effects and only bad effects would remain.
Character in the game lore: An individual with exceptional skills.
Players: Slip through the cliff and die.
You know.. I... I kinda lost my interest in living a long time ago. What sustains me is a lack of interest in dying.
Like a star that is balanced between the forces of gravity and outward pressure, I feel like the energy to produce that outward pressure is weakening. I feel like I should pull a Stardew Valley and revert to a more primitive lifestyle, away from others. :(

Forum statistics

Threads
131,586
Messages
1,221,276
Members
173,285
Latest member
tnt3927
Top