MZ How do I respawn an enemy after it dies in battle?

I tried looking around elsewhere on the internet before coming here and I keep seeing how to make respawning enemies on the map, but not mid battle.

I want to have a boss fight where the player has to beat it a few different times (unsure of exactly how many at the moment but I digress) to win the fight. Currently in the troop events, I have 6 pages set up. One triggers at the beginning of the battle to give the immortal status to the boss and turn on Switch 1.

The other 5 pages go from Switch 1 to 5 and require their respective switch being on along with the boss's HP reaching 0 to trigger. Once the heal to full triggers on page 1 lets say, switch 1 will be turned off but switch 2 will be turned on to trigger page 2, all the way to page 5 which removes the immortal status. Issue is, it does the heal once, and skips to the immortal status removal and it dies after reducing it's HP to 0 twice.

Added screenshots so y'all can see exactly what I've got. And the variable and text window are to help me see what kill its on for debug purposes.


Spoiler: Troop Event Screenshot
1.png
2.png
3.png
4.png
5.png
6.png
Two possible errors I can see.

first, you messed up your numbered switches beginning with page 3 - the later switches were NOT turned off, allowing the sequence to be disruoted.

second, I don't know if the span = battle is correct here. once the switches are configured correctly and if it still doesn't work, you should try span = turn
If the phoenix has any hit points, the conditions on pages 1 through 5 will not trigger and it will go to the next page.
I think the 'Enemy Recover All' command removes all states, so you just need to re-add the immortal state after every recover all command.
Or you could replace the 'Enemy Recover All' command with a change enemy hp command. Either should work.
I think the 'Enemy Recover All' command removes all states, so you just need to re-add the immortal state after every recover all command.
Or you could replace the 'Enemy Recover All' command with a change enemy hp command. Either should work.

Well, one thing is for sure, it will restore the boss's hit points, which means the other states will never trigger.
So I got it working now!

Two possible errors I can see.

first, you messed up your numbered switches beginning with page 3 - the later switches were NOT turned off, allowing the sequence to be disruoted.

second, I don't know if the span = battle is correct here. once the switches are configured correctly and if it still doesn't work, you should try span = turn
It was a combination of the switches not being set up properly


I think the 'Enemy Recover All' command removes all states, so you just need to re-add the immortal state after every recover all command.
Or you could replace the 'Enemy Recover All' command with a change enemy hp command. Either should work.
And the recover all command removing the immortal state. I changed it to add the immortal state after the recover all (minus the last page) and it works now

Thank you guys!

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-respawn-an-enemy-after-it-dies-in-battle.178461/