[XP] Revival Point

Started by tech williams, March 21, 2011, 02:35:04 pm

Previous topic - Next topic

tech williams

March 21, 2011, 02:35:04 pm Last Edit: March 22, 2011, 12:01:12 pm by tech williams
Revival point
Authors: Tech Williams
Version: 1.1
Type: Game Over Over-ride
Key Term: Title / Save / Load / GameOver Add-on



Introduction
I looked for ages for a script like this, and when I couldn't find it I decided to try my hand at scripting, so may I present to you, my very first script.

1.0- Uploaded
1.1- Moved variable configuration to the top of the script for your convenience.


Features


  • Revival points assigned to variables.

  • Option to go to title or shutdown game.




Screenshots
Spoiler: ShowHide




Demo

I doubt one is needed.


Script
This script replaces the default scene_gameover
Spoiler: ShowHide

#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#------------------------------------------------------------------------------
#  Created by Tech Williams. Credit is unnecessary for such a simple script but you can say thanks if you want.
#  Make sure you set the variables below and that its valid. If the variables arn't valid the game will crash.
#==============================================================================

class Scene_Gameover
  #--------------------------------------------------------------------------
  # Configuration
  #--------------------------------------------------------------------------
  # This command respawns to a location specified by three game variables.
  # You can change which variables it looks at by modifying the numbers below.
  # At the moment, there is no error catching, so if the map ID specified in
  # said variable doesn't exist, the game will crash. Use with care!
  #--------------------------------------------------------------------------
  RESPAWN_MAP_VAR = 1
  RESPAWN_X_VAR = 2
  RESPAWN_Y_VAR = 3
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   @transferring = false
   # Make game over graphic
   @sprite = Sprite.new
   @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
   # Make choice window
 #--------------------------------------------------------------------------
 # Here are the choices that will be displayed in the box that is shown on
 # the gameover screen. Just change the strings to change what the options
 # are. Bear in mind, however, that this will only change the text - it
 # won't have any effect on the command that takes place when each command
 # is selected.
 #--------------------------------------------------------------------------
   s1 = "Wake up"
   s2 = "Return to title"
   s3 = "End game"
   @choice_window = Window_Command.new(392, [s1, s2, s3])
   @choice_window.back_opacity = 160
   @choice_window.x = 320 - @choice_window.width / 2
   @choice_window.y = 308
   # 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 choice window
   @choice_window.dispose
   # Dispose of game over graphic
   @sprite.bitmap.dispose
   @sprite.dispose
   # Execute transition
   Graphics.transition(20)
   # Prepare for transition
   Graphics.freeze
   # If battle test
   if $BTEST
     $scene = nil
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update command window
   @choice_window.update
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Branch by command window cursor position
     case @choice_window.index
     when 0  # New game
       command_respawn
     when 1  # Continue
       command_title
     when 2  # End game
       command_shutdown
     end
   end
 end
 
 #--------------------------------------------------------------------------
 # * Command: Respawn (TO SPECIFIED LOCATION)
 #--------------------------------------------------------------------------
 def command_respawn
   #------------------------------------------------------------------------
   respawn_map_id = $game_variables[RESPAWN_MAP_VAR]
    respawn_map_x  = $game_variables[RESPAWN_X_VAR]
    respawn_map_y  = $game_variables[RESPAWN_Y_VAR]
   #------------------------------------------------------------------------
   #Lets commands like transfer player work properly
   $game_temp.in_battle = false
   #Keeps the gameover from playing repetitively.
   $game_temp.gameover = false
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Fade ME
   Audio.me_stop
   # Recover party
   for actor in $game_party.actors
     actor.recover_all
   end
   $game_map.setup(respawn_map_id)
   # Move player to initial position
   $game_player.moveto(respawn_map_x, respawn_map_y)
   # Refresh player
   $game_player.refresh
   # Run automatic change for BGM and BGS set with map
   $game_map.autoplay
   # Update map (run parallel process event)
   $game_map.update
   # Switch to map screen
   $scene = Scene_Map.new
 end

 #--------------------------------------------------------------------------
 # * Command: Return to title
 #--------------------------------------------------------------------------
 def command_title
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Fade out BGM, BGS, and ME
   Audio.me_fade(800)
   # Shutdown
   $scene = Scene_Title.new
 end

 #--------------------------------------------------------------------------
 # * Command: Shutdown
 #--------------------------------------------------------------------------
 def command_shutdown
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Fade out BGM, BGS, and ME
   Audio.me_fade(800)
   # Shutdown
   $scene = nil
 end
end



Instructions
Make sure you set the variables, I don't know how to make an error check so if you don't have valid points the game will crash.
This script replaces scene_gameover.


Compatibility

Well the only thing I tried it on was the default battle system


Credits and Thanks


  • brewmeister for giving me the 2 commands I couldn't find and ending my insanity :haha:

  • Me for having the patience to not delete it as soon as it didn't work.  :^_^':

  • LittleDrago for helping make my script a little easier to use.



Author's Notes

Im thinking of updates like being able to chose what way they face, an option to skip the game over screen completely and an automatic save when you die.
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here

The Niche

Quote from: tech williams on March 21, 2011, 02:35:04 pm
Credits and Thanks


  • brewmeister for giving me the 2 commands I couldn't find and ending my insanity  :haha:

  • Do I have to credit the makers of RPG Maker?






No, you don't, but you should probably credit yourself.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

KoenLemmen

Koen Lemmen

Information:
Spoiler: ShowHide
PS I am dutch. So I could make some typ faults. 8)

More info: :P

Hello I am Koen,
I come from the Netherlands,
and I am still living there.
I playing many games.

Here is a list with favorites:
Saint Row 2
Red Alert 1, 2 and 3
WarRock
AA3

I like making sites and games.
I'm always making my games with RPG Maker XP.
Sometimes I do work with Visual C++ and Adobe Photo shop.

2 years ago I made internet radio. Thats one of my hobby's. Because I like music.

Still questions about me? You can mail me. gamekoen@hotmail.nl or follow me on twitter. www.twitter.com/KoenLemmen.
Greets Koen

Spoiler: ShowHide

Xuroth

Very nice! Once I decide on a plotline and develop my game a little more, I may use this. Level up!

Ryex

Nice, it's true, there really wasn't a script for this. good job finding something that hadn't been done before. *moves*
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

LiTTleDRAgo

suggestion

    #------------------------------------------------------------------------
    respawn_map_id = $game_variables[X]
    respawn_map_x = $game_variables[X]
    respawn_map_y = $game_variables[X]
    #------------------------------------------------------------------------


I think you should done it like this


class Scene_Gameover

  RESPAWN_MAP_VAR = 1
  RESPAWN_X_VAR = 2
  RESPAWN_Y_VAR = 3
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @transferring = false
    # Make game over graphic
    @sprite = Sprite.new
    bla bla bla
    ....
  end



  def command_respawn
    #------------------------------------------------------------------------
    respawn_map_id = $game_variables[RESPAWN_MAP_VAR]
    respawn_map_x  = $game_variables[RESPAWN_X_VAR]
    respawn_map_y  = $game_variables[RESPAWN_Y_VAR]
    #------------------------------------------------------------------------
    bla bla bla...
  end
end


That will help for configuring your script

brewmeister

If the 'respawn' location is fixed throughout the game, the using Constants is neater.

If you want to change the respawn location as you move through the game..  i.e. local respawn locations,
then using game_variables makes it easy to control with events without using "script" commands.

G_G

RESPAWN_MAP_VAR = 1
  RESPAWN_X_VAR = 2
  RESPAWN_Y_VAR = 3

Thats what Drago is using is variables. Those constants are the id's of the variables to use. That way people don't have to scroll through half the script to configure it.

tech williams

I updated it. Thanks LittleDrago.
How is it ninjas exist when they were meant to be silent killers? Shouldn't they be unknown?<br /><br />Hay you...Check out my deviant art.<br />Click here