- Joined
- Feb 12, 2016
- Messages
- 154
- Reaction score
- 44
- First Language
- English
- Primarily Uses
- RMMV

So here I have a variety of tutorials! If you have any questions, concerns, comments, or feedback; then feel free to post 'em! If you use the tutorial, remember to like the thread!
Game Over events; That is adding stuff to happen on a game over that is not the original go to title screen ...
So I am going to explain how to modify the game over function in RPG maker MV to add respawning or maybe more!
You are going to need to have a very basic understanding of JavaScript or the ability to add a plug-in. This is a beginner tutorial, so if you have any questions, feel free to ask!
In my game when the player dies it takes them to a new map and offers them three choices: pay a lot of money and respawn where they died, Pay a little money and respawn in town, or pay no money and it delete their save. And this is all done by percentage!
We are going to look at how to handle this in the game over scene and stuff!
So here is what you need to do:
//// SceneManager.goto(Scene_Title); // Invalidate but leave a reference to the original function
$gameScreen.startFadeOut(1); //Make everything dark...NOW!
$gameTemp.reserveCommonEvent(005); //Run Common event 005
SceneManager.goto(Scene_Map); ///Let the player go back to the game...
}; “
[*]
The other way of doing this is by grabbing the “Kath_Gameover” plugin and setting it’s parameters to whatever event you want.
[*]
The tutorial works for either choice of method. But again IF YOU DO NOT KNOW HOW TO CODE, USE THE PLUGIN OPTION! I am not responsible if you break your rpg_scences.js file!
Now onto the tutorial
You are going to need to have a very basic understanding of JavaScript or the ability to add a plug-in. This is a beginner tutorial, so if you have any questions, feel free to ask!
In my game when the player dies it takes them to a new map and offers them three choices: pay a lot of money and respawn where they died, Pay a little money and respawn in town, or pay no money and it delete their save. And this is all done by percentage!
We are going to look at how to handle this in the game over scene and stuff!
So here is what you need to do:
So first we need to change some stuff in the game to override and modify the base game over scene. This can be done in two ways. First you can modify the rpg_scences.js file like I did or use the plug-in "Kath_GameOver" by McKathlin; these essentially do the same thing.
However, I have a lot of programming experience and am comfortable in modding game engine source files; THIS CAN BE EXTREMLY DANGEROUS and should only be done if you know JavaScript and are comfortable in doing so. I will explain how to use both ways of doing it! Personally I do not like plugins that replicate event-able or easily added script functions, But this is because I am used to other game-engines and know how to code. Any-way….
Way one is modding the rpg_scences.js file in the JS folder of your project.
Go to line 2479, it is at the end of the file. It will say “ Scene_Gameover.prototype.gotoTitle = function() { “
We want to change line 2479 to 2481 to something akin to this:
“ Scene_Gameover.prototype.gotoTitle = function() {
//// SceneManager.goto(Scene_Title); // Invalidate but leave a reference to the original function
$gameScreen.startFadeOut(1); //Make everything dark...NOW!
$gameTemp.reserveCommonEvent(005); //Run Common event 005
SceneManager.goto(Scene_Map); ///Let the player go back to the game...
}; “
This will let us run common event 005 when the player dies. It will fade out screen so we cannot see the game anymore then run event then take player back into the game.
[*]
The other way of doing this is by grabbing the “Kath_Gameover” plugin and setting it’s parameters to whatever event you want.
[*]
The tutorial works for either choice of method. But again IF YOU DO NOT KNOW HOW TO CODE, USE THE PLUGIN OPTION! I am not responsible if you break your rpg_scences.js file!
Now onto the tutorial
This type of respawning system works very well with Save Locations (explained below in another tutorial). It can be used without, but loses most of its meaning.
Create a Common Event called “Death”, in my game this is common event 005. You are going to need to remember the number that it is in your game, so make a note of it! This will be the event that is run when the player dies.
So, when the game over function is called, either by dyeing in battle or by event, it will bring up the normal game over scene, after the player clicks it or presses any button it will run common event 005 or “Death”.
If you are using the plug-in option, remember to set the plug-in to ON and the event parameter to whatever event number you picked.
So in this common event we want to add several things. First off Disable Menu Access, This is to prevent the meddling player from using the menu during our cool death scene stuff. Second we want to save the player’s location. This will be done with three variables.
So we want to add five Control Variables to the event: Position Map ID, Position X Cor, and Position Y Cor. These will be set to the players coordinates. By saving the player location we can call it again later when or if we choose to resurrect their sorry-soul!
Also, we want to keep track of how much the player dies (this can be used in other stuff, like the story!). So this Control Variable will log how many times the player has died. I call it Death Count. We want it to be on add and constant one (+= 1).
Next we want to add another control variable; this one will be called Hold Variable. I used this in my game to store random numbers. We want to set it to random 0 to 10. This lets us randomize the money loss effect slightly later on.
Then we add Death Count Variable to the Hold Variable. This will be add variable “Death Count.” This is optional, but will make each death cost just a little bit more.
All this will make more sense later when we get to the player choice options, but these are important! So it should look like so.
Spoiler

[*]
So now we are using five Variables, but remember you can also use them for other functions. So when you are writing up or adding other events or common events you can reuse these variables and it will not affect this event! This is because we change the variables when we first use or “call” them. The ones I have listed are important and can let you do a lot of other cool stuff in your game.
[*]
Next we want to add the event some dialogue, to let the player know what is going on. So I added a Show Text that says “Dude! You died!”
After this I put in a Label. These are used for a variety of things in events. I am using them as a recall locations; this is so later when we need to return to this part of the event we do not have to rewrite the whole thing!
[*]
Now we want to add another one of these to give player option of what to do. So I added another Show Text that says “So what do you want to do? Go back to where you died or go back to town? Oh, you can also just die, I guess...”
[*]
Then we want to add in a choice box to let the player choose one of the three options. We want it to have three options and disallow cancel. I made these say “Whence I roamed” and “town, Please”, but you can make them say whatever. The first choice will cost the player lots of money and the second will cost little. Now I added a third choice. This lets the player just die and return to the title screen, like a normal game-over.
[*]
We then want to fill in what happens when the player picks one of these. We will start with the first option, “Whence I roamed.”
So remember all those other variables we set up earlier? Now we use them!
This is where it gets complicated. We want to take only a percentage of the player’s monies when they choose this option. So we add another control variable, it is that Hold Variable Set then Script. Then we put this “ $gameParty.gold() * (.09 * $gameVariables.value(0005)) “ in the script. This means we will take s percentage of the player money equal to 9% times the random number plus player deaths, Don’t worry if this confuses you – essentially this means the player can never lose all of their money, but only around 10% to 30% or so percent.
Now we want to change the player’s monies. So we add a Change Gold to the mix and we change it by the variable Hold Variable.
Now, everyone in the player’s party is dead or should be dead, so we need to add a Recover all, click fixed then All Party. This way when the player respawns they are not already dead again!
Then we re-enable the menu access by adding a Change Menu Access set to enable. So the player can use the menu when they respawn!
Then we add a Transfer Player set to the variables we added above (Position Map ID, Position X Cor, Position Y Cor) to their respective areas.
Then we want to Fadein the screen because we faded out earlier!
It should look like this at the end.
You are going to want to test it in game really quick to make sure you did not miss anything!
[*]
Now we have added the first option to the event, but we still need to add the next option! So under “Town, Please” we want to add essentially what we did above with a few changes. So you can just select all of it and copy it into this area. This can be done by selecting “Fadein Screen” holding the shift key then selecting “Control Variables : #005….” Then pressing CTRL + C. You then want to select the blank area below “Town, Please” and press CTRL + V.
But wait then it would just run the same thing! So we want to edit this duplicate to be different.
First we want to change how much money the player losses to respawn. So select “Control Variable : #005 Hold Variable = $gameParty.gold() * (.09 * $gameVariables.value(0005))” and press ENTER or SPACE BAR to modify it. We want to change the script in there to be less harsh. So we change the “.09” to “.01”. This way the player only losses around %3 to %10 of their money to respawn.
Next we want the player to go back to town when they respawn. So select “Transfer Player : ….” And press ENTER or SPACE BAR. Click Direct Destination and set it to where ever you want the player to go, I put it on my test map called “Training.”
Now run a quick play test. If it works, you did well! If not when run over it again line by line and see what you missed!
[*]
Now we have a third option. This lets the player simply lose. But I am going to include two options for how to do this. Personally the game I am working on, Sentinels: Crucible, features perma-death and this menu offers one of the ways this can happen. I am going to teach you that!
So First option is a simple game-over.
You can do this by adding a Return to Title Screen to the event. And BAM! Just like…old…
[*]
The other way is cooler!
First we want to add a Show Text asking the player if they are sure, we also should warn them here, but eh.
Next we slap in a show choices, disallowing cancel, we add Yes and No
Under the “when yes” we add a script to the event. This would be as follows:
“ var cursave = DataManager.lastAccessedSavefileId();
StorageManager.remove(cursave); “
This lets the game select the last save file accessed and removes it from existence.
Then we Fadeout screen and Return to Title Screen
[*]
But wait! We are not done yet. Add End Event Processing to the end of the event. This will make it run smoother.
Change Log
0.0.1 – Print
0.0.2- Three choices refined, variables streamlined.
Save Locations and Save Items.
So I am going to show you how to make and use save locations in your game. I will be starting this on a fresh map but it can be used on any map! But this is a rather branching tutorial. I am going to cover several types of save locations. But several things are universal in these. You always want the image or sprite of the save location to be the same and ONLY used for saving. This means that if you make it a typewriter, this typewriter sprite cannot be used for anything else; so then the player does not get confused and knows where to save. You also at some early point in the game want to explain what this typewriter is.
Now I am going to lay out how to make THREE kinds of save locations and some features of them are interchange-able. We will work off a standard base then branch out to the different types. The first type is your standard click-to-save location; this simply brings up a menu and lets the player get to business. The second type is similar to resident evil and would be good in horror games; this will be the “typewriter” system that makes the player use an item or money to save. The third type is a limiter; the player is limited to only saving a certain amount of times in the game!
Also we could NOT use events on the item. If we do the typewriter type and instead add that the save common event runs when the item is used, then we can make an item the lets the player save where-ever they are but only if they have the item! I’ll discuss this at the end!
Anyway, tutorial time!
Now I am going to lay out how to make THREE kinds of save locations and some features of them are interchange-able. We will work off a standard base then branch out to the different types. The first type is your standard click-to-save location; this simply brings up a menu and lets the player get to business. The second type is similar to resident evil and would be good in horror games; this will be the “typewriter” system that makes the player use an item or money to save. The third type is a limiter; the player is limited to only saving a certain amount of times in the game!
Also we could NOT use events on the item. If we do the typewriter type and instead add that the save common event runs when the item is used, then we can make an item the lets the player save where-ever they are but only if they have the item! I’ll discuss this at the end!
Anyway, tutorial time!
So first off I made a new event on a lush grassy map. The event is named “SaveCircle”, all of it’s Options are unchecked, it’s trigger is Action Button, and I gave it a easily recognizable symbol. We want this symbol to be the same for each save location; in fact ideally we want all save location events to be exactly the same! But you are probably thinking or even saying “But super awesome teacher, what if we want to edit it? Then we have to change all of them! D:” But you actually don’t!
What we do is create a Common Event called Save. This will be called by all of your save points. So if you need to edit the event you do not have to go hunt down all hundred and do the same edit endlessly! You got better things to do!
So you add Common Event : Save to your map event and cap it off with an Exit Event Processing
Now we are going to setup the bones of the common event so we can later do one of the fancy save game features.
Firstly we add a Show Text and ask “Would you like to save?” this lets the player know what is going on!
Then we add a Show Choices, the default options are fine so just click okay.
Okay that is it for the framework…
Now this is where the tutorial branches.
Basic
First we have a more vanilla option, you can simply let the player use the save menu. This can be done by adding an open save screen under the YES choice and an Exit Event Processing under the No Choice.
This way the player is limited on WHERE they can save, but not on how much.
Typewriter
Second we have the “Typewriter” option. This limited the player to only being able to save if they have the money or a specific consumable item. This is much more complicated to execute.
So first we need to decide if we want to charge money or an item. If it is an item we need to figure out how the player can get it, most likely not by a store and they should start off with a few of these. If we are doing items, we need to create it.
Go over to the Items part of the Database.
So I added a new item called Save Token. This should be called something cooler in your game, like Ink or Magic Savin’ Beans.
I made the item not-consumable and only accessible in the menu, I also put the scope to none. This prevents the player from accidently using the item for not saving.
Something like so.
[*]
Now back to our common event called save.
[*]
We change our Show Text to add in the notice that if they save, they lose a token.
[*]
Next we want to change the When Yes part.
[*]
Get rid of the Open Save Screen for now. Just select it and press DELETE.
If we want to do just money, steps 6 to 11 do not apply. Instead we just add under When Yes the following
Add a Control Variable set to Hold Variable and SET it to script and put in the following
“ $gameParty.gold() * .05 “ This lets the game figure out what 5% of the player’s money is.
Next we add a Change Gold set to Decrease by the Hold Variable. This will make the player have to spend 5% of their money to save. You can change the decimal in the equation script to change the percentage.
Then we add in Open Save Screen
And that’s it!
[*]
We add a Conditional Branch in, and set it to Items : Save Token, also check the Else Branch part on the bottom. This way we can check to see if the player even has the item before we go any further.
[*]
Under the Else part we add a Show Text and let it say that they need tokens! Then add an Exit event processing to close it all out.
[*]
Back under If : party has Save Token we want to add what happens if they do in fact have the token.
[*]
Now we add a Change Item and set it to save tokens and decrease by one. This is so that the player “spends” the token to save.
[*]
Okay, below that we add in an Open Save Screen.
[*]
And that’s it!
Limiter
This would limit the total amount of saves the player can ever make in the game. This would be good for shorter, horror, or super-heavy story games, as the player is less likely to be constantly dyeing and wanting to save. It also can make a game very hard as the player must weigh saving over risk.
Get rid of the Open Save Screen for now. Just select it and press DELETE.
We want to add under When Yes a Conditional Branch check else and set it to Variable and make a new one called Saves. Set it to > 0. This way if the player has more than 0 saves, it will let them save.
Add under the IF part a Control Variable set to Sub one from a variable called Saves. Remember what that variables number id. Mine is 0009.
Next go up to the Show Text and open it up for editing by pressing SPACE or ENTER.
Add into the end of the text “You only have \V[0009] saves Left! “ That \v will be replaced with whatever that variable’s number is.
Back under that control variable we want to add Open Save Screen.
Next under else we want to add a Show text that says they have no saves. Then we exit the event.
Last, we want to give the player their starting saves. We create an map event where the game starts
This will be set to trigger Parallel. Options are checked to none and set priority above characters. Name it Save Start.
Add a Conditional Branch set to if self switch is off.
Under this we put in a Control Variable put it on the variable Saves. Put it on Set and too 100. This gives the player 100 saves.
Then we put a Control Switches and put self switch A on.
At the very end add an exit event processing.
[*]
And that is it!
Alternate Typewriter or Save Items
In this way we can make it so an ITEM not a location lets the player save, so as long as they have more of these items they can save!
So this way we follow the typewriter tutorial but change like so below.
So first we need to decide if we want to charge money or an item. If it is an item we need to figure out how the player can get it, most likely not by a store and they should start off with a few of these. If we are doing items, we need to create it.
Go over to the Items part of the Database.
So I added a new item called Save Token. This should be called something cooler in your game, like Ink or Magic Savin’ Beans.
I made the item consumable and only accessible in the menu, I also put the scope to none. This lets the player use it in their items menu.
Then we click effects and add that it runs the save common event when used.
[*]
Now back to our common event called save.
[*]
We change our Show Text to add in the notice that if they save, they lose a token.
[*]
Next, under the Yes part, the Show Save Screen should still be there from the framework. Leave it. The game already removes the item when used.
[*]
Under the No part we add a Change Items Set to save tokens and increase it by one. This is because the player decided not to use the token and we want to give it back to them.
[*]
And that’s it!
[*]
By the way, if the player exits from the save menu without saving, they still lose a token. Should of saved!
Bonus screenshot:
That is a save location in my game. They glow!
Last edited by a moderator:
















