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
www.yanfly.moe
Life steal cap using Yanfly's Life Steal
RPG Maker MV SupportIt's always appreciated for you to provide links to any plugins or tips you're referencing 😉
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.:
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.
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?
Right.
Original thread: https://forums.rpgmakerweb.com/threads/life-steal-cap-using-yanflys-life-steal.154562/