Is there a way to call a common event after a random encounter?

Okay, first off, hi. 

Secondly, I've been trying to figure out how to call up a common event after a random encounter but have had no luck so far. I feel like I'm missing something. Is there any way at all to call up a common event after a random encounter? Like a script call or a conditional branch or anything like that.

The common event I'm using relies on the entire party being defeated so it will send them back to a predetermined location and take away one 'life' basically. This common event should (in theory) take away the game over thingy until all lives are lost, after which the player could be defeated and game over for real. 

How would I actually get that common event to run when the party is defeated rather than jumping straight to the game over screen after a random encounter?
If the entire party is defeated, you would not return from battle in order to run a common event. It would be game over before the battle has even ended.


What you need is a plugin to change behaviour on party defeat. Have a look at the plugins, and the plugin requests - I know there have been one or two requests for something like this, and there may be a plugin already that does it.
I knew I was missing something...

Thanks for the answer though! It helps out a lot!

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-call-a-common-event-after-a-random-encounter.51971/