Replace Gameover

I would like to know how i can replace the scripts in BattleManager that sends me to the title screen when my party dies from random encounter, by teleporting the party to an inn instead.
I have looked for it but i found mostly stuff for MMV and not XVA
Did you tried out this one?

Original thread: https://forums.rpgmakerweb.com/threads/replace-gameover.153005/