Saving enemy's HP status after a lost battle.

Let's say we're having a 1vs1 battle. Let's also say that the player has lost the battle. Is it possible to save the information of enemy's remaining HP and make him start the next battle (after the player came back) with the exact same HP amount?

Don't read the next part if you already have an idea for the problem above

So maybe the reason why I need this could be helpful:
In my game there are only 1vs1 battles, but, you can have a bigger team than that. I've made this by limiting possible battlers to one. So the only way I could use the next battler is by starting the same fight again. But I think that would be better if the enemy would not reheal himself.
If it's not possible, I can always make the enemy say "use another one, while I recover myself!" but it's obviously a worse option...

I prefer not to use plugins but if there is no other way I can think about that.
it is possible with Olivia's Meta Control Switches (which is for MV 1.6.1 or higher,
no garanteed when below it.

if you use an earlier version, this might not work (probably untested), so you need
to find an alternative plugin.

while it is possible, I do not know how exacly it is done, while I saw it in a game,
it probably trigger a meta switch when the party died, so the enemy HP remain
while the party has full HP (probably with some eventing included).

the game is meta statis in case you want to figure it out on the boss,
you can loot all 3 chests, but this is a very unque feature compared to saves,
so you might need 2 saves in order to make it work.

I dont know if there is any other way though, not that I'm aware off.
I'm not in front of RPG Maker at the moment, but it seems totally doable.
Create a game variable "current enemy HP" and update it via the troop commands on every turn.
Then you could have a troop command that checks that variable when the battle starts and
then use the "set enemy HP" event command (at least - I think there's one, I know there is for players) to set the enemy health to the value of that variable. If there isn't an event command, there's surely a script call for it....but I don't know what it would be off the top of my head :-(

The only issue I see with the above is that if the player could go fight someone else between fights.
That all depends on how the fights are happening. In such a case you might need to use multiple variables which could turn in a management nightmare.
Two things here: you want to store the enemy's HP, then you want to reapply it.
  • Store: Control Variables > Game Data > Enemy allows you to reference data on the enemies in the most recent troop faced this play session. That means you can set up your boss event like this:
    Code:
    ◆Battle Processing:Minotaur
    :If Win
      ◆Text:None, Window, Bottom
      :    :Congratulations, you won the game!
      ◆
    :If Lose
      ◆Control Variables:#0001 bossHP = HP of #1
      ◆Text:None, Window, Bottom
      :    :The boss still has \v[1] HP remaining!
      ◆
    :End


  • Reapply: like poorrabbit suggests, there's a Change Enemy HP command. If you have the enemy's current HP stored in a variable, you can do something like this on battle start (troop event with Condition: Turn 0, Span: Battle):
    Code:
    ◆Comment:Convert current HP to (max - current)
    ◆Control Variables:#0009 bossHP *= -1
    ◆Control Variables:#0009 bossHP += Max HP of #1
    ◆Comment:Do that much damage to that enemy
    ◆Change Enemy HP:#1, - {bossHP}
caethyril !!!
Thank you very much! It works! Although I had to put a conditional branch so it would change the Enemy's HP only in case of a second fight.
Anyway, you're my hero. I've already read some of your advices at steam community.

Original thread: https://forums.rpgmakerweb.com/threads/saving-enemys-hp-status-after-a-lost-battle.130833/