[RPGMMV] I want MP to recover fully after a battle. How do?

Basically, I'm going to try to make a game in which MP auto-recovers to full after a battle. There won't be any healing spells in order to offset this, you'll have to use items or sleep in an inn to recover HP.

I presume I'd use a Common Event with "Change MP : Entire Party, + 9999" that triggers only when a battle ends, but I've no idea how to do that part. Anyone know how to do something like that?

(I'm also planning to make it so the Guard action recovers some MP, but that's beside the point; I think I can figure that one out.)
There is an event command called "Recover all" place this after the battle has concluded.
Anyone know how to do something like that?
Screenshot_2.png

There is no auto-recovery beyond this, unless you make a custom plugin for it.
The difficulty with this is that there's no "combat ended" state that I can recall - it branches into multiple different battle end cases, from "Game Over" in combat, to a battle result where you escaped, to a battle result where you lost but the game didn't end as well as a victory case.

(Even the Yanfly Utility Event plugin does not feature conditions for the different end combat states. They'd have to be manually added via plugin to make it possible to inject a common event there.)
there is a way to trick a common event to run after each battle, but you need to know how the engine works to do this.

Parallel processes run only on the map, not in any screen - including battlescreen.
so you create a common event set to parallel process and conditioned to a switch "battle-end".
Inen add whatever commands you want to happen after battle.
after all those commands, add control switch "battle end" OFF to prevent it from repeating.

last step: in every battle add "control switch battle end ON" at turn zero

(a plugin for a base troop event helps with that)

and because a parallel can't run during combat, it will only run after combat even if triggered on turn zero of combat.
Andar's solution is pretty much what I was about to suggest.
there is a way to trick a common event to run after each battle, but you need to know how the engine works to do this.

Parallel processes run only on the map, not in any screen - including battlescreen.
so you create a common event set to parallel process and conditioned to a switch "battle-end".
Inen add whatever commands you want to happen after battle.
after all those commands, add control switch "battle end" OFF to prevent it from repeating.

last step: in every battle add "control switch battle end ON" at turn zero

(a plugin for a base troop event helps with that)

and because a parallel can't run during combat, it will only run after combat even if triggered on turn zero of combat.
That's not a bad work-around. You just need Yanfly's plugin:

Do keep in mind, though, that parallel processes also run parallel to events, which means whatever you enter as input will be launched regardless of what your event is doing, but the priority of commands in the interpreter will retain their index.

What that means is basically: things that can be done simultaneously to the event running the battle will happen - things that cannot will run afterwards.

If your common event has:
* A Heal SFX
* The MP recover command
* A Message saying "Your MP has recovered!"

The heal SFX and the MP recovery will happen the moment you exit combat - the message with the healing will only appear *after* the currently active event is done.

So if you have any post-combat conversation after the fight is over, you'll get the mp recovery and sound effect right away while listening to your opponent talking about how he was defeated, and only when the conversation ends will the message "Your MP has recovered!" appear. So avoid messages and similar things, or they'll be out of sync.
Consider using https://mrtrivelrpg.wordpress.com/2016/03/15/restore-hpmptp/ (alternate link: https://mvplugins.com/plugin/MrTrivel/Restore HP MP TP). I'm using it to do the opposite - to completely restore HP and set MP to 0 after battle. In my game, each battle is self-contained, and MP regenerates per turn, so in the Notes for all my actors I've put
<RestoreAfterBattleHPPercent: 1.0>
<RestoreAfterBattleMPPercent: -1.0>
In your case it would be
<RestoreAfterBattleMPPercent: 1.0>
Thank you all for your responses. I'll think about my options!

Original thread: https://forums.rpgmakerweb.com/threads/rpgmmv-i-want-mp-to-recover-fully-after-a-battle-how-do.124319/