How do I calculate MP before skill use?

Hello,

I am using Yanfly's Skill Core script (as you can see in the Note section).

I want this skill to perform as written in the description - restore the party's HP based on the user's remaining percent of MP. I have the MP cost setup as all remaining MP (it defaults the cost to 1 MP if MP is at 0 so it can't be used at 0 MP).

The problem is this, when using the skill in battle, the MP cost is spent before the damage formula is applied. Since this particular skill requires all MP, it winds up restoring 0 HP.

How can I have the game spend the MP after applying the formula?

Thanks in advance.

[IMG]http://i.imgur.com/7Qc768K.png[/IMG]

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-calculate-mp-before-skill-use.48274/