; 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
$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.
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.
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.
SpoilerSo 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!
Before we get to anything fancy we want to disable save menu access from the main menu. We can do this by opening the Database and going to system then going over to menu commands and de-checking save. This will remove save from the menu.
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.
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.
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.
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.
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.