Author Topic: [XP] Gameover Options Menu  (Read 6661 times)

Offline AliveDrive

  • Astral Trancist
  • *****
  • Posts: 690
  • LV: 17
  • Gender: Male
  • Nyah!
    • View Profile
[XP] Gameover Options Menu
« on: March 29, 2011, 04:29:21 AM »
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

(click to show/hide)


Script

Code: [Select]
#==============================================================================
# ** 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.
« Last Edit: April 27, 2011, 01:09:45 PM by Blizzard »
The permanent solution for your problem would be to stop hanging out with stupid people.

Offline winkio

  • Epiq
  • Administrator
  • Guardian of Chaos
  • *****
  • Posts: 4505
  • LV: 199
  • Gender: Male
  • I am lying.
    • View Profile
Re: [XP] Gaveover Options Menu
« Reply #1 on: March 29, 2011, 07:41:00 AM »
just in cased you missed it in IRC:
Code: [Select]
$game_system.map_interpreter.setup(nil, 0)before you setup the map.  It resets the interpreter so that events don't get stuck.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20005
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Gaveover Options Menu
« Reply #2 on: March 29, 2011, 08:40:21 AM »
Key Term does not exist.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Offline AliveDrive

  • Astral Trancist
  • *****
  • Posts: 690
  • LV: 17
  • Gender: Male
  • Nyah!
    • View Profile
Re: [XP] Gaveover Options Menu
« Reply #3 on: March 29, 2011, 03:54:42 PM »
My misunderstake.
The permanent solution for your problem would be to stop hanging out with stupid people.

Offline The Niche

  • The Hair Man
  • Chaos User
  • ******
  • Posts: 1561
  • LV: -171
  • Gender: Male
  • Marvel at the hair.
    • View Profile
    • Laptops and Tea, the place to go for marketing your creativity!
Re: [XP] Gaveover Options Menu
« Reply #4 on: March 29, 2011, 03:57:22 PM »
Your first script... :')

Seriously, congrats.
Level me down, I'm trying to become the anti-blizz!
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.

(click to show/hide)
I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Offline AliveDrive

  • Astral Trancist
  • *****
  • Posts: 690
  • LV: 17
  • Gender: Male
  • Nyah!
    • View Profile
Re: [XP] Gaveover Options Menu
« Reply #5 on: March 29, 2011, 03:59:52 PM »
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
The permanent solution for your problem would be to stop hanging out with stupid people.

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Gaveover Options Menu
« Reply #6 on: April 10, 2011, 03:38:47 AM »
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...
« Last Edit: April 10, 2011, 03:57:43 AM by RPGManiac3030 »


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

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Gaveover Options Menu
« Reply #7 on: April 10, 2011, 02:29:24 PM »
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.

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Gameover Options Menu
« Reply #8 on: April 10, 2011, 05:35:42 PM »
Oh I see it now.


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