Revive from Gameover + Gameover menu
Version v1.00:
Author: Omegazion
IntroductionThis script allows you to revive the player on saved revive points (like in some MMORPGs) when he dies.
This script also provides a menu after game over, where you can choose to revive, go to title , load or shutdown.
Features- Game over menu, where you can choose to revive from revive points, go to title, load game or shutdown
- allows revive points as many as you want (well technically, but the texts look stupidly narrow when its above 47)
- Turn on/off access to revive points using a local switch.
- Option to automatically fadeout screen when revived, so you can setup your events first then fade in manually
ScriptCODE
module OZ002
#==============================================================================
# Revive from Gameover + Gameover menu
# by Julian Villaruz of UP diliman(omegazion)
#
# MAHH FIRST SCRIPT EVAHHHH!!! AHMM AA NOOVVV!!
#
# This script gives a menu at the gameover scene and gives you the option
# to revive your character to your own defined revive places, which you can
# enable/disable just by a switch.
#
# You need to have a picture named Gameover_menuback at the Graphics\system folder
# It is the picture shown when at the gameover menu
#
# If you find any bugs, pm me (omegazion) at Rpgrevolution.com or post at the thread.
# You can also e-mail me at julianvillaruz@gmail.com
#
# Instructions and options are below.
#
#==============================================================================
# **Options
#==============================================================================
# Game Over Menu Vocab
Revive = "Revive"
Continue = "Continue"
ToTitle = "To title"
Shutdown = "Shut down"
BackToMenu = "Back to menu"
# Automatically fadeout screen after revive(so that you could process your
# events first before the screen appears then fade in manually through events)
# set value to true/false
AutomaticFadeoutScreen = false
#=Ignore these three lines=====================================================
end
class Scene_Gameover < Scene_Base
def start
#===============================================================================
# **Instructions
#
# Put this script above main
#
# You need to have a Gameover_menuback picture in your graphics/systems
# folder, which will be the background for the menu
#
# To set up a revival point, enter:
# revive_point("name", map id no., map-x, map-y, "direction", switch id)
# "name" = name of the place(this will appear in the menu)(dont forget the "")
# map id no. = id number of the map you want to revive in
# map-x = the x-coordinate in that map
# map-y = the y-coordinate in that map
# "direction" = where character faces(dont forget the "")(lowercase only)
# switchid = the switch that needs to be on to make the revive place available
# make it 0 for the revive point to be always available
# Example:
# revive_point("Heaven", 1, 10, 10, "left", 1)
#-------------------------------------------------------------------------------
# Enter it here exactly below this line (you can have as many as you want)
#-------------------------------------------------------------------------------
super
unless @from_load
RPG::BGM.stop
RPG::BGS.stop
$data_system.gameover_me.play
Graphics.transition(60)
Graphics.freeze
create_gameover_graphic
Graphics.transition(120)
Graphics.fadein(60)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
Graphics.fadeout(120)
break
end
end
end
@sprite.dispose unless @sprite == nil
create_revive_graphic
create_gameover_menu
Graphics.fadein(60) unless @from_load
@command_window.open
@command_window_active = true
end
def initialize(from_load = false)
@from_load = from_load
end
def perform_transition
unless @from_load
Graphics.transition(180)
else
Graphics.transition(10)
end
end
def terminate
super
dispose_gameover_graphic
@command_window.dispose
@revive_window.dispose unless @revive_window == nil or @revive_window.disposed?
$scene = nil if $BTEST
end
def update
super
update_menu_background
if @command_window_active
@command_window.update
if Input.trigger?(Input::C)
Sound.play_decision
case @command_window.index
when 0
create_revive_window
@command_window.openness = 0
@revive_window.open
@command_window_active = false
when 1
$scene = Scene_File.new(false, false, false, true)
@command_window.openness = 0
when 2
Graphics.fadeout(120)
Graphics.freeze
$scene = Scene_Title.new
when 3
$scene = nil
end
end
else
@revive_window.update
if Input.trigger?(Input::B)
return_to_gameover_menu
end
if Input.trigger?(Input::C)
Sound.play_decision
if @revive_window.index == @available.size
return_to_gameover_menu
else
process_revive
end
end
end
end
def create_revive_graphic
@sprite = Sprite.new
@sprite.bitmap = Cache.system("Gameover_menuback")
end
def create_gameover_menu
s1 = OZ002::Revive
s2 = OZ002::Continue
s3 = OZ002::ToTitle
s4 = OZ002::Shutdown
@command_window = Window_Command.new(172, [s1, s2, s3, s4])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = (390 - @command_window.height)
@command_window.openness = 0
end
def revive_point(name, mapid, x, y, direction, switchid = 0)
if @declared == nil
@revive_name = []
@revive_id = []
@revive_x = []
@revive_y = []
@revive_dir = []
@revive_switch = []
@declared = true
end
@revive_name.push(name)
@revive_id.push(mapid)
@revive_x.push(x)
@revive_y.push(y)
dir = 2
case direction
when "up"
dir = 8
when "down"
dir = 2
when "left"
dir = 4
when "right"
dir = 6
end
@revive_dir.push(dir)
@revive_switch.push(switchid)
end
def create_revive_window
revive_place_names = []
@available = []
for i in (0..@revive_name.size - 1)
if ($game_switches[@revive_switch[i]] == true) or @revive_switch[i] == 0
revive_place_names.push(@revive_name[i])
@available.push(i)
else
revive_place_names.push(nil)
end
end
if ((@available.size+1)%16==0)
columns = (@available.size+1)/16
else
columns = (@available.size+1)/16 + 1
end
menu_terms = revive_place_names.compact
menu_terms.push(OZ002::BackToMenu)
column_width = [172*columns, 544].min
@revive_window = Window_Command.new(column_width, menu_terms, columns)
@revive_window.x = (544 - @revive_window.width) / 2
@revive_window.y = (416 - @revive_window.height) / 2
@revive_window.openness = 0
end
def return_to_gameover_menu
Sound.play_cancel
@revive_window.openness = 0
@revive_window.close
@command_window.open
@command_window_active = true
end
def process_revive
i = @available[@revive_window.index]
if $game_party.all_dead?
for actor in $game_party.members
actor.remove_state(1)
end
end
$game_player.reserve_transfer(@revive_id[i], @revive_x[i], @revive_y[i], @revive_dir[i])
Graphics.fadeout(30)
@revive_window.dispose
Graphics.freeze
$scene = Scene_Map.new(true)
$game_map.screen.start_fadeout(1) if OZ002::AutomaticFadeoutScreen
end
end
#-------------------------------------------------------------------------------
class Scene_File < Scene_Base
def initialize(saving, from_title, from_event, from_gameover = false)
@saving = saving
@from_title = from_title
@from_event = from_event
@from_gameover = from_gameover
end
def start
super
create_menu_background unless @from_gameover
@help_window = Window_Help.new
create_savefile_windows
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
else
@index = self.latest_file_index
@help_window.set_text(Vocab::LoadMessage)
end
@savefile_windows[@index].selected = true
end
def terminate
super
dispose_menu_background unless @from_gameover
@help_window.dispose
dispose_item_windows
end
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
elsif @from_gameover
$scene = Scene_Gameover.new(true)
else
$scene = Scene_Menu.new(4)
end
end
def do_load
file = File.open(@savefile_windows[@index].filename, "rb")
read_save_data(file)
file.close
$game_temp = Game_Temp.new
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
end
#-------------------------------------------------------------------------------
class Game_Interpreter
def command_353
$scene = Scene_Gameover.new
@index += 1
return false
end
end
#-------------------------------------------------------------------------------
class Scene_Map < Scene_Base
def initialize(from_gameover = false)
@from_gameover = from_gameover
end
def start
super
if @from_gameover
update_transfer_player_from_gameover
Graphics.freeze
@spriteset.dispose
end
$game_map.refresh
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
end
def update_transfer_player_from_gameover
fade = (Graphics.brightness > 0)
fadeout(30) if fade
$game_player.perform_transfer
$game_map.autoplay
$game_map.update
Graphics.wait(15)
@spriteset = Spriteset_Map.new
fadein(30) if fade
Graphics.transition(80)
$game_temp.next_scene = nil
Input.update
end
def call_gameover
$game_temp.next_scene = nil
unless @from_gameover
$scene = Scene_Gameover.new
else
@from_gameover = false
end
end
end
CustomizationInstructions and options are in the script, you also need to have a graphic named Gameover_menuback at the systems folder, this is what will apear when at the gameover menu.
CompatibilityI'm a first time scripter, how should i know about this? HHmmm.. I override game over scene a lot, i think thats it..
ScreenshotDEMO
InstallationPaste script above main
FAQAll instructions are in the script. Read.
Q: i found an error, blablah
A: Post it here so may resolve it
Q: I have a suggestion
A: lemme hear your suggestions too
Terms and ConditionsFeel free to use in your non-commercial/commercial work as long as credits are included
Credits- Me (omegazion)
This post has been edited by omegazion: Feb 7 2009, 03:47 AM