Improve YEA - Enemy Death Transform

I am using YEA - Enemy Death Transform
It provides one way only.It reads the note in database to decide which enemy will be transformed.
I want to transform enemy according to a variable.Just like the below.

In game,enemy 1 is Slime,enemy 2 is Spider,enemy 3 is Dragon.
Before a battle,I set that $game_variables[x] = 2

During the battle,Slime will transform to Spider when Slime die.
At the same time,I set that $game_variables[x] = 3

And then,Spider will transform to Dragon when Spider die.
At the same time,I set that $game_variables[x] = 0
Finally,Dragon die and win the battle.

Can any friend help me please?
I don't want to use event.Please help me by script.Thank you.

p.s. English is not my first language .So that my grammer is not good.Forgive me.

Original thread: https://forums.rpgmakerweb.com/threads/improve-yea-enemy-death-transform.119590/