[XP] Gameover Options Menu

Started by AliveDrive, March 28, 2011, 10:29:21 pm

Previous topic - Next topic

AliveDrive

March 28, 2011, 10:29:21 pm Last Edit: April 27, 2011, 07:09:45 am by Blizzard
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.


Features


  • Class up your Game-Over screen!

  • Revive (costs half of held gold)

  • Continue

  • or Return to Title




Screenshots

Spoiler: ShowHide




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


  • AliveDrive

  • winkio

  • Game_Guy




Author's Notes

My first script...sort of.

Comments/Feedback appreciated.

As always if you find a bug, you know the drill.
Quote from: Blizzard on September 09, 2011, 02:26:33 am
The permanent solution for your problem would be to stop hanging out with stupid people.

winkio

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.

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

AliveDrive

Quote from: Blizzard on September 09, 2011, 02:26:33 am
The permanent solution for your problem would be to stop hanging out with stupid people.

The Niche

Your first script... :')

Seriously, congrats.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

AliveDrive

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
Quote from: Blizzard on September 09, 2011, 02:26:33 am
The permanent solution for your problem would be to stop hanging out with stupid people.

RPGManiac3030

April 09, 2011, 09:38:47 pm #6 Last Edit: April 09, 2011, 09:57:43 pm by RPGManiac3030
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...


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

G_G

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.

RPGManiac3030



Official Gio website:
gioadventures.freehostingcloud.com (under construction)