RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Gameover selectable- Need Help

Started by Ericashi, October 29, 2009, 11:39:44 PM

0 Members and 1 Guest are viewing this topic.

Ericashi

Hello everyone, I was wondering if anyone knows of or can make a script that shows to title, load, or quit on the game over screen. I can't find anything of this sort on the site. Maybe I'm not typing the right things though. I need it done for XP. Any assistance would be helpful. Thanks!

albertfish

#1
Here, I threw this together quickly. Put this above main.
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#==============================================================================

class Scene_Gameover
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make command window
   s1 = "To Title"
   s2 = "Load"
   s3 = "Quit"
   @command_window = Window_Command.new(192, [s1, s2, s3])
   @command_window.back_opacity = 160
   @command_window.x = 320 - @command_window.width / 2
   @command_window.y = 288
   # Continue enabled determinant
   # Check if at least one save file exists
   # If enabled, make @continue_enabled true; if disabled, make it false
   @continue_enabled = false
   for i in 0..3
     if FileTest.exist?("Save#{i+1}.rxdata")
       @continue_enabled = true
     end
   end
   # If continue is enabled, move cursor to "Continue"
   # If disabled, display "Continue" text in gray
   if @continue_enabled
     @command_window.index = 1
   else
     @command_window.disable_item(1)
   end
   
   # 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 command window
   @command_window.dispose
   # 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
 #--------------------------------------------------------------------------
 def update
   # Update command window
   @command_window.update
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Branch by command window cursor position
     case @command_window.index
     when 0  # To Title
       command_to_title
     when 1  # Continue
       command_continue
     when 2  # Shutdown
       command_shutdown
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Command: To Title
 #--------------------------------------------------------------------------
 def command_to_title
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Switch to map screen
   $scene = Scene_Title.new
 end
 #--------------------------------------------------------------------------
 # * Command: Continue
 #--------------------------------------------------------------------------
 def command_continue
   # If continue is disabled
   unless @continue_enabled
     # Play buzzer SE
     $game_system.se_play($data_system.buzzer_se)
     return
   end
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Switch to load screen
   $scene = Scene_Load.new
 end
 #--------------------------------------------------------------------------
 # * Command: Shutdown
 #--------------------------------------------------------------------------
 def command_shutdown
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Fade out BGM, BGS, and ME
   Audio.bgm_fade(800)
   Audio.bgs_fade(800)
   Audio.me_fade(800)
   # Shutdown
   $scene = nil
 end
end

Ericashi

Thanks, it worked! I really appreciate your work.

albertfish