Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Continue Game after Game Over Script.

HEY! I'm requesting a script that allows a customizable "Continue from last save point" screen after you die and get the Game Over Screen.

Thanks! I'd really appreciate this and thank you all.

Drerius.
 
Ahhh yet again I love making scripts, and I love helping people in these forums.  :lol:. Here you go this script lets the user chosse if they want to continue, return to title, or shutdown. It requires my own made Window_Command though to make the x and y of the box but don't worry! I will include it here of course! =D

Here is my Game over Script. PLEASE REMEMBER TO CREDIT ME! =D

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Gameover
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
    #The first two are the x and y position of the box.
    @command_window = Window_CommandNew.new(298,110, 180, ["Continue", "Return To Title", "Shutdown"])
    @command_window.index = @menu_index
    # Make Name Window
    $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)
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes      = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items        = load_data("Data/Items.rxdata")
    $data_weapons      = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies      = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    # Make system object
    $game_system = Game_System.new
    @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)
    @continue_enabled = false
    for i in 0..99
      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
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @sprite.bitmap.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    # Update command window
    @command_window.update
    # If C button was pressed
    if Input.trigger?(Input::C) or Input::trigger?(Input::Mouse_Left) #Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # New game
        command_continue
      when 1  # Continue
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Title.new
      when 2  # Shutdown
        command_shutdown
      end
    end
    # If status window is active: call update_status
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Title.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C) or Input::trigger?(Input::Mouse_Left)
      case @command_window.index
      when 0 
        command_continue
      when 1
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Title.new
      when 2
        command_shutdown
      end
      return
    end
  end
  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
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # 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 skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end
#-----------------------------------------------------------------
#Window Display
#-----------------------------------------------------------------
class Window_MainName < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 180, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 0, 125, 32, "Skills",0)
  end
end
   
   

And my Window_Command!

#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================

class Window_CommandNew < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    width    : window width
  #    commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(x, y, width, commands)
    # Compute window height from command quantity
    super(x, y, width, commands.size * 32 + 32)
    @cursor_height = 32
    self.opacity = 0
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #    index : item number
  #    color : text color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #    index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end

I will also post this in the script forums. Enjoy!

-Matt

Providing help for your scripting needs.
 
AWESOME! WOW! I would love if you could teach me how to script... if at all possible. and this is amazing, where do I place it? above main? also, what do I do with the window's command? lol

thank you soo much!
 
Above main.

Just set it up like this...

...scripts...

New Game over Script
New Command Script

Main

killerzkings":2hn1anis said:
Use the search function next time when you request a script

There is a gameover to Inn script, so don't simply ask questions.

yes but I believe he is looking for something slightly different.

Something more like the final fantasy style gameover.

Drerius try it out right now since i'm online and I can help you with errors immediately.
 
okay so you're saying to place it in that blank spot under main? then the next blank spot under main I place the window's command? lol please tell me exactly how to do it, this is my first time with a script lol. (excited!) :-p
 
just like this

Window_Command(x,y,...)
Necro's Game Over!! =D

Main

that's exacly out of my game lol.

just set it up like that and copy and paste the text from the forums into the spots you add.

Btw this script is for Xp if you need a VX one it's an easy fix.  :thumb:
 
oh lol, I was wondering why I was getting a script error line 20 lol, yes, please I need it for VX

will I need to replace both scripts? window's command and the gameover one? once you tinker it?

also, can I tweek it to say something a bit different like you can with the title screen?
THANKS!XD
 
hahaha. Calm down now.

If you want tell me what you want it to say and I can do it.

Also what do you want for a set up?

Right now its

Continue
go to title
shutdown

I can maybe do...

Continue
Go to title
Show status
Shutdown
What's Up
What went wrong?
WHYYYYYYYY
ect.

So if you need more options added I can do it.

ALSO THANK YOU FOR HAVING VX

scripting in VX is a personal Favorite!
 
LOL! alright, maybe have it say,you f**cked up lol! Continue, Quit, hmm..jk lol, have it say, Game Over... Revive, use a similar opposite term to mean quit.. like lol, idk, quit struggle or just quit lol. idk haha! yeah,

Game Over:
Continue from last save
Revive on spot with penalty (lose item or whatever I chose idk how that works lol)
Quit(make it bring me to the title screen)
 
Awesome! thanks! Everyone keeps saying on this forum give credit.. I SURE WILL no doubt but if I knew how lol, in my credits after the game is over? lol, tell me how and I will DEFINITELY credit you :D
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top