Spells with alterable mp cost/power

Hi,

I'm looking for a script to make spells with alterable mp cost.
For example, let's take a simple heal spell. When casting the spell, a new window could open
where the player could choose how much mp he/she would like to spend (from 1 to maxmp),
and for each spent mp the spell would heal 4hp. So the player could choose if he/she
wants to spend 1mp to heal 4hp, 25mp to heal 100hp or 200mp to heal 800hp.
Same with attack spells, like Fire, deals 1 damage per 1mp to a single enemy.
Thanks in advance.

Original thread: https://forums.rpgmakerweb.com/threads/spells-with-alterable-mp-cost-power.15144/