PDA

View Full Version : [Essentials script] Game Over


FL
May 26th, 2013, 11:16 AM
#===============================================================================
# * 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 PokemonField 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=pbMaxLevel(@party1)' 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
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

Tayuya of the Sound Four
May 26th, 2013, 11:40 AM
This is pretty cool, I can't think of anything I could use it for personally, but others will find it pretty useful, Kudos c:

Dylanrockin
May 29th, 2013, 10:08 AM
Where would I put: pbLoadRpgxpScene(Scene_Gameover.new) if $game_switches[GAMEOVERSWITCH]

Would I put it after line 1736, or on line 1736? Also I want to play a song when the game over screen is displayed, how would I go about putting that in?

Nickalooose
May 29th, 2013, 10:46 AM
The English is not the best but.

# To this script works, put it above main and, in PokemonField script
# section before line
# 'if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0' add
# line 'pbLoadRpgxpScene(Scene_Gameover.new) if $game_switches[GAMEOVERSWITCH]'

Translated

# For this script to work, put it above main script section... After that, in PokemonField script
# section before line
# 'if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0' add
# line 'pbLoadRpgxpScene(Scene_Gameover.new) if $game_switches[GAMEOVERSWITCH]'

FL
June 2nd, 2013, 09:17 AM
The English is not the best but.

# To this script works, put it above main and, in PokemonField script
# section before line
# 'if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0' add
# line 'pbLoadRpgxpScene(Scene_Gameover.new) if $game_switches[GAMEOVERSWITCH]'

Translated

# For this script to work, put it above main script section... After that, in PokemonField script
# section before line
# 'if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0' add
# line 'pbLoadRpgxpScene(Scene_Gameover.new) if $game_switches[GAMEOVERSWITCH]'I updated the topic with your description. Thanks for your help!

Nickalooose
June 3rd, 2013, 02:30 PM
No problem at all glad to give you help since you've gave me help in the past :)