I'm using the Yanfly's Barrier plugin and I was wondering if there is a way to make a Barrier that will regenerate per turn but only up to the amount of shield they have. So if a barrier is 50% of their hp then heal 20% of that barrier per turn.
www.yanfly.moe
Yanfly Barrier question
RPG Maker MV Supportset up a state to go along with the barrier in which every turn start or end it calculates what you need.
What would I put in the state and will it only affect the barrier from the armour or all barriers that the user will get?
state:
all of this could have been done without creating variables, but i wanted to make things easier to understand and edit.
Code:
<custom turn start effect>
//get the battler hp rate
var userHP = user.hpRate();
//create variable to store the points to be regen'ed. here they start off as the max hp
var rPoints = user.mhp;
//do you math below. in this example, it restores the remaining hp rate as barrier points
rPoints = Math.floor(rPoints * userHP);
//add the barrier points. those are unexpiring points. to make then expire, change zero to a number of turns
user.gainBarrier(rPoints, 0);
</custom turn start effect>
all of this could have been done without creating variables, but i wanted to make things easier to understand and edit.
Thank you so much
Original thread: https://forums.rpgmakerweb.com/threads/yanfly-barrier-question.149092/