• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script: Game Over

Hello, I'm struggling making a game over function. I tried to do it my myself, but it does not work.
I updated the main post with a version working on V19.1

The old version. Tested on v13 and v17.2:
Code:
#===============================================================================
# * Game Over - by FL (Credits will be apreciated)
#===============================================================================
#
# This script is for Pokémon Essentials. When a switch is on, its activates a
# game over when the player lose a battle instead of going to last healing spot.
#
#===============================================================================
# For this script to work, put it above main script section. After that,
# in PField_Visuals script section before line 
# 'if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0' add
# line 'pbLoadRpgxpScene(Scene_Gameover.new) if $game_switches[GAMEOVERSWITCH]'.
#
# If you wish to don't display the money lost message, in PokeBattle_Battle
# script section, after line 'moneylost=0 if $game_switches[NO_MONEY_LOSS]' add line
# 'moneylost=0 if (!canlose && $game_switches[GAMEOVERSWITCH])'.
#
# This script is the RPG Maker XP Scene_Gameover with a single line
# commented and two line added as you can see below, so you can define the
# game Over ME and graphic in the RPG Maker XP system database (F9).
# Please note that Essentials uses a different screen size (the default is
# 512x384), so the game over graphic must match.
# 
#===============================================================================

# The switch number that need to be ON in order to allows a game over
GAMEOVERSWITCH = 60 

# Using the equivalent of the commented line ($scene = Scene_Map.new)
# throws some strange behaviors, so I prefer to raise a reset at scene end

#==============================================================================
# ** 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_play(nil)
    $game_system.bgs_play(nil)
    # Play game over ME
    $game_system.me_play($data_system.gameover_me)
    # Execute transition
    Graphics.transition(120)
    # 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
    Audio.me_fade(800) # added line
    raise Reset.new # added line
    # If battle test
    if $BTEST
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Switch to title screen
#     $scene = Scene_Title.new # commented line
      $scene = nil; # added line
    end
  end
end
 
Hello FL, I have a bug in the new version of the script.

When the game over screen appears, I'm getting back to the title screen but when I choose "Quit Game", I'm getting back at the end of the battle with my pokemon fainted.

I also have a minor graphical bug when I choose to load a game.

I'm using Pokemon Essentials V19.1 with the plugin of generation 8.

Thanks in advance for the help.

(sorry for my bad english)
 
Hello FL, I have a bug in the new version of the script.

When the game over screen appears, I'm getting back to the title screen but when I choose "Quit Game", I'm getting back at the end of the battle with my pokemon fainted.

I also have a minor graphical bug when I choose to load a game.

I'm using Pokemon Essentials V19.1 with the plugin of generation 8.

Thanks in advance for the help.

(sorry for my bad english)
Fixed! I also turn it into a plugin, but you can update yours just copying and pasting this file.
 
Hi FL, thanks for creating and sharing this resource, small but well maintained!
I have a problem with it though. After the game-over screen, the main menu shows up as expected. Then I select the savefile to reload, it does for a moment, except that it goes back to the main menu immediately.
I am unable to solve the problem. What might be causing it? When you have time, can you (or someone who knows their way around the scripts more than I do) look into it?
Thanks in advance!
 
Hi FL, thanks for creating and sharing this resource, small but well maintained!
I have a problem with it though. After the game-over screen, the main menu shows up as expected. Then I select the savefile to reload, it does for a moment, except that it goes back to the main menu immediately.
I am unable to solve the problem. What might be causing it? When you have time, can you (or someone who knows their way around the scripts more than I do) look into it?
Thanks in advance!
I can't reproduce here. Did you use the 1.2 version? I updated the script few hours before your message.
 
It is 1.2, from the data in the meta. It does the same even if there are no save files and I select new game. I thought it was some other plugin interfering, but it does so even on a clean essentials installation. Maybe I am doing something wrong on the setup part?
First I merge the Plugin and Graphics folders, then I go in the database to define the GameOver graphics, finally activate the gameover switch with an autorun event. Is there something else I am missing?
 
It is 1.2, from the data in the meta. It does the same even if there are no save files and I select new game. I thought it was some other plugin interfering, but it does so even on a clean essentials installation. Maybe I am doing something wrong on the setup part?
First I merge the Plugin and Graphics folders, then I go in the database to define the GameOver graphics, finally activate the gameover switch with an autorun event. Is there something else I am missing?
Turn out that I was testing the version without hotfixes. Fixed for all v19 versions.

You can update adding this line or replacing the script.
 
I can't get it to work, I've put the Folders in its place, and the Debug console says that it is installed, but when I call the game over via the switch, it doesn't, and when I use the Game Over command, it does a normal black out, what do I do?
 
I can't get it to work, I've put the Folders in its place, and the Debug console says that it is installed, but when I call the game over via the switch, it doesn't, and when I use the Game Over command, it does a normal black out, what do I do?
I tested now and it is working here. Make sure that you compiled (by holding shift when game starts), specially if you changed the switch number. And checks if you are using Essentials v20/v20.1 if you are using the latest script version.

To make sure, put 'p GAME_OVER_SWITCH' before line 'if $game_switches[GAME_OVER_SWITCH]' in the plugin. This line will display the switch number when you lose versus a trainer that you normally will black out.
 
Back
Top