If you can clarify a few things for me, I'd be happy to help you out. You're using Yanfly's Skill core and Absorption barrier(this information is critical when asking for JS/Plugin help)
Is this a healing skill you cast on allies where you want any excess 'heal' to be converted into a barrier? And what is the intention with state 70; you only want the excess heal converted into a barrier while the target has that state?
I'm interpreting your post a few different ways and don't want to throw the wrong code at you without knowing exactly what you intend to do.
Hey great! Yes im using most of Yanfly plugins including skill core, absorption barrier and buffs and states.
Exactly if under the passive state 70, any HP would heal you gets converted into a barrier for the remainder of the battle.
You have 400 of 600 HP and use a potion to recover 500 HP, your HP is 600 and the barrier would be the difference of (400-600+500) 300.
Sidenote I noticed a problem when making another skill that increases MAT for 1 round after being healed. I could not successfully do this with <Custom React Effect> (im blanking if this is the proper name for it but either way I tried with a few different notetags).
To clarify the way it was supposed to work was equipping a staff or thru skill would give you a passive state that whenever you would recover life (regen, items, skills, lifesteal, etc) you would get a MAT buff.
I had to go into every skill and item and apply the proper script using notetags for every heal. I mention this maybe because I dont know what im doing or the mechanics of healing work differently than im used to.
I put this code into my potion notebox, It does not give me the proper barrier, im not seeing my error. Maybe it checks the target HP after the heal and its causing it to gain way too much barrier, if I was at 100 HP and healed to maximum 600HP, then I would gain a barrier of 500, when in reality I should gain nothing because im at max hp.
Edit: I added this I think it works. So far basic testing proves so, but before I add this to every heal I have in the game, Id like to confirm if its properly written.
Code:
<Before Eval>
// Registers the HP value of the user.
target._confirmHp = target.hp;
</Before Eval>
<After Eval>
if (target.isStateAffected(68)) {
target.addBuff(4,1);}
if (target.isStateAffected(70)) {
var heal = 500;
var overheal = heal + target.hp - target.mhp;
if (overheal > 0) {
target.gainBarrier(overheal);}
}
</After Eval>