Changing Game Over into Respawn Help

I want to eliminate the Game Over function altogether. No game over on death. Something similar that Stardew Valley does, but instead of one specific location, the respawn location would be in a stored variable. I figured that part out with variables RespawnX, RespawnY, and RespawnMap. The part I'm struggling with is removing the Game Over screen and setting up the teleport itself.
I'm terrible with code, but I am trying to learn so that I can do more on my own without always asking for help (which is why I try not to use plugins that others have made to do all the work for me). I took a deep delve into the Scenes js file to try modifying some things in the hopes of learning how certain code functions. I modified a small section to try and generate a choice option for testing purposes. It didn't change anything, game over screen still happened. I went looking even further into the file and saw a huge section for Game Over function that I honestly have no idea where to even begin modifying. I also was scared that just deleting that entire Game Over section would break the game somehow (I do have a backup of the original, unedited file just in case, and the one thing I did remove to test something did end up breaking the game XD).
I saw an option I could do is just make every fight one that you can lose, and just have the lose condition teleport the player....but the problem becomes that it brings the player back to the original screen where the fight started, THEN teleports them, and it looks choppy, weird, and trash. What I want is for the screen to fade out like normal, but instead of playing the game over screen, it fades back in to the player's saved respawn location.
I honestly, legitimately thought this wouldn't be too difficult to do....but, I guess I should have figured that it wouldn't be easy either.
Spoiler: Modified Code, Line 286
Code:
Scene_Base.prototype.checkGameover = function() {
    if ($gameParty.isAllDead()) {
        $gameMessage.setChoices(['Respawn', 'Title_Screen'], 0, -1);
        $gameMessage.setChoiceBackground(0);
        $gameMessage.setChoicePositionType(1);
        $gameMessage.setChoiceCallback(n => {
        $gameVariables.setValue(1, n);
        });
        this.setWaitMode('message');
    }
};
Use this and then link it to a common event that does the map transfer
Use this and then link it to a common event that does the map transfer

make sure in plugin options you turn "show game over screen" to false

kath.png
SRD also has a custom game over plugin
I appreciate the assistance, though I was looking for more direct help rather than just use a plugin. I want to try and understand better what I'm doing, and using plugins just feels more like a "Just use this instead of learning" kind of thing. Plus this isn't for anything super serious, just a testing of mechanics and such I want to try out. Now if absolutely needed, I will use the plugin, but I'd rather focus on actually learning from the help I get (unless of course this is just something far too complex to simply help out with and a plugin would be better).
That said, again, I do appreciate the help and thought for it, it's nice that people are willing to help out.
It's not a matter of it being too complex. There are things you simply cannot do without a plugin. If you want to interrupt or change how an automatic game process works, such as what happens when the player dies, you need a plugin.

A plugin is code that overwrites an engine process, or adds new variables/functions etc you can call in the game
HIME_GameOverEvents can set an event instead, so you have more control.

otherwise, a Game_Over can just use the variables back to town, not the
Scene_Base function.

if it's always fixed, you can alter that to tranfer the player rather than going
to Scene_GameOver which is better way to do it 🙂
Double-post notice: @ubiquitous
It's not a matter of it being too complex. There are things you simply cannot do without a plugin. If you want to interrupt or change how an automatic game process works, such as what happens when the player dies, you need a plugin.

A plugin is code that overwrites an engine process, or adds new variables/functions etc you can call in the game
Ohhh, okay. I didn't know that beforehand. I thought plugins were just prebuilt code that someone made for others to use, instead of doing the code themselves. Kinda like a "hey, if anyone is looking for this function, I made a code you can use". I didnt know that plugins were required for certain functions to work.
HIME_GameOverEvents can set an event instead, so you have more control.

otherwise, a Game_Over can just use the variables back to town, not the
Scene_Base function.

if it's always fixed, you can alter that to tranfer the player rather than going
to Scene_GameOver which is better way to do it 🙂
The location wouldn't always be fixed. It'd be where the player decides to set the respawn, similar to a bed in Minecraft.

Well, if this absolutely requires a plugin, I'll take a look into these options later on. Today is gonna be a bit busy for me and this is something I want to have full concentration on when I do. I appreciate everyone's help.
I thought plugins were just prebuilt code that someone made for others to use, instead of doing the code themselves. Kinda like a "hey, if anyone is looking for this function, I made a code you can use".
Sometimes they can be. Some plugins are just blocks of code defining new variables or functions as I've stated before. Technically you could declare them in the game and then use them without a plugin file but it wouldn't be declared automatically and requires the user to declare it manually.
Sometimes they can be. Some plugins are just blocks of code defining new variables or functions as I've stated before. Technically you could declare them in the game and then use them without a plugin file but it wouldn't be declared automatically and requires the user to declare it manually.
Okay, thank you for the help then. I'll give the plugins a try and see which one works best for me later. For now I must attend to responsibilities like a normal adult lol
than HIME_GameOverEvents would be ideal, because it replaces the
GameOver scene.

from that scene, you can place a map or something, or a choice menu.
so you can transfer the player where ever you want to sent them.
than HIME_GameOverEvents would be ideal, because it replaces the
GameOver scene.

from that scene, you can place a map or something, or a choice menu.
so you can transfer the player where ever you want to sent them.
So I created a room for the player to be teleported to play out an event that teleports the player from there, to the saved variables location (for testing purposes I specified a place in the "desert"). I did the test battle, I got KO'd, the screen fades. A few seconds pass and then I get an error.
Spoiler: The Error in Question
1740631654150.png

When I tested the plugin out by making the player specifically teleport to a certain room, no issue. I tried using a game variable in the plugin, and it simply teleported me into the void. Then I set the plugin to specifically teleport the player to MapID 6 ( a room that is completely blank) with an event that Autoruns to teleport the player. However, upon death, I got the error message.
Spoiler: The teleporting Event
1740631591959.png

Not sure if I skipped a step I needed to do, or if I might just be unable to use this the way I want. To maximize help, here is the room I have the teleport event sending the player to. All but one of these events require interacting with it to trigger, and that single event that doesn't is a parallel process event that adds some items to the player's inventory before self switching off.
Spoiler: Room Teleporting To
1740632370024.png
how did you get that error and how is your 3 variables defined?
as it isn't given there.

if you make portals where the player can walk too, you can define
variables there before transfer to any town they wish or current place,
which should be set by default when entering that map.

but to get the error cause, press F8/F12 to open the console, and see
what it causes on the console tab for the error.
how did you get that error and how is your 3 variables defined?
as it isn't given there.
I honestly don't know how. As stated, all I did was create a new map with no changes to it. A bare basic default map, set the plugin MapID to match that map. After that I added an autorun event that teleports the player to the variable location. I did the test battle like before, I got defeated, the fade out happened, then about 3 seconds later the error occured. Below are what the variables are set to.
RespawnMap = 1
RespawnX = 7
RespawnY = 13

Currently it's a battle Event that is set up with to autorun (to just quickly test out things), so I wonder if that might be what's causing the issue, but I didn't have a problem before I added the teleport map and event.......I'm so lost and confused x.x Here's the event that's starting the battle, just in case it's relevant.
Spoiler: Battle Event
1740666453494.png
if you make portals where the player can walk too, you can define
variables there before transfer to any town they wish or current place,
which should be set by default when entering that map.

but to get the error cause, press F8/F12 to open the console, and see
what it causes on the console tab for the error.
I'm gonna be honest, nothing makes sense to me in this log ._.
Spoiler: The Error Log
1740666365165.png

EDIT: I removed the teleport event on the default map and it works fine ._. So I don't know what about that event is breaking my game, but it's clearly that specific event.
you need console, not elements
you need console, not elements
Okay so I figured out what was wrong. When I created this post, I said I modified some of the js code in hopes of figuring out on my own how to get this idea to work. I only JUST realized I never restored the original js file while using this plugin. Once I did that and modified the event itself to restore all HP and remove Knockout state, it works as intended! I discovered this because looking at the console I saw the "Scene_Base" in it and remembered I modified the scenes but never restored the original, unedited file XD

Thank you for the help guys, I really appreciate it.
I modified the scenes but never restored the original, unedited file XD

This is why you use a plugin.

Plugins are not something to be avoided for whatever given reason. The engine was designed specifically to be extended by plugins.

You never edit a core script method like you were doing. You copy that method, drop it into a text file, save it as a .js, and put it in your plugins directly.

A plugin is as simple as that and is how the engine is intended to be utilized.
This is why you use a plugin.

Plugins are not something to be avoided for whatever given reason. The engine was designed specifically to be extended by plugins.

You never edit a core script method like you were doing. You copy that method, drop it into a text file, save it as a .js, and put it in your plugins directly.

A plugin is as simple as that and is how the engine is intended to be utilized.
A lack of knowledge certainly contributes to silly decisions like what I made. I was at least smart enough to back up the file first before toying with it. I'm grateful to the community for helping me get a better understanding of what to do.

Original thread: https://forums.rpgmakerweb.com/threads/changing-game-over-into-respawn-help.175822/