emergency barrier/shield and first aid help

Hi guys, I've been using yanfly absorption barrier and I can't figure out how to make it do what I want or if it's even capable of doing so. I want my actor to gain a percentage of damage taken as barrier points.
For example, let say the actor takes 100 damage, from that 100 the actor will gain 70 in barrier points as a reaction effect. any help is greatly appreciated.

second, I wanted to know how I can create a state where the actor taking damage has a chance to auto-heal on hit.
ive mangled some javascript i read from yanfly but i might be way off lol

<Custom Confirm Effect>

// Registers the HP value of the user.

user._confirmHp = user.hp;

</Custom Confirm Effect>



<Custom React Effect>

// Check if this dealt HP damage

if (this.isHpEffect() && value > 0) {

// Calculate the amount of barrier points to give the user

var barrier = 0.15;

// Make the user gain the barrier

user.gainBarrier(barrier);

}

}

}

}

</Custom React Effect>

Original thread: https://forums.rpgmakerweb.com/threads/emergency-barrier-shield-and-first-aid-help.115018/