Custom Continue.

Started by rgangsta, April 13, 2009, 01:56:33 pm

Previous topic - Next topic

rgangsta

April 13, 2009, 01:56:33 pm Last Edit: April 13, 2009, 02:13:23 pm by Starholekirby86
There's a script in RPG Maker VX that enables the actor to continue from a location when he dies.
Spoiler: ShowHide

Spoiler: ShowHide


Can some one make a script like that? Here's the original.
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 = "Continue"
  Continue = "Load"
  ToTitle = "To title"
  Shutdown = "Shut down"
  BackToMenu = "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)
    revive_point("VR System", 2, 1, 7, "right", 1)
    revive_point("VR System", 3, 0, 2, "right", 2)
    revive_point("VR System", 5, 26, 28, "up", 3)
    revive_point("VR System", 13, 6, 10,"up", 6)

#-------------------------------------------------------------------------------
    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

G_G

http://forum.chaos-project.com/index.php?topic=1430.0

It already has been :) Read all of the features and I think its what you want.

rgangsta

April 13, 2009, 02:18:54 pm #2 Last Edit: April 13, 2009, 02:55:15 pm by rgangsta
Sweet.  :haha:

False alarm. I'm using two scripts: Location Window and CPSL. Everytime I try to save or load, there's an error. I need one that compatible with the two.