04-12-2008, 01:00 PM
TDS Continue
Introduction
Just a simple Game Over modification that gives more options when defeated.
Features
This script allows you to continue the game after a Game Over in the last place you saved the game or choose from other options.
- Continue
Allows you to continue from the last save point.
- Title Screen
Returns you to the title screen of the game.
- Load Game
Goes to the loading screen allowing you to choose a different Save File.
- Quit
Closes the game.
Screenshots
Demo
Not really needed.
Script
Instructions
Just put it above main in the area designated for new scripts and below Scene_Gameover.
Compatibility
None that I know so far.
Credits and Thanks
TDS
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Introduction
Just a simple Game Over modification that gives more options when defeated.
Features
This script allows you to continue the game after a Game Over in the last place you saved the game or choose from other options.
- Continue
Allows you to continue from the last save point.
- Title Screen
Returns you to the title screen of the game.
- Load Game
Goes to the loading screen allowing you to choose a different Save File.
- Quit
Closes the game.
Screenshots
Demo
Not really needed.
Script
"Script"
Code:
#==============================================================================
# ** TDS Continue
# [VX] Version: 1.0
#------------------------------------------------------------------------------
# Allows for a player to continue at the last save point when s/he dies.
#==============================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :playing_filename # Current playing file
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias tds_continue_gameover_game_temp_initialize initialize
def initialize
@playing_filename = nil
tds_continue_gameover_game_temp_initialize
end
end
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
# This class performs game over screen processing.
#==============================================================================
class Scene_Gameover < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
# If the playing variable is not nil
if $game_temp.playing_filename != nil
# Make Continue file
@file = "Save#{$game_temp.playing_filename + 1}.rvdata"
end
RPG::BGM.stop
RPG::BGS.stop
$data_system.gameover_me.play
Graphics.transition(120)
create_command_window
Graphics.freeze
create_gameover_graphic
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
# Checks if any files exist
@continue_enabled = (Dir.glob('Save*.rvdata').size > 0)
# Makes command window
@command_window = Window_Command.new(172, ['Continue', 'Title Screen',
'Load file','Quit'])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = 264
if $game_temp.playing_filename != nil
if FileTest.exist?(@file) == false # If continue file doesnt exist
@command_window.draw_item(0, false) # Make command semi-transparent
end
else
@command_window.draw_item(0, false) # Make command semi-transparent
end
if @continue_enabled == false # If continue is disable
@command_window.draw_item(2, false) # Make command semi-transparent
end
@command_window.openness = 0
@command_window.open
end
#--------------------------------------------------------------------------
# * Post-Start Processing
#--------------------------------------------------------------------------
def post_start
super
open_command_window
end
#--------------------------------------------------------------------------
# * Open Command Window
#--------------------------------------------------------------------------
def open_command_window
@command_window.open
begin
@command_window.update
Graphics.update
end until @command_window.openness == 255
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
close_command_window
$scene = nil if $BTEST
end
#--------------------------------------------------------------------------
# * Close Command Window
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
begin
@command_window.update
Graphics.update
end until @command_window.openness == 0
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Update command window
@command_window.update
if Input.trigger?(Input::C) and @command_window.openness == 255
case @command_window.index
when 0
return Sound.play_buzzer if $game_temp.playing_filename == nil
Sound.play_decision
terminate
Graphics.fadeout(50)
dispose_gameover_graphic if @command_window.openness == 0
do_load
when 1
Sound.play_decision
terminate
Graphics.fadeout(50)
dispose_gameover_graphic if @command_window.openness == 0
$scene = Scene_Title.new
when 2
if @continue_enabled
Sound.play_decision
terminate
Graphics.fadeout(50)
dispose_gameover_graphic if @command_window.openness == 0
$scene = Scene_File.new(false, true, false)
else
Sound.play_buzzer
end
when 3
Sound.play_decision
terminate
Graphics.fadeout(50)
dispose_gameover_graphic if @command_window.openness == 0
$scene = nil if @command_window.openness == 0
end
end
end
#--------------------------------------------------------------------------
# * Execute Load
#--------------------------------------------------------------------------
def do_load
file = File.open("Save#{$game_temp.playing_filename + 1}.rvdata", "rb")
read_save_data(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
if $game_system.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
#--------------------------------------------------------------------------
# * Execute Transition
#--------------------------------------------------------------------------
def perform_transition
Graphics.transition(180)
end
#--------------------------------------------------------------------------
# * Create Game Over Graphic
#--------------------------------------------------------------------------
def create_gameover_graphic
@sprite = Sprite.new
@sprite.bitmap = Cache.system("GameOver")
end
#--------------------------------------------------------------------------
# * Dispose of Game Over Graphic
#--------------------------------------------------------------------------
def dispose_gameover_graphic
@sprite.bitmap.dispose
@sprite.dispose
end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# * Execute Save
#--------------------------------------------------------------------------
alias tds_continue_scene_file_do_save do_save
def do_save
# Makes the playing file for continuing
$game_temp.playing_filename = @index
tds_continue_scene_file_do_save
end
#--------------------------------------------------------------------------
# * Execute Load
#--------------------------------------------------------------------------
alias tds_continue_scene_file_do_load do_load
def do_load
$game_temp.playing_filename = @index
tds_continue_scene_file_do_load
end
end
Instructions
Just put it above main in the area designated for new scripts and below Scene_Gameover.
Compatibility
None that I know so far.
Credits and Thanks
TDS