MV Drain life when you land a critical hit

I'm doing a state that causes allies to recover% of their Hp when the one affected by the state hits a critical hit. But ... how could he make the allies heal their hp?
managed to do something this way.
When the user of the state land a critical hit, applies a state to living allies that has a <Custom Apply Effect> which regain Hp to those affected by it and then disappears. What do you think is this way or is there a more PRO to do this effect?
ok regarding the above, it was a mistake, the life that the allies gained was due to a battle event, that is, it did not work. I tried to re-reforge it and this is what I did
Code:
<Custom Establish Effect>
if (target.result().critical && value > 0) {
hpHeal = Math.ceil(value * 0.15);
var targets = $gameParty.aliveMembers();
for(var a = 0; a<targets.length;a++){
targets[a].gainHp(hpHeal)}
};
</Custom Establish Effect>
but only the user is filling the HP, can someone help me?
Code:
<Custom Establish Effect>
if (target.result().critical && value > 0) {
hpHeal = Math.ceil(value * 0.15);
var targets= $gameParty.aliveMembers();
for(var a=0;a<targets.length;a++){
targets[a].gainHp(hpHeal);
targets[a].startDamagePopup();
targets[a].clearResult();
}}
</Custom Establish Effect>

Well these are the advances in this, the allies if they were restoring their hp but they did not show the popup. so now I would like to make that instead of restoring hp in percentage to damage caused it is this way:
hpheal = x% of the actor's hp healed with a maximum of 100, and a minimum of 10.
I don't know if the minimum is necessary but it wouldn't hurt to know how I could do this.

Original thread: https://forums.rpgmakerweb.com/threads/drain-life-when-you-land-a-critical-hit.130591/