Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: AliveDrive on March 28, 2011, 10:29:21 pm

Title: [XP] Gameover Options Menu
Post by: AliveDrive on March 28, 2011, 10:29:21 pm
Gameover Options Menu
Authors: AliveDrive
Version: 1.1
Type: Gameover Mod
Key Term: Title / Save / Load / GameOver Add-on



Introduction

This was made for Song of Destruction (http://forum.chaos-project.com/index.php/board,67.0.html).


Features




Screenshots

Spoiler: ShowHide
(http://i760.photobucket.com/albums/xx245/RatatatOG/gameover2.png)




Script

#==============================================================================
# ** Scene_Gameover Menu
#
#   Made by AliveDrive
#   With help from winkio and Game_Guy
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#==============================================================================

VARIABLE_X = 1
VARIABLE_Y = 2
VARIABLE_MAP = 3

class Scene_Gameover
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make game over graphic
   @sprite = Sprite.new
   @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
   @help_window = Window_Help.new
   @help_window.set_text("You will lose " + ($game_party.gold / 2).to_s + " gold if you click Revive.")
   # Stop playing SE, ME, BGS, and BGM
   Audio.se_stop
   Audio.me_stop
   Audio.bgs_stop
   Audio.bgm_stop
   # Play game over ME
   $game_system.me_play($data_system.gameover_me)
   # Make command window
   s0 = "Revive"
   s1 = "Continue"
   s2 = "Return to Title"
   @command_window = Window_Command.new(192, [s0, s1, s2])
   @command_window.back_opacity = 160
   @command_window.x = 320 - @command_window.width / 2
   @command_window.y = 320
   # 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
   # Execute transition
   Graphics.transition
   # 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 help window
   @help_window.dispose
   # Dispose of command window
   @command_window.dispose
   # Dispose of gameover graphic
   @sprite.bitmap.dispose
   @sprite.dispose
 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  # Revive
       command_revive
     when 1  # Continue
       command_continue
     when 2  # Return to Title
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Title.new
     end
   end
 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: Revive
 #--------------------------------------------------------------------------
 def command_revive
   $game_temp.gameover = false
   $game_party.gain_gold($game_party.gold / -2)
   $game_party.actors.each {|a| a.recover_all}
   $game_map.setup($game_temp.player_new_map_id)
   $game_temp.player_transferring = true
   $game_player.refresh
   $game_map.autoplay
   $game_map.update
   $scene = Scene_Map.new
 return
   # If battle test
   if $BTEST
     $scene = nil
   end
 end
end  




Instructions

Replaces Scene_Gameover.


Compatibility

Will most probably not work with other scripts that override Scene_Gameover.


Credits and Thanks




Author's Notes

My first script...sort of.

Comments/Feedback appreciated.

As always if you find a bug, you know the drill.
Title: Re: [XP] Gaveover Options Menu
Post by: winkio on March 29, 2011, 01:41:00 am
just in cased you missed it in IRC:
$game_system.map_interpreter.setup(nil, 0)

before you setup the map.  It resets the interpreter so that events don't get stuck.
Title: Re: [XP] Gaveover Options Menu
Post by: Blizzard on March 29, 2011, 02:40:21 am
Key Term does not exist.
Title: Re: [XP] Gaveover Options Menu
Post by: AliveDrive on March 29, 2011, 09:54:42 am
My misunderstake.
Title: Re: [XP] Gaveover Options Menu
Post by: The Niche on March 29, 2011, 09:57:22 am
Your first script... :')

Seriously, congrats.
Title: Re: [XP] Gaveover Options Menu
Post by: AliveDrive on March 29, 2011, 09:59:52 am
I really couldn't have done it without winkio and G_G guiding me every step of the way.

Like really. I couldn't have done it. xD
Title: Re: [XP] Gaveover Options Menu
Post by: RPGManiac3030 on April 09, 2011, 09:38:47 pm
Nice, but it seems as if it would cost 0 gold to revive if the player dies with no money...kind of cheating death?

Also, when I do revive, I get an error saying that Map 000 can't be found or something like that...
Title: Re: [XP] Gaveover Options Menu
Post by: G_G on April 10, 2011, 08:29:24 am
You have to set the variables to the map id, the x, and the y coordinate of where the player is placed after being revived. This makes it so you can revive in different towns throughout the entire game.
Title: Re: [XP] Gameover Options Menu
Post by: RPGManiac3030 on April 10, 2011, 11:35:42 am
Oh I see it now.