Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Revive from Game over + Gameover menu, My FIrst Script Ever.
omegazion
post Aug 7 2008, 10:13 PM
Post #1


Level 1 / 0
Group Icon

Group: Revolutionary
Posts: 198
Type: Scripter
RM Skill: Masterful





Revive from Gameover + Gameover menu

Version v1.00:
Author: Omegazion


Introduction

This 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

Script
[Show/Hide] The script

CODE
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




Customization

Instructions 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.

Compatibility

I'm a first time scripter, how should i know about this? HHmmm.. I override game over scene a lot, i think thats it..

Screenshot
[Show/Hide] Screenie





DEMO



Installation

Paste script above main

FAQ

All 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 Conditions

Feel 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
Attached File(s)
Attached File  ReviveFromGameoverDemo.zip ( 486.25K ) Number of downloads: 157
 


__________________________

Those who live by the sword, Die by the gun.
Go to the top of the page
 
+Quote Post
   
GunZz
post Aug 8 2008, 03:11 AM
Post #2


Level 4
Group Icon

Group: Member
Posts: 47
Type: None
RM Skill: Undisclosed




Its a pretty nice script i like it gratzz for the maker .
Go to the top of the page
 
+Quote Post
   
Grandhoug
post Aug 8 2008, 02:27 PM
Post #3


Level 5
Group Icon

Group: Member
Posts: 70
Type: Developer
RM Skill: Undisclosed




I would say nothin special, but then again it is something special, and I was wondering if your able to make like a item have the points so that if you find it you get points. Nvm I found it

This post has been edited by Grandhoug: Aug 8 2008, 02:30 PM


__________________________
Fly like a rhino, sting like shock paddles.
Go to the top of the page
 
+Quote Post
   
JoRu
post Aug 8 2008, 02:58 PM
Post #4


The 15-year old Swedish Meatball
Group Icon

Group: Revolutionary
Posts: 280
Type: Developer
RM Skill: Advanced




Found one little strange thing (I always find the strangest bugs). If you get a game over and choose to load. If you then press Esc you will be transported back into the game and to the menu. I don't know if it has anything to do with the custom menu-script I'm using (Ring Menu VX).


__________________________


Stay tuned for more information about Fairytale. To stay updated on all my project videos, visit my YouTube page!

QUOTE (JoRu)
Life is a game!
Go to the top of the page
 
+Quote Post
   
omegazion
post Aug 9 2008, 05:12 AM
Post #5


Level 1 / 0
Group Icon

Group: Revolutionary
Posts: 198
Type: Scripter
RM Skill: Masterful




hmmm.. i cannot find anything wrong, uhm... give me a copy of Ring menu vx.


__________________________

Those who live by the sword, Die by the gun.
Go to the top of the page
 
+Quote Post
   
soytuosito
post Aug 11 2008, 10:57 AM
Post #6



Group Icon

Group: Member
Posts: 1
Type: None
RM Skill: Beginner




Script muy muy útil!!! laugh.gif
Go to the top of the page
 
+Quote Post
   
Ordon
post Jan 28 2009, 11:22 PM
Post #7


Level 2
Group Icon

Group: Member
Posts: 19
Type: None
RM Skill: Undisclosed




Is it possible 'unlock' revive points as you play the game? Don't want them all active in the beginning, I'm sure.


__________________________
Yeah, I ramble. Get over it.


Go to the top of the page
 
+Quote Post
   
onidsouza
post Jan 29 2009, 06:48 PM
Post #8


image master of doom
Group Icon

Group: Revolutionary
Posts: 603
Type: None
RM Skill: Undisclosed




Just like a WOW respawn system... Very Nice! i was making this script, but i guived up tongue.gif
For sure i will try this one! happy.gif


__________________________
Gabba Gabba Hey! enjoy your life ^^
lol (by keet's brother)
some lol
more lol
even MORE lol
Serious Discussion
why all my lol's have Teh Parakeet involved?

me ^^

bacon

Spamming is always better with bacon
Go to the top of the page
 
+Quote Post
   
sandy
post Feb 14 2009, 12:41 PM
Post #9


Level 17
Group Icon

Group: Revolutionary
Posts: 329
Type: None
RM Skill: Undisclosed




Interesting take on the death system, omegazion & great idea for a first script. I'd like to see features like this used in more games smile.gif

Nice to see beginner scripters already knowing to use constants/modules for their settings too. I don't see that often in someone's first scripts


__________________________
RPG Maker VX Resources - Blogthing updated daily with new stuff you can use
Temporarily not be updated daily. My bad!
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 08:41 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker