Help with damage formula for MP transfer skill

Trying to create a skill that does the following:

1) Transfer 50% of current MP to an ally.

I know this can be done with a simple damage formula but I'm not sure where to change/what to add?

var h = a.mp * 2 - b.mdf, m = 2*h; a.gainMp(-m); b.gainMp(m); a.gainMp(-m); h

I'm using the YEP library, so if there's a simpler way than creating a damage formula, I'm here for it.
I'm using the YEP library, so if there's a simpler way than creating a damage formula, I'm here for it.
you actually could get away with just using the MP cost tag with the skill core.

make it cost 50% of the user's current mp
Code:
<Custom MP Cost>
cost = Math.ceil(user.mp/2);
</Custom MP Cost>
and then just have the formula be the user's current mp.
Code:
a.mp
since the formula would have only been ran after the skill cost has been paid, its going to be half of the mp the user had at the time the command was chosen

Edit:
otherwise, this'd also do it, but without relying on the mp cost
Code:
<After Eval>
var mp = Math.ceil(user.mp/2)
user.gainMp(-mp);
target.gainMp(mp);
</After Eval>
the skill will need to not have a damage formula or cost
you actually could get away with just using the MP cost tag with the skill core.

make it cost 50% of the user's current mp
Code:
<Custom MP Cost>
cost = Math.ceil(user.mp/2);
</Custom MP Cost>
and then just have the formula be the user's current mp.
Code:
a.mp
since the formula would have only been ran after the skill cost has been paid, its going to be half of the mp the user had at the time the command was chosen

Edit:
otherwise, this'd also do it, but without relying on the mp cost
Code:
<After Eval>
var mp = Math.ceil(user.mp/2)
user.gainMp(-mp);
target.gainMp(mp);
</After Eval>
the skill will need to not have a damage formula or cost
thanks!

That was a lot simpler than I thought!
This thread is closed due to being reported as solved. If you need it reopened, report it to let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/help-with-damage-formula-for-mp-transfer-skill.174800/