Reduced HP drain

The HP drain damage type in the skills tab allows the caster to absorb the amount of damage dealt. This would be OP for what I want, so I would like to be able to have e.g. 50% or 25%. I have played around with the damage formula and as far as I can see, I would have to specify the damage calculation, then have something like a.hp += (that damage times 0.5). However, I can't get my head around the syntax.

Can anyone enlighten me?

Thanks.
If you are willing to use a script, I recall Yanfly has one for HP and MP drain where you can set a skill to heal x% of the damage dealt. Maybe that will do what you want?

Edit: It's Yanfly's Convert Damage script. I don't have a link to it saved, but I was able to look up the name for it in my project.
@bgillisp Thanks for the suggestion, I'd forgotten about that script.
To be honest, I'm reluctant to import a whole script just for one skill, so would prefer to do this by damage formula if possible. I know that I might have to create a custom damage mini snippet if it's too long for Ace's damage formula box.
Drain using the damage formula box will be something like this
Code:
d = <damage formula>;a.hp += (d * 0.5).to_i; d
Remember, by doing this though, variance is not applied, and if you're using damage popup, the drain popup will not be shown.

Edit: Fixed the formula
@TheoAllen That is precisely what I was looking for. I knew it was something like that, but couldn't get it right.

Thank you so much! Much appreciated.

Original thread: https://forums.rpgmakerweb.com/threads/reduced-hp-drain.91373/