Help - Search - Members - Calendar
Full Version: [RGSS] Go to map instead of game over
RPG RPG Revolution Forums > Scripting > Script Development and Support > Script Requests
Redd
So is there a script that makes it so that depending on the value of a variable, it changes what map you go to after you get game over?
Instead of getting game over, it would transfer you to a map, and depending on the value of variable 3, it would change what map you would go to.
That would be awesome if anyone could make this for me smile.gif thank you!
The Law G14
Try this out smile.gif


CODE
#==============================================================================
# Title: Map After Gameover
# Version: 1.0
# Author: The Law G14
#==============================================================================

#==============================================================================
# ** Module: Customization
#------------------------------------------------------------------------------
#  Customization begins here. Do NOT modify anywhere else besides this module.
#==============================================================================

module Customization
  #--------------------------------------------------------------------------
  # * Basic Customization
  #--------------------------------------------------------------------------
  # Game Variables Value (This determines what game variable will be used for
  # finding out which map to transfer to after game over.)
  VARIABLE = 3
  
  # Player direction (This determines what direction the character will face.
  # Up = 8, Down = 2, Left = 4, and Right = 6)
  DIRECTION = 8
  
  #--------------------------------------------------------------------------
  # * Setting Player Coordinates
  #--------------------------------------------------------------------------
  # This sets up what position (x and y) the character will teleport to based
  # on the map ID that was established in the game variable. So the basic
  # setup would be MAP_ID => [PLAYER_X, PLAYER_Y
  PLAYER_COORDS_SETUP = {
  1 => [0, 4],
  2 => [4, 6]
  }
  
end


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

class Scene_Gameover
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias law_mapafgameover_update update
  #--------------------------------------------------------------------------
  # * Module Mix-ins
  #--------------------------------------------------------------------------
  include Customization
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed (Go to Map)
    if Input.trigger?(Input::C)
      # Setup map based on game variable value
      $game_map.setup($game_variables[VARIABLE])
      # Move character to cuztomized x and y coordinates
      $game_player.moveto(PLAYER_COORDS_SETUP[$game_variables[VARIABLE]][0],
          PLAYER_COORDS_SETUP[$game_variables[VARIABLE]][1])
      # Turn player in direction
      case DIRECTION
      when 8 then $game_player.turn_up
      when 2 then $game_player.turn_down
      when 4 then $game_player.turn_left
      when 6 then $game_player.turn_right
      end
      # Set gameover to nil
      $game_temp.gameover = false
      # Switch scene to map scene
      $scene = Scene_Map.new
      # Refresh the game map after all adjustments are finished
      $game_map.refresh
    else
      law_mapafgameover_update
    end
  end
end


#==============================================================================
#
# *** END OF SCRIPT ***
#
#==============================================================================

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.