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.

Game Over Continue?

I can't seem to find one if one exists. I'm looking for a script that when you get a Game Over it gives you the choice of continuing or not. Sounds pretty simple right? Anyone know of one? And if not anyone willing to help me out by taking on the request of making one?
 
I hope that I can help. You don't need a script for that. put this in to a event.

<>Move event::Player
: :<>Opacity Change 0
<>Tint screen: (-255,-255,-255,0). @20
<>Game Over
<>Message:Would you like to continue?
Show choices: Yes,No
: [Yes] Handler
<>Open Save Menu
<>
: [No] Handler
<>Return to title screen
<>
:End
<>End Event Processing
<>

I hope that this helps, it worked for me.
 

A J

Member

I think that he means every fight when you walk and fight monster and you die you you choose if you wanna continue or not

I believe thats an easy script I will need some editing in the Scene_Gameover
adding a command window I'm not sure if I can do it but I'll try one thing I know I can't bring back the old itme that you used in the battle it's kinda hard with me it will need a good scripter
 

A J

Member

sorry it took so long but I had some problems

anyway here is the script

Code:
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#==============================================================================

class Scene_Gameover
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make game over graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
    # Stop BGM and BGS
    $game_system.bgm_stop
    # Play game over ME
    $game_system.me_play($data_system.gameover_me)
    # Execute transition
    Graphics.transition(120)
    for c in 0..300
    end
    if $game_temp.lost_battle
      s1 = "Continue"
      s2 = "Back to Title"
      s3 = "Shutdown"
      @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
    end
    # 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 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
    if $game_temp.lost_battle
      # If C button was pressed
      @command_window.update
      if Input.trigger?(Input::C)
        case @command_window.index
        when 0
          start_battle
        when 1
          to_title
        when 2
          shut_down
        end
      end
    else
      if Input.trigger?(Input::C)
        # Switch to title screen
        $scene = Scene_Title.new
      end
    end
  end
  
  def start_battle
    # Play decision Battle BGM and Stop ME
    $game_system.bgm_play($game_system.battle_bgm)
    $game_system.me_play(nil)
    for i in 0..$game_party.actors.size - 1
      $game_party.actors[i].hp = $game_party.actors[i].maxhp
      $game_party.actors[i].sp = $game_party.actors[i].maxsp
    end
    $game_temp.gameover = false
    $game_temp.lost_battle = false
    $game_party.add_lost_point
    # Play battle Battle start SE
    $game_system.se_play($data_system.battle_start_se)
    $game_player.straighten
    @command_window.dispose
    $scene = Scene_Battle.new
  end

  def to_title
    # 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)
    # Switch to title screen
    @command_window.dispose
    $scene = Scene_Title.new
  end
  
  
  def shut_down
    # 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
class Scene_Battle
  
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      # Update interpreter
      $game_system.battle_interpreter.update
      # If a battler which is forcing actions doesn't exist
      if $game_temp.forcing_battler == nil
        # If battle event has finished running
        unless $game_system.battle_interpreter.running?
          # Rerun battle event set up if battle continues
          unless judge
            setup_battle_event
          end
        end
        # If not after battle phase
        if @phase != 5
          # Refresh status window
          @status_window.refresh
        end
      end
    end
    # Update system (timer) and screen
    $game_system.update
    $game_screen.update
    # If timer has reached 0
    if $game_system.timer_working and $game_system.timer == 0
      # Abort battle
      $game_temp.battle_abort = true
    end
    # Update windows
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    # Update sprite set
    @spriteset.update
    # If transition is processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If message window is showing
    if $game_temp.message_window_showing
      return
    end
    # If effect is showing
    if @spriteset.effect?
      return
    end
    # If game over
    if $game_temp.gameover
      $game_temp.lost_battle = true
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Switch to title screen
      $scene = Scene_Title.new
      return
    end
    # If battle is aborted
    if $game_temp.battle_abort
      # Return to BGM used before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle ends
      battle_end(1)
      return
    end
    # If waiting
    if @wait_count > 0
      # Decrease wait count
      @wait_count -= 1
      return
    end
    # If battler forcing an action doesn't exist,
    # and battle event is running
    if $game_temp.forcing_battler == nil and
       $game_system.battle_interpreter.running?
      return
    end
    # Branch according to phase
    case @phase
    when 1  # pre-battle phase
      update_phase1
    when 2  # party command phase
      update_phase2
    when 3  # actor command phase
      update_phase3
    when 4  # main phase
      update_phase4
    when 5  # after battle phase
      update_phase5
    end
  end
end

I know it's long thats coz I had to edit the battle scene just to add this $game_temp.lost_battle = true
Code:
    if $game_temp.gameover
      [COLOR=Red]$game_temp.lost_battle = true[/COLOR]
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
so we can know if you lost the battle or you just call the gameover secen
anyway I've added a battle lost counter I don't know you might wanna use it like when you end the game you show how many time you lost and other infromation like this (dude I should work on this script every one is thinking about the starting no one thinks about the ending ^_^ )
Code:
$game_party.lost

Anyway you have to add
Code:
  attr_accessor :lost_battle
under class Game_Temp
and
Code:
    @lost_battle = false
under def initialize in the method in the same class

and add
Code:
  attr_reader   :lost
under class Game_Party
and
Code:
    @lost = 0
under def initializein in the method in the same class

the last one add this
Code:
  [COLOR=blue]def[/COLOR] add_lost_point
    @lost += 1
  end
in the same class where all def methods are if you don't know where

ok just go down in about line 334 right befor the commants

#-----------------------------------------------------------------------
# * Random Selection of Target Actor (HP 0)
#-----------------------------------------------------------------------
just put it there


Edit : you should also thank Racheal coz she helped me
 
Oh! Sorry it took me so long to realize someone replied. ^^; Uh yeah thanks, I'll try adding that in now. :thumb:
Edit: Ok awesome it works! One thing though, is there way so that when you pick continue, it doesnt start you back in the same battle you just lost. Can you make it so it just starts you in the last place you saved?
 

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