iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
3 Pages V   1 2 3 >  
Reply to this topicStart new topic
> Checkpoint Gameover (v 2.4), Return to town after dying.
Rating 5 V
Mithran
post Mar 9 2009, 05:15 PM
Post #1


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Checkpoint Gameover v 2.4
by Mithran


Introduction
You may recognize or already be using this one. I did this as a request and posted it a while back, but never really got around to 'finishing' it. After recently seeing a few game over scripts on the front page, it reminded me of this. Basically, this displays a GameOver screen with an option to continue at a prespecified checkpoint. I plan to add some more features at some point, but for now...

Features
- go back to the specified check point after selecting 'continue'
- easy to set checkpoints
- if a checkpoint is not available or not set, no menu is displayed and normal Game Over is used (basically, the whole script is turned off)
- display an alternate game over graphic for the continue screen, if desired
- set a switch on gameover, allowing you to initiate an event when you 'revive'
- save vehicle locations at the time of checkpoint save (it is recommended you still use an event to ensure they do not become inaccessable, though)
- option to skip GameOver screen completely and return directly to checkpoint
- option to bind checkpoint set to the 'save' command

How to Use
Install on its own script page in the materials section of the script editor above main and below default scripts. Should go below any custom game over scenes (but will likely be incompatable)

Script
Spoiler:
CODE
# Checkpoint Gameover
# Version 2.4
# By Mithran at RMVX.net
# Requested by Hamstt
# Alternate graphic and gameover switch features requested by Flood_Master
# Vehicle location save, skip gameover screen, and autocheckpoint save requested
# by squareenix
# changable GameOver screen requested by justbob722
# Last update April 24, 2009
# Please do not redistribute without asking!
# Allows the creator to set a checkpoint to allow the player to continue after
# death.  Displays a menu to allow the player to select to continue.

# If no checkpoint is set, its a standard Game Over and straight to title.
# If a checkpoint is set, the game checks to see whether or not it is enabled.
# If the checkpoint is not enabled, its standard Game Over.  If it is, you get
# a menu asking if you want to continue with your alternate Game Over graphic.

# Usage: Use the following Advanced > Script Commands to change the current
# checkpoint or enable/disable continue.

# Event > Advanced > Script Commands

# set_checkpoint
# Sets checkpoint to the player's current location.

# set_checkpoint_here
# Sets checkpoint to the event's current location.

# clear_checkpoint
# Clears the checkpoint.

# disable_checkpoint
# Disables the use of continue, forcing a game over if a battle is lost.
# This is different than clear_checkpoint, because the checkpoint is perserved
# and may be reenabled.

# enable_checkpoint
# Reenables the checkpoint.  Perserves the last checkpoint set.

# set_checkpoint_to(map_id, x, y, direction)
# Sets the checkpoint to the selected corrdinates.
# Directions - 2 = down, 4 = left, 6 = right, 8 = up
# Example:
# set_checkpoint_to(1, 15, 15, 2)
# Sets the checkpoint to map 1, at coordinate [15, 15] facing down

# set_checkpoint_variable(mapVar, xVar, yVar, direction)
# By using the event Event Command > Control Variable, the creator can store
# map id, x of player, y of player, and direction of player into variables
# use this command to set the checkpoint to these variables at a later time
# Example -
# set_checkpoint_variable(25, 26, 27, 28)
# sets the checkpoint to the map ID stored in variable 25, x coordinate in
# variable 26, y coordinate in variable 27, and direction saved in variable 28

# set_gameover_graphic("filename")
# use this before an just before an evented battle or evented loss to temporarily
# change the graphic.
# Filename goes in quote, as shown above.  The file must be imported into the
# graphics/system folder.  
# The next game over shown will use the picture file selected.  To revert it to
# the default scene (the one set in the module) use:
# clear_gameover_graphic
# If you do not use any argument, it will reset the graphic instead
# The temporary graphic persists over save games.  Getting a game over
# will the graphic, though, so you do not need to manually reset it.

# Install: Insert on the materials page above main and below any custom
# Game Over scenes if used.  (not tested with Custom Game Over scenes)

#=============================== CUSTOMIZATION =================================

module CheckPointGameOver
  GOLD_LOSS_PCT = 0
  # Percentage of gold to be lost when "Continue" is selected
  CUSTOM_GAMEOVER_GRAPHIC = "GameOver"
  # A second graphic that will only display when there is a valid checkpoint
  # The file must be located in the /Graphics/System folder
  # Setting this option to false (without quotes) will use the imported GameOver
  # for both
  
  CLEAR_EVENT_ON_LOSE = true
  # If set to true, getting a Game Over will end event execution.  This only
  # applies to events executed and currently running BEFORE gameover is called.
  # If set to false, the event will continue executing.
  # Unless you really need for an event to continue processing through a game
  # over, this should be left on true.
  GAMEOVER_SWITCH_ID = 25
  # This switch is turned ON after a Game Over.  You can use this to set up
  # conditional branches or a common event to execute certain events after a
  # continue.  NOTE: This only turns this switch ON after Game Over.
  # Switch must be turned off manually by the user!
  RESTORE_ALL = true
  # If set to true, the party will be completely restored on Game Over
  # If set to false, only the first party member will be revived with 1 HP
  # Using this, you can set up an event to decide what you want to be restored
  # after a game over.
  INCLUDE_SHUTDOWN = true
  # Includes a shut down command on the continue menu if set to true.
  
  SKIP_GAMEOVER = false
  # Skips the Game Over screen completley and returns to checkpoint
  # immediatley on GameOver.
  
  RETURN_VEHICLES = true
  # Returns vehicles to their locations at the time of the last checkpoint save.
  
  SET_CHECKPOINT_ON_SAVE = false
  # Sets the checkpoint to the current location automatically just before
  # the 'save' command is executed.

#====================== DO NOT CHANGE ANYTHING BELOW HERE ======================
  
end


#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#==============================================================================

class Scene_Gameover < Scene_Base
  
  unless $@
  class << self
    alias new_checkpoint_gameover new
    def new
      if !$game_system.disable_checkpoint && CheckPointGameOver::SKIP_GAMEOVER
        if CheckPointGameOver::GAMEOVER_SWITCH_ID > 0
          $game_switches[CheckPointGameOver::GAMEOVER_SWITCH_ID] = true
        end
        RPG::BGM.fade(80)
        RPG::BGS.fade(80)
        RPG::ME.fade(80)
        Scene_Gameover.new_checkpoint_gameover.back_to_checkpoint
        Graphics.fadeout(30)
        Graphics.wait(15)
        return Scene_Map.new
      else
        new_checkpoint_gameover
      end
    end
  end
  end
  
  alias start_gameover_checkpoint start
  def start
    if CheckPointGameOver::GAMEOVER_SWITCH_ID > 0
      $game_switches[CheckPointGameOver::GAMEOVER_SWITCH_ID] = true
    end
    start_gameover_checkpoint
    create_command_window unless $game_system.disable_checkpoint
  end
    
  def create_command_window
    sels = [Vocab.continue, Vocab.to_title]
    sels << Vocab.shutdown if CheckPointGameOver::INCLUDE_SHUTDOWN
    @command_window = Window_Command.new(172, sels)
    @command_window.x = (Graphics.width - @command_window.width) / 2
    @command_window.y = Graphics.height - (@command_window.height + 32)
    @command_window.index = 0
    @command_window.openness = 0
    @command_window.open
  end

  alias update_inputsA update
  def update
    if @command_window
      update_inputsB
    else
      update_inputsA
    end
  end
  
  alias create_gameover_graphic_checkpoint create_gameover_graphic
  def create_gameover_graphic
    create_gameover_graphic_checkpoint
    unless $game_system.disable_checkpoint || $game_system.gameover_graphic
      @sprite.bitmap = Cache.system(CheckPointGameOver::CUSTOM_GAMEOVER_GRAPHIC) if CheckPointGameOver::CUSTOM_GAMEOVER_GRAPHIC
    end
    if $game_system.gameover_graphic != nil
      @sprite.bitmap = Cache.system($game_system.gameover_graphic)
    end
  end
  
  alias terminate_checkpoint terminate
  def terminate
    @command_window.dispose unless @command_window.nil?
    terminate_checkpoint
  end
  
  def command_shutdown
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    $scene = nil
  end
  
  def command_continue
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    back_to_checkpoint
    fade = (Graphics.brightness > 0)
    Graphics.fadeout(30)
    $scene = Scene_Map.new
    Graphics.wait(15)
  end
      
  def command_title
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    $scene = Scene_Title.new
    Graphics.fadeout(120)
  end
    
  def update_inputsB
    @command_window.update unless @command_window.nil?
    if Input.trigger?(Input::C) && !@command_window.nil?
      case @command_window.index
      when 0 # Continue
        command_continue; return
      when 1 # To Title
        command_title; return
      when 2 # Shutdown
        command_shutdown; return
      end
    end
    update_inputsA
  end
  
  def back_to_checkpoint
    $game_party.clear_actions
    $game_troop.clear
    $game_temp.battle_proc = nil
    $game_system.gameover_graphic = nil
    check = $game_system.checkpoint
    recover_party
    $game_party.lose_gold($game_party.gold * CheckPointGameOver::GOLD_LOSS_PCT / 100)
    map_id = check[0]
    x = check[1]
    y = check[2]
    direction = check[3]
    move_to_checkpoint(map_id, x, y, direction)
    $game_map.autoplay              # Automatically switch BGM and BGS
    $game_map.update
    clear_events if CheckPointGameOver::CLEAR_EVENT_ON_LOSE
  end
  
  def recover_party
    if CheckPointGameOver::RESTORE_ALL
      for actor in $game_party.members
        actor.recover_all
      end
    else
      $game_party.members[0].hp = 1 unless $game_party.members[0].nil?
    end
  end
  
  def clear_events
    $game_troop.clear
    $game_map.interpreter.setup(nil)
  end
  
  def move_to_checkpoint(map_id, x, y, direction)
    if $game_player.vehicle_type > 0
      $game_player.get_off_vehicle_simple
    end
    $game_player.set_direction(direction)
    $game_map.setup(map_id)     # Move to other map
    $game_player.moveto(x, y)
    return unless CheckPointGameOver::RETURN_VEHICLES
    $game_system.vehicle_locs.each_with_index { |v, i|
      $game_map.vehicles[i].set_location(v[0], v[1], v[2])
    }
  end

end

class Game_Player
  
  def get_off_vehicle_simple
    $game_map.vehicles[@vehicle_type].get_off     # Get off processing
    @transparent = false                        # Remove transparency
    @through = false                              # Passage OFF
    @move_speed = 4                               # Return move speed
    @vehicle_type = -1
  end

end


class Game_System
  attr_accessor :checkpoint
  attr_accessor :disable_checkpoint
  attr_accessor :vehicle_locs
  
  alias initialize_checkpoint_gameover initialize
  def initialize
    initialize_checkpoint_gameover
    @vehicle_locs = []
  end
  
  def checkpoint
    return @checkpoint
  end
  
  def disable_checkpoint
    @disable_checkpoint ||= false
    return true if checkpoint.nil?
    return @disable_checkpoint
  end    
    
end

class Game_Interpreter
  def set_checkpoint
    set_checkpoint_to($game_map.map_id, $game_player.x, $game_player.y, $game_player.direction)
  end
  
  def command_353
    $game_temp.next_scene = "gameover"
    @index += 1
    return false
  end
  
  def set_checkpoint_here
    if $game_map.events[@original_event_id] != nil
      checkx = $game_map.events[@original_event_id].x
      checky = $game_map.events[@original_event_id].y
      set_checkpoint_to(@map_id, checkx, checky, $game_player.direction)
    end
  end
  
  def clear_checkpoint
    $game_system.checkpoint = nil
  end
  
  def enable_checkpoint
    $game_system.disable_checkpoint = false
  end
  
  def disable_checkpoint
    $game_system.disable_checkpoint = true
  end
  
  def set_checkpoint_to(mapidnum, xcoord, ycoord, direct = 2)
    direct = 2 if (direct > 8) || (direct % 2 == 1) || (direct < 2)
    $game_system.checkpoint = [mapidnum, xcoord, ycoord, direct]
    $game_system.vehicle_locs = []
    $game_map.vehicles.each_with_index { |v, i|
      $game_system.vehicle_locs[i] = [v.map_id, v.x, v.y, v.direction]
    }      
  end
    
  def set_checkpoint_variable(var1, var2, var3, var4 = 0)
    direct = $game_variables[var4]
    direct = 2 if var4 == 0
    mapidnum = $game_variables[var1]
    xcoord = $game_variables[var2]
    ycoord = $game_variables[var3]
    set_checkpoint_to(mapidnum, xcoord, ycoord, direct)
  end
  
  def set_gameover_graphic(filename = nil)
    $game_system.gameover_graphic = filename
  end
  
  def clear_gameover_graphic
    set_gameover_graphic
  end
  
end

class Scene_File
  
  alias write_save_data_checkpoint_gameover write_save_data
  def write_save_data(*args)
    $game_map.interpreter.set_checkpoint if CheckPointGameOver::SET_CHECKPOINT_ON_SAVE
    write_save_data_checkpoint_gameover(*args)
  end
  
end

class Game_Vehicle
  attr_reader :map_id
end

class Game_System
  attr_accessor :gameover_graphic
end


Demo
None at the moment.

Compatability
Incompatable with other game over screens that have a command window. Untested with other custom/animated game over scenes.

Future Plans
I have plans to add the option to allow a limited number of continues (based on a variable or an inventory item), and a multicheckpoint system. Depending on implemntation, these features can be evented in, so this is low priority.

FAQ

q. How do I add a different game over screen for the continue window?
a. Import your custom screen into the /Graphics/System folder in the editor and name it something easy to remember (GameOver2). In the script, go to the line CUSTOM_GAMEOVER_GRAPHIC = "GameOver" and change the quoted part to the filename. (CUSTOM_GAMEOVER_GRAPHIC = "GameOver2")

q. How do I change the gameover graphic in game?
a. Use the event command: set_gameover_graphic("filename")
Replace "filename" with the name of your gameover graphic in the Graphics/System folder of your project. This change only lasts until the next Game Over screen is displayed.

Credit and Thanks
- Mithran
- original request by Hamstt
- additional feature requests by Flood_Master
- additional feature requests by squareenix
- additional feature requests by justbob772

Author's Notes
Feedback is welcome. Please give credit if used. Please do not redistribute/repost without asking.

This post has been edited by Mithran: Oct 25 2009, 04:16 PM


--------------------
Go to the top of the page
 
+Quote Post
   
Sasame Kiryu
post Mar 9 2009, 06:25 PM
Post #2


どのような
Group Icon


Type: Writer
Alignment: Chaotic Neutral




This is AWESOME!! I was just about to start scripting something like this for myself, but now I don't have to ^~^ I think it would've been a long and arduous task with how little knowledge I have outside of windows and scenes...

Thanks~
Go to the top of the page
 
+Quote Post
   
Zero86-Sk
post Mar 14 2009, 06:36 PM
Post #3



Group Icon


Type: Undisclosed




this is really cool
Go to the top of the page
 
+Quote Post
   
squareenix
post Mar 14 2009, 10:19 PM
Post #4



Group Icon


Type: Undisclosed




I was wondering if you could make it so that the script would register the checkpoint no matter where you saved your game.
In other words, it would be like final fantasy vi, where you could save anywhere on the world map, but only on certain save points inside towns and dungeons.
Also, it would be helpful if the script could skip the game over screen altogether, and just move the player back to the last save point.

Does this script save the locations of vehicles?

As a side note, I'll tell you how this script can be made compatible with HARTS HORN's caterpillar system script.
under $game_player.set_direction(direction) and $game_player.moveto(x, y) in move_to_checkpoint,
you add
$game_subplayer1.set_direction(direction)
$game_subplayer1.moveto(x,y)...
and so on.
Go to the top of the page
 
+Quote Post
   
Mithran
post Mar 14 2009, 11:40 PM
Post #5


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (squareenix @ Mar 14 2009, 03:19 PM) *
I was wondering if you could make it so that the script would register the checkpoint no matter where you saved your game.
In other words, it would be like final fantasy vi, where you could save anywhere on the world map, but only on certain save points inside towns and dungeons.
Also, it would be helpful if the script could skip the game over screen altogether, and just move the player back to the last save point.

Does this script save the locations of vehicles?

As a side note, I'll tell you how this script can be made compatible with HARTS HORN's caterpillar system script.
under $game_player.set_direction(direction) and $game_player.moveto(x, y) in move_to_checkpoint,
you add
$game_subplayer1.set_direction(direction)
$game_subplayer1.moveto(x,y)...
and so on.


Excellect suggestions, though I have never worked with that particular catterpillar system before, and I dont have a copy of it to make it 100% compatable, so feel free to make those changes to your personal script. The other stuff was easy enough to implement, so I went ahead and added it.

Update

v 2.3
- New Feature: Save vehicle locations. Save the locations of all vehicles when a checkpoint is set.
- New Feature: Skip GameOver. Option to set to skip the gameover completely if there is an active checkpoint.
- New Feature: Bind to save point. Option to set the checkpoint location automatically when the game is saved.

Modified script is in original post.


--------------------
Go to the top of the page
 
+Quote Post
   
squareenix
post Mar 21 2009, 05:59 AM
Post #6



Group Icon


Type: Undisclosed




Although I really ought to be thanking you for this, I noticed a bug in the code. If you die when you are in a vehicle,
when the script warps you back to your last save spot, you are still on the vehicle regardless of whether you
were in a vehicle when you saved. Hopefully this will be a easy fix...
Go to the top of the page
 
+Quote Post
   
Mithran
post Mar 21 2009, 08:33 AM
Post #7


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (squareenix @ Mar 20 2009, 10:59 PM) *
Although I really ought to be thanking you for this, I noticed a bug in the code. If you die when you are in a vehicle,
when the script warps you back to your last save spot, you are still on the vehicle regardless of whether you
were in a vehicle when you saved. Hopefully this will be a easy fix...


Good catch. I never considered someone getting a 'Game Over' while actually riding in a vehicle. This should fix it.

Update

v 2.3b
- Bugfix: Automatically unboards vehicles on Game Over so they no longer return with you to checkpoint as if you are driving them. This can leave certain vehicles stranded if you do not use the 'RETURN_VEHICELS' option, so be sure to move them in your revive event if you do not use this option and it is still possible to get game over while riding in a vehicle in your game.

Previous Changes:
Spoiler:
v 2.3
- New Feature: Save vehicle locations. Save the locations of all vehicles when a checkpoint is set.
- New Feature: Skip GameOver. Option to set to skip the gameover completely if there is an active checkpoint.
- New Feature: Bind to save point. Option to set the checkpoint location automatically when the game is saved.


Modified script is in original post.

This post has been edited by Mithran: Mar 21 2009, 08:34 AM


--------------------
Go to the top of the page
 
+Quote Post
   
Ripley
post Mar 27 2009, 09:51 AM
Post #8


Robotic Squirrel
Group Icon






Okay i'm having a little trouble here, i've added the script, placed my checkpoint and yet whenever i (while alive) set foot on the map, BAM!

I'm slapped with this error:

Spoiler:
Script 'Checkpoint Script' line 340: NoMethodError occured.
undefined method '[]= for nil:NilClass


Do i need to add something to the script or just scrap the idea?
Please help!

This post has been edited by Ripley: Mar 27 2009, 09:51 AM


--------------------


It looks like a ordinary penny....because it IS a ordinary penny!!

They've locked down their fortress!....with locks!!

Dib: You can't make me look! I'll just shut my eyes.
Zim: Oh, you'll open them. You have to breath sometime.
Dib: No, I - Wait... What do eyes have to do with breathing?


Nik: Hey look, there's a binary system. Ever been to a binary system before?
Oog-Ah: Mmm...
Nik: Would it... would it kill you to say something?
Oog-Ah: Quiet or I'll eat your head. That enough words for you?
Nik: I... I was just making conversation...
Go to the top of the page
 
+Quote Post
   
Mithran
post Mar 27 2009, 10:04 AM
Post #9


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Did you download this on the day I was updating it? This error occured for a couple hours on that day when I was messing with the post. As of the currently posted script, vehicle locs should never be nil.

If you are still experiencing the problem, are you using any custom vehilcle scripts? If not that, I'll take another look.


--------------------
Go to the top of the page
 
+Quote Post
   
Ripley
post Mar 27 2009, 01:49 PM
Post #10


Robotic Squirrel
Group Icon






I'm not using any custom vehicle scripts and i tried re-entering the script and unfortunately it still didn't work.


--------------------


It looks like a ordinary penny....because it IS a ordinary penny!!

They've locked down their fortress!....with locks!!

Dib: You can't make me look! I'll just shut my eyes.
Zim: Oh, you'll open them. You have to breath sometime.
Dib: No, I - Wait... What do eyes have to do with breathing?


Nik: Hey look, there's a binary system. Ever been to a binary system before?
Oog-Ah: Mmm...
Nik: Would it... would it kill you to say something?
Oog-Ah: Quiet or I'll eat your head. That enough words for you?
Nik: I... I was just making conversation...
Go to the top of the page
 
+Quote Post
   
Mithran
post Mar 27 2009, 06:49 PM
Post #11


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (Ripley @ Mar 27 2009, 06:49 AM) *
I'm not using any custom vehicle scripts and i tried re-entering the script and unfortunately it still didn't work.


Well, I wasnt able to duplicate the problem, but I added one more nil trap. It shouldn't be needed, so if this doesnt fix it, I'll need further info such as other scripts you are using, etc. On further thought, you are probably using a script that overwrote the 'initialize' method for Game_System. This should still fix this issue, though.

Update

v 2.3c
- Bugfix: Fixed? A potential crashing issue when setting a checkpoint.

Previous Changes:
Spoiler:
v 2.3b
- Bugfix: Automatically unboards vehicles on Game Over so they no longer return with you to checkpoint as if you are driving them. This can leave certain vehicles stranded if you do not use the 'RETURN_VEHICELS' option, so be sure to move them in your revive event if you do not use this option and it is still possible to get game over while riding in a vehicle in your game.

v 2.3
- New Feature: Save vehicle locations. Save the locations of all vehicles when a checkpoint is set.
- New Feature: Skip GameOver. Option to set to skip the gameover completely if there is an active checkpoint.
- New Feature: Bind to save point. Option to set the checkpoint location automatically when the game is saved.


Modified script is in original post.


--------------------
Go to the top of the page
 
+Quote Post
   
xnblaze
post Apr 7 2009, 10:19 AM
Post #12



Group Icon






can u allow it to have a certain amount of game over revive uses until u cant revive anymore?
like having "3 lives/tries" for example :x
Go to the top of the page
 
+Quote Post
   
Mithran
post Apr 9 2009, 01:17 PM
Post #13


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (xnblaze @ Apr 7 2009, 03:19 AM) *
can u allow it to have a certain amount of game over revive uses until u cant revive anymore?
like having "3 lives/tries" for example :x


Yes, this is on my list for features eventually, but it wont be soon. For now, you can event this. In the event that sets the checkpoint, have it set a variable of your choice to 3. In addition, use the command enable_checkpoint.

Next, make an an autorun common event, with the condition switch being the gameover switch (whatever you set the gameover switch as). This event will be run as soon as you revive. In this event, have it subtract 1 from the variable. Next, have the event check if the variable has reached 0. Finally, this event will turn the gameover switch OFF.

Should resemble this:

> control variables [number of continues] -= 1
>conditional branch [number of continues] <= 0
> Advanced > Script > disable_checkpoint
> end branch
> operate switches [gameover switch] = OFF

So, when you reach a new checkpoint, it will set the checkpoint, set the continues to 3 and enable continuing to checkpoints. If you die, a single continue is subtracted. If you have no continues left, the next time you die, its game over.


--------------------
Go to the top of the page
 
+Quote Post
   
xnblaze
post Apr 9 2009, 02:54 PM
Post #14



Group Icon






thanks i never thought of that.
Go to the top of the page
 
+Quote Post
   
shaken_bacon
post May 7 2009, 08:51 PM
Post #15



Group Icon


Type: Designer




This is an awesome script, I was thinking about doing this in my game through events, but that saves a whole lot of trouble. Thank you!
Go to the top of the page
 
+Quote Post
   
Mithran
post May 10 2009, 03:17 AM
Post #16


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Thanks for the support. Here is a minor update.

Update

v 2.4
- Enhancment: Changable game over graphic. Change the graphic of the next game over screen on-the-fly in game for the span of a single game over. Easily revert it back to the default. Intended for 'event specific' gameover screens.

Previous Changes:
Spoiler:
v 2.3c
- Bugfix: Fixed? A potential crashing issue when setting a checkpoint.

v 2.3b
- Bugfix: Automatically unboards vehicles on Game Over so they no longer return with you to checkpoint as if you are driving them. This can leave certain vehicles stranded if you do not use the 'RETURN_VEHICELS' option, so be sure to move them in your revive event if you do not use this option and it is still possible to get game over while riding in a vehicle in your game.

v 2.3
- New Feature: Save vehicle locations. Save the locations of all vehicles when a checkpoint is set.
- New Feature: Skip GameOver. Option to set to skip the gameover completely if there is an active checkpoint.
- New Feature: Bind to save point. Option to set the checkpoint location automatically when the game is saved.


Modified script is in original post.


--------------------
Go to the top of the page
 
+Quote Post
   
Zero2009
post May 31 2009, 05:55 AM
Post #17



Group Icon


Type: Artist




Hey dude great script! U saved my butt with this one man!
But i have a problem. When i revive all the music just stops for some reason. Its like i revive in the map and there is no map music or battle music just the sound effects. Did i do something wrong?
Go to the top of the page
 
+Quote Post
   
Mithran
post May 31 2009, 07:30 AM
Post #18


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (Zero2009 @ May 30 2009, 10:55 PM) *
Hey dude great script! U saved my butt with this one man!
But i have a problem. When i revive all the music just stops for some reason. Its like i revive in the map and there is no map music or battle music just the sound effects. Did i do something wrong?


The music that plays after you get a checkpoint gameover would be the music of the map you are warping to. It is set up to autoplay, however, only if the map has the box checked for 'automatically change BGM' in the editor. There is a slight pause while the ME for gameover fades out if you click it really really fast, but it should play right after. It should have no effect at all on the music in battle on your battles after reviving. If you are using another script or command that changes the music before the checkpoint gameover is activated, keep in mind that these settings will carry over after revival. Other than that, I cant see how this script would be causing that problem. I just checked it again and I can't duplicate the problem. If the problem persists, please PM me with a demo link so I can investigate further.


--------------------
Go to the top of the page
 
+Quote Post
   
Zero2009
post May 31 2009, 03:26 PM
Post #19



Group Icon


Type: Artist




QUOTE (Mithran @ May 31 2009, 03:30 AM) *
The music that plays after you get a checkpoint gameover would be the music of the map you are warping to. It is set up to autoplay, however, only if the map has the box checked for 'automatically change BGM' in the editor. There is a slight pause while the ME for gameover fades out if you click it really really fast, but it should play right after. It should have no effect at all on the music in battle on your battles after reviving. If you are using another script or command that changes the music before the checkpoint gameover is activated, keep in mind that these settings will carry over after revival. Other than that, I cant see how this script would be causing that problem. I just checked it again and I can't duplicate the problem. If the problem persists, please PM me with a demo link so I can investigate further.



I think i know what the problem is. Let me give you the ME file I'm using for my game for the death/revive screen.
http://starmen.net/mother2/music/
Follow this link and download the song called "A Bad Dream" and set it as the death music. Then maybe you'll get the same thing i did... Hopefully...
Thanks anyways buddy!
Go to the top of the page
 
+Quote Post
   
Mithran
post May 31 2009, 05:25 PM
Post #20


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (Zero2009 @ May 31 2009, 08:26 AM) *
I think i know what the problem is. Let me give you the ME file I'm using for my game for the death/revive screen.
http://starmen.net/mother2/music/
Follow this link and download the song called "A Bad Dream" and set it as the death music. Then maybe you'll get the same thing i did... Hopefully...
Thanks anyways buddy!


Thanks, that helped me identify the source of the problem. Apparently, using the 'fade' command on a ME will make its volume gradually drop to zero, however, it will not 'stop' it. If any ME is 'playing', it superceeds the effects of any BGM playing - even if you can't hear it. I could put in some RPG::ME.stop lines in the above script to prevent this from happening, but it renders the whole point of the fadeout rather moot, and I find this default behavior annoying. Instead, I wrote this patch:

Spoiler:
CODE
# ME Stop After Fade
# Forcefully stops any ME after it has faded out completely.
# If you change ME before the fade is completed, the stop command will not
# execute, so doing so is safe.
# Original Author - Mithran 5/31/09

unless $@
class RPG::ME
  @@current = RPG::ME.new
  @@force_stop_thread = Thread.new {}
  alias play_forcestop play
  def play
    # save currently playing ME
    if name.empty?
      @@current = RPG::ME.new
    else
      if @@current != self
        # if the ME was changed at any time, lets make sure that the ME will
        # be 'different' so if the ME was changed back, the fade still wont
        # be executed
        @@current = self.clone
      else
        @@current = self
      end
    end
    play_forcestop
  end
  
  class << self
    alias fade_forcestop fade
    def fade(time)
      last = @@current
      # saves currently playing ME into a local for comparison
      @@force_stop_thread = Thread.new { sleep(time / 1000.0); stop if last == @@current }
      # opens a new thread to run parallel to the current thread
      # this thread will do nothing for the exact amount of time the fade is for
      # then compare last to @@current
      # if they are the same (music was not changed) a forced stop will be executed
      fade_forcestop(time) # begin fading ME
    end
    
    alias stop_forcestop stop
    def stop
      @@current = RPG::ME.new
      stop_forcestop
    end
    
    def current
      return @@current
    end
    
  end
end
end


That fixes the 'fade' command so that it actually stops the ME when it fades out completely. It works on all ME fades, not just the ones in this script, so if you would rather not use this functionality, just locate the line RPG::ME.fade(800) at about line 206 in my script and change it to RPG::ME.stop. Thanks for the report. Let me know if you have any further problems.


--------------------
Go to the top of the page
 
+Quote Post
   

3 Pages V   1 2 3 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 1st October 2014 - 05:25 PM

RPGMakerVX.net is an Privacy Policy, Legal.