use troop events, that is exactly what they were intended for.
one of the conditions for troop events is the enemy HP, so you cen set a troop event to trigger on that enemy death and then have it do whatever you want, including killing or escaping all other enemies to win the battle.
EDIT: OK, I didn't see XP and I don't know if that option was already part of the makers back then, but it should have been.
Yep, it is certainly a function to measure the enemy's HP, however I am interested in knowing how I can create a chain effect from its defeat that results in the death of the other enemies, with which the battle ends and the normal process begins.
Not that it simply aborts it as shown in the image.
I admit that I have no knowledge of Script and I do not know how the code works to alter the HP of the remaining enemies.
EDIT
I'm trying to replicate an attack system where you can attack enemy parts like in Fear and Hunger for specific enemies. For example, the idea would be to finish off his head and this would mean that the battle would end as if it were an Exodia from Yu Gi Oh.
But the question here is... if this is possible to execute with the capabilities that XP has, I tried to do it a while ago but only managed to continue the battle without its head