How to retain HP/MP before and after a fight.

I'm trying to make an event NPC sparring enemy. In this case, a common town guard that the player can ask to spar with and test out their skills on.

Is there a way to retain HP/MP before and after fighting this NPC?
Like if the player fights with their character at 250/300 HP, no matter how much damage you receive win or lose, you always go back to being at 250/300 HP after the fight.
Define 2 variables: one for HP and one for MP. set the HP variable to game data: Actor's HP, and the MP variable to Actor's MP. Save these numbers at the beginning of the sparring event (you can do this in the event itself, or in a common event triggered when the spar event starts).

Once the fight event is over, you can Change HP (player) -9999, then + the HP variable. Same for MP. This effectively reduces HP and MP to zero, then adds the value you saved in the two variables before the sparring event begins.

Your character's HP and MP should return to the values before the sparring started.

EDIT: I use VX Ace, so I don't know the exact settings names for MV, but the principle should be the same.
Define 2 variables: one for HP and one for MP. set the HP variable to game data: Actor's HP, and the MP variable to Actor's MP. Save these numbers at the beginning of the sparring event (you can do this in the event itself, or in a common event triggered when the spar event starts).

Once the fight event is over, you can Change HP (player) -9999, then + the HP variable. Same for MP. This effectively reduces HP and MP to zero, then adds the value you saved in the two variables before the sparring event begins.

Your character's HP and MP should return to the values before the sparring started.

EDIT: I use VX Ace, so I don't know the exact settings names for MV, but the principle should be the same.
I'll give it a try. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-retain-hp-mp-before-and-after-a-fight.144150/