Battle Ends after enemy transforms

So I'm trying to set up a capture type system where if the enemy has < 25% a status will effect them and they'll transform into a version of the monster inside a net. But any way I try to end the battle, the battle ends before the monster transforms.

How can I end the battle after the enemy transforms?
First thought I had was to give the enemy immortal status.

But other than that... there's too little information in your post for me to gauge what your situation is. Please show us screenshots of what you currently have. Please try to follow this template, as it will save a lot of guesswork.
Another shot in the dark: Are you transforming the enemy and then immediately ending the battle? If so, maybe try a wait after the transform so it can actually happen.
If the HP >1 at that moment, then the problem cannot be solved with the immortal state as that is only for the case with HP=0.

We need to see a screenshot of the troop event to check what went wrong in your case, most likely it is a wrong order of commands.
and a screenshot of both the regular enemy page and the enemy page in a net.
This is my original enemy
1740369130948.png

This is the enemy trapped
1740369169156.png

This is the troop screen
1740369260527.png
Hmmm? AFAICT, what happens on the third page is that:

If the enemy has 25% HP or less...
...some text occurs...
...a force action is reserved... (which in case you are using Visustella Battle Core, will only be processed at end of turn)
...some switch is flipped...
...and the enemy dies...

This (kind of) all happens at once, and with the enemy dying the battle will end.

What I'm missing is, where are you transforming the enemy? Is that what is supposed to happen with Switch #1?
So the player uses a skill called "weighted net"
1740420796299.png


That brings up a common event called "Ferox Trap"
1740420858433.png

"Ferox Trap checks the HP of the target and if it's less than or equal to 25, the skill causes a state called "Trapped" and transforms the enemy into "Ferox Trapped" which is the enemy trapped in a net.
the order of commands is correct, it should have worked.

so the next stop is seeing if there are any plugins messing with the sequence - can you post screenshots of your plugin manager to see what you have and in which order?
the order of commands is correct, it should have worked.

so the next stop is seeing if there are any plugins messing with the sequence - can you post screenshots of your plugin manager to see what you have and in which order?
I actually dont use any plugins. At least not at the moment.
Then the problem is likely in the timing of the command and its graphic updates.
and that needs someone with more knowledge about the internal code of MZ to find out.

you can try if a wait(5) after the transform but before the change state solves it, but otherwise I'm at the end of my ideas, it'll probably need a script command to foce a display update.
Your event seems to check the value of a variable named "Enemy HP". But variables only update their value when you tell them to, and Parallel/Autorun events do not run during battle.

So it looks like you need to add a command at the start of the event to store the current HP of Enemy #1 in that variable before its value is checked: Control Variables -> Set -> Game Data -> Enemy -> HP.

(You could also use Show Text commands to test which branches are actually running.)

Edit: I had a look at the code and it looks like Force Action will only pause the interpreter until the action has started. So I think, without any delay after Enemy Transform, the battle will reliably end 2 frames afterwards? (1 to start the troop event, 1 to finish the stuff after Force Action.) Like Harlekin etc have suggested, try adding wait time or something equivalent (e.g. Show Battle Animation with "Wait for Completion", or Show Text) after the transformation.
So before, I had the wait in my Troops event for that fight. I changed it to the common event and that worked. The battle now ends after the enemy transforms 🙂


1740433293716.png


Thank you all for your time and help.

Original thread: https://forums.rpgmakerweb.com/threads/battle-ends-after-enemy-transforms.175775/