MZ Need help with enemy transform.

So basically, I'm trying to make it so after all enemies except the one first in the troop is dead, it will transform that first troop into a different enemy. I'm stupid and couldn't figure it out after like two hours of trying.
Put troop events for the other enemies that activate when their hp is 0 and add +1 to a variable. Those also have a conditional check that if the variable is equal to the number of the other enemies, then turn a switch ON. Then you have another troop event page that checks when that switch is ON, transforms the first enemy and turns the switch OFF.
Thanks for the advice! Already figured it out though!

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-enemy-transform.180002/