Winkio's Custom Gameover Script
Authors: winkio
Version: 1.0
Type: Custom Gameover Script
Key Term: Title / Save / Load / GameOver Add-on
IntroductionThis script will allow you to have a custom gameover, so that when your party dies, it respawns in the map of your choice. This script does not reload data, but rather continues data, so progress is not lost at a gameover. You can add in EXP or Gold loss at gameover too.
Features
- Respawn in the map of your choice upon gameover.
- No need to setup events
- Choose whether or not to subtract gold or xp upon death
Script
#==============================================================================
# Winkio's Custom Gameover Script
# version 1.0
# ** Scene_Gameover
#------------------------------------------------------------------------------
# This class performs game over screen processing.
#==============================================================================
# Instructions
# This Script replaces Scene_Gameover.
# All the customization of this script appears in Frame_update
class Scene_Gameover
#--------------------------------------------------------------------------
# * Main Processing
# This part is the same as in the original
#--------------------------------------------------------------------------
def main
# Make game over graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
# Stop BGM and BGS
$game_system.bgm_play(nil)
$game_system.bgs_play(nil)
# Play game over ME
$game_system.me_play($data_system.gameover_me)
# Execute transition
Graphics.transition(120)
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of game over graphic
@sprite.bitmap.dispose
@sprite.dispose
# Execute transition
Graphics.transition(40)
# Prepare for transition
Graphics.freeze
# If battle test
if $BTEST
$scene = nil
end
end
#--------------------------------------------------------------------------
# * Frame Update
# This part is the part that has been changed.
#--------------------------------------------------------------------------
def update
# If C button was pressed
if Input.trigger?(Input::C)
# Remove State Death for all party members
for actor in $game_party.actors
actor.remove_state(1)
end
# Setup Map ID:005 Change this to the id of whatever map you want.
# Right click and select properties on a map to display the Map ID in the Title bar.
$game_map.setup(5)
# Move the player to position (9,2) Change this to the location that you
# want the player to respawn at.
$game_player.moveto(9, 2)
# Add in any decrease in Gold or XP here.
$game_player.refresh
$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end
end
end
InstructionsName This Script Scene_Gameover, as it will replace the original Scene_Gameover.
Other instructions are in the script.
CompatibilityNo known issues
Credits and Thanks
- Me. There might be other people out there who have made similar scripts, but I came up with this one myself.
Author's NotesThis may cause more problems in your game if there is a gameover in the middle of a minigame or unorthodox event system, so be sure to account for extra items or variables that need to be dumped.
Looks good, I'll look more into a little later and let you know what I think!
Little tip. If only update method is replaced, you don't need to put in other methods. Instead of your script replacing the original one, you could just add it below Scene_GO and only update method will be replaced. It might help compatibility wise.
i hope some will reply to this but can we set it to where they start at their last save point?
Yeah, just make the map that you teleport blank with an autostart event that teleports the player to last save point or whatever.
Or you could do force load XD
wait.....what?
1) On a completely blank and new map (This map will be related to the Gameover thing I assume?), make an auto-start event that teleports the player to the last start point. (Don't forget to erase it when done! :V)
2) Force-load
That's what I got from reading o3o
oooohhhh. i knew that 8)
hey, the script is great, but it's looping at the end. I changed the script to teleport my party (upon death) to a specific respawn point, and that works. As soon as the screen shows them there, it kicks back to game over like the state 'knockout' wasn't removed. I checked the script and it looks sound, but i'm no master scripter.. any idea why it would loop?
Make sure that knockout is state # 1 in the database
ya, it is. I started a new game to test the script just to make sure and it still loops.