How do I...make a skill that takes 25% of the users's current MP, and give that to the chosen ally?

Title.

Basically, I have a character that can give his own MP to other party members since they have a lot of it. Is there a way to do this? I don't see how I can directly perform this sort of operation from the default skills tab alone.
So, this requires a little more than just using the default interface, because you have to fetch whose turn it is. The first thing you can do is set the skill to target an ally, and make it a skill that recovers MP. The formula is just going to be a.mp / 4.

what you'll need to do is call a Common Event.

Set one variable to the ID of the current actor (this is the fancy part). Set the variable to a Script value.

I think this is the syntax:
BattleManager.actor().actorId()

Now set another variable to the caster's current MP (easy part). Now divide that number by 4.

Now do a change mp on the actor, using that variable to select the actor. Reduce their MP by the amount of the second variable.
If you happen to use Yanfly's Skill Core, this should be very easily doable with a notetag or two.
So, this requires a little more than just using the default interface, because you have to fetch whose turn it is. The first thing you can do is set the skill to target an ally, and make it a skill that recovers MP. The formula is just going to be a.mp / 4.

what you'll need to do is call a Common Event.

Set one variable to the ID of the current actor (this is the fancy part). Set the variable to a Script value.

I think this is the syntax:
BattleManager.actor().actorId()

Now set another variable to the caster's current MP (easy part). Now divide that number by 4.

Now do a change mp on the actor, using that variable to select the actor. Reduce their MP by the amount of the second variable.

Thank you for helping me!! But I need some more help.
Can you please clarify the part where you set the 1st variable? I can't set it to both the ID of the current actor, and the script value at the same time. Did you mean 2 variables?

If it helps, my team member who is doing this skill is actor #4 in my database
The first variable is the ID of the current actor. The second variable is used to store the actor's MP, and modify it for the change.

EDIT: If Actor #4 is the only character, and the only being in the game, who uses that skill, you can skip the fancy part. You don't need to get their ID. In the common event you use, you can just set a variable to their MP, divide it by 4, and reduce Actor 4's MP by that amount.
The first variable is the ID of the current actor. The second variable is used to store the actor's MP, and modify it for the change.
Ah alright, I think it was just the way I inserted the Syntax. But it works perfectly now, thank you pawsplay!
If you want it to display properly as a cost when you're selecting the skill in the menu, you'd use Yanfly's Skill Core.
Code:
<Custom MP Cost>
user.origMp=user.mp;
cost=Math.round(user.mp*.25);
</Custom MP Cost>

Then in the MP Recover damage formula you just put a.origMp

Eliminates any need for variables, common event, etc.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-a-skill-that-takes-25-of-the-userss-current-mp-and-give-that-to-the-chosen-ally.160538/