Resetting magic to 50% before battles.

So I'd like to have the game reset each actor's magic to 50% of their max at the beginning of each battle.

The actor's regen magic throughout the battle allowing them to use weaker skills over and over but they would have to save up MP to cast more powerful spells.

Anyways. The core game doesn't allow anyway that I can see to reset an actor's magic to anything other then max, or to gain a set amount.

Is there any scripts that allow this? Or perhaps some cleaver events that would allow an actor to rest their MP to 50% of their max at the beginning of each battle?
There is actually a trick to do this:
You can either reduce the MP to 0 first and then increase it to the amount you want, or you can increase the MP directly by that amount minus the MP the actor already has:

Control Variables : #0017 Difference = Max MP of Actor
Control Variables : #0017 Difference /= 2
Control Variables : #0017 Difference -= MP of Actor

Change MP : Actor, + {Difference}
You can also use those script lines if you don't want to use variables:

$gameParty.members().forEach(function(m){
m.gainMp(m.mmp);
var half = Math.round(m.mmp / 2);
m.gainHp(-half);
})
You can also use those script lines if you don't want to use variables:

$gameParty.members().forEach(function(m){
m.gainMp(m.mmp);
var half = Math.round(m.mmp / 2);
m.gainHp(-half);
})

I like the idea of this, unfortunately I'm not sure how I'm supposed to implement this. Currently I'm using this at the beginning of the battle, so that it only activates once per battle, but it doesn't seem to be doing anything. Am I supposed to add my party member names with in the parenthesis after $gameParty.members() ?

My scripting skills aren't very good at the moment.
Sorry, it seem I made a typo. The last line should be read m.gainMP(-half) and not gainHp...
Just change the H for a M and trigger it at the start of battle as you did.
Sorry, it seem I made a typo. The last line should be read m.gainMP(-half) and not gainHp...
Just change the H for a M and trigger it at the start of battle as you did.

Oh it worked! Sa-weet! thank you!
Good!

Original thread: https://forums.rpgmakerweb.com/threads/resetting-magic-to-50-before-battles.115421/