Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓#
- #↓ ↓#
- #↓ Teleportation System: Version 1.0 ↓#
- #↓ ↓#
- #↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕#
- #↑ ↑#
- #↑ Written By: Joe Pro ↑#
- #↑ Last Edited: July 31, 2014 ↑#
- #↑ ↑#
- #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑#
- ################################################################################
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙ ** Disclaimer ◙#
- #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙#
- #◙ ◙#
- #◙ This script is not for commercial, if you wish to use this script in a ◙#
- #◙ game please PM me. All credit is to be given to me as the author of this ◙#
- #◙ script. ◙#
- #◙ ◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙ ** How To Use ◙#
- #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙#
- #◙ ◙#
- #◙ * Cusomizable area below. ◙#
- #◙ ◙#
- #◙ * Use the following command in a script call to call the teleport scene. ◙#
- #◙ teleport ◙#
- #◙ ◙#
- #◙ * Use the following command in a script call to add a location. ◙#
- #◙ add_location(id_from_list_below) ◙#
- #◙ ◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙ ** Updates / Version Notes ◙#
- #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙#
- #◙ ◙#
- #◙ v0.1 ◙#
- #◙ ~◄◙◙◙◙►~ ◙#
- #◙ * This script creates a menu that displays areas the player can travel to. ◙#
- #◙ ◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- ################################################################################
- #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓#
- #↓ ↓#
- #↕ Teleportation System: Version 0.1 ↕#
- #↑ ↑#
- #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑#
- ################################################################################
- #==============================================================================
- # ** Teleportation System
- #------------------------------------------------------------------------------
- # This module manages the customizable and function modules.
- #==============================================================================
- module Teleportation_System
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #=============================================================================
- # * Fade Type
- #=============================================================================
- Fade_Type = "Normal"
- #=============================================================================
- # * Menu Windows BG Options
- #=============================================================================
- Teleport_SE = "Teleport"
- Volume = 80
- Pitch = 100
- #=============================================================================
- # * Teleport Header Text
- #=============================================================================
- Teleport_Header_Text = "Where would you like to teleport to?"
- #=============================================================================
- # * Locations
- #=============================================================================
- Locations = {
- #Location ID
- 0 => { :display_name => "Adomite Factory",
- #[Map_id, X_Tile, Y_Tile, Direction]
- :location => [ 4 , 8 , 4 , 2 ],
- },
- 1 => { :display_name => "AEIOU Facility",
- #[Map_id, X_Tile, Y_Tile, Direction]
- :location => [ 5 , 3 , 55 , 2 ],
- },
- 2 => { :display_name => "Creadair Chamber",
- #[Map_id, X_Tile, Y_Tile, Direction]
- :location => [ 6 , 3 , 4 , 4 ],
- },
- }
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙End Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
- end
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system data. It saves the disable state of saving and
- # menus. Instances of this class are referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :teleport_locations # Teleport Locations
- attr_accessor :teleporting # Teleport Locations
- attr_accessor :list_window_index # Teleport Locations
- #--------------------------------------------------------------------------
- # * Aliasing Method: Object Initialization
- #--------------------------------------------------------------------------
- alias :gsi04506451 :initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- gsi04506451()
- @teleport_locations = {}
- @teleporting = false
- @list_window_index = 0
- end
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # This class handles maps. It includes scrolling and passage determination
- # functions. The instance of this class is referenced by $game_map.
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Aliasing Method: Object Initialization
- #--------------------------------------------------------------------------
- alias :gmu046560 :update
- #--------------------------------------------------------------------------
- # * Frame Update
- # main: Interpreter update flag
- #--------------------------------------------------------------------------
- def update(main = false)
- transfer_player if $game_system.teleporting == true
- gmu046560(main)
- end
- #--------------------------------------------------------------------------
- # * Teleport Locations
- #--------------------------------------------------------------------------
- def fade_type
- Teleportion_System::Specs::Fade_Type
- end
- #--------------------------------------------------------------------------
- # * Teleport Locations
- #--------------------------------------------------------------------------
- def teleport_se
- ["Audio/SE/" + Teleportation_System::Teleport_SE, Teleportation_System::Volume, Teleportation_System::Specs::Pitch]
- end
- #--------------------------------------------------------------------------
- # * Teleport Locations
- #--------------------------------------------------------------------------
- def current_map_info
- $game_system.teleport_locations[$game_system.list_window_index][:location]
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- # main: Interpreter update flag
- #--------------------------------------------------------------------------
- def transfer_player
- $game_system.teleporting = false
- map_id = current_map_info[0]
- x = current_map_info[1]
- y = current_map_info[2]
- direction = current_map_info[3]
- $game_player.reserve_transfer(map_id, x, y, direction)
- $game_temp.fade_type = 1
- Audio.se_play(teleport_se[0], teleport_se[1], teleport_se[2])
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # An interpreter for executing event commands. This class is used within the
- # Game_Map, Game_Troop, and Game_Event classes.
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Calls Scene_Teleport Class
- #--------------------------------------------------------------------------
- def teleport
- SceneManager.call(Scene_Teleport)
- end
- #--------------------------------------------------------------------------
- # * Add Location by Name
- #--------------------------------------------------------------------------
- def add_location(id)
- $game_system.teleport_locations[id] = Teleportation_System::Locations[id]
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This is a super class of all windows within the game.
- #==============================================================================
- class Window_LocationHeader < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh Processing
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_text_ve(-10, -10, ((Graphics.width / 5) * 3), 50, Teleportation_System::Teleport_Header_Text, 1, 20)
- end
- end
- #==============================================================================
- # ** Window_Command
- #------------------------------------------------------------------------------
- # This window deals with general command choices.
- #==============================================================================
- class Window_ConfirmLocation < Window_Command
- #--------------------------------------------------------------------------
- # * Refresh Processing
- #--------------------------------------------------------------------------
- def alignment
- return 1
- end
- #--------------------------------------------------------------------------
- # * Refresh Processing
- #--------------------------------------------------------------------------
- def col_max
- return item_max
- end
- #--------------------------------------------------------------------------
- # * Refresh Processing
- #--------------------------------------------------------------------------
- def window_width
- return (Graphics.width / 5) * 3
- end
- #--------------------------------------------------------------------------
- # * Refresh Processing
- #--------------------------------------------------------------------------
- def window_height
- return 50
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def make_command_list
- add_command("Confirm", :confirm)
- add_command("Cancel", :cancel)
- end
- end
- #==============================================================================
- # ** Window_Command
- #------------------------------------------------------------------------------
- # This window deals with general command choices.
- #==============================================================================
- class Window_LocationList < Window_Command
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- (Graphics.width / 5) * 2
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def window_height
- (Graphics.height / 5) * 3
- end
- #--------------------------------------------------------------------------
- # * Teleport Locations
- #--------------------------------------------------------------------------
- def teleport_locations
- $game_system.teleport_locations
- end
- #--------------------------------------------------------------------------
- # * Check For Current Map
- #--------------------------------------------------------------------------
- def not_current_map?(index)
- return (teleport_locations[index][:location][0] != $game_map.map_id)
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def make_command_list
- teleport_locations.each_key { |i| add_command(teleport_locations[i][:display_name], :select, not_current_map?(i)) }
- end
- end
- #==============================================================================
- # ** Scene_Teleport < Scene_MenuBase
- #------------------------------------------------------------------------------
- # This class performs basic processing related to the teleport screen.
- #==============================================================================
- class Scene_Teleport < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super
- create_windows
- end
- #--------------------------------------------------------------------------
- # * Free Viewport
- #--------------------------------------------------------------------------
- def dispose_main_viewport
- @viewport.dispose if @viewport
- end
- #--------------------------------------------------------------------------
- # * Create Windows
- #--------------------------------------------------------------------------
- def create_windows
- create_header_window
- create_list_window
- create_confirm_window
- end
- #--------------------------------------------------------------------------
- # * Create List Window
- #--------------------------------------------------------------------------
- def create_header_window
- @location_header_window = Window_LocationHeader.new((Graphics.width / 5) * 1, ((Graphics.height / 5) * 1) - 50, (Graphics.width / 5) * 3, 50)
- end
- #--------------------------------------------------------------------------
- # * Create List Window
- #--------------------------------------------------------------------------
- def create_list_window
- @location_list_window = Window_LocationList.new((Graphics.width / 5) * 1.5, (Graphics.height / 5) * 1)
- @location_list_window.set_handler(:select, method(:command_select))
- end
- #--------------------------------------------------------------------------
- # * Create List Window
- #--------------------------------------------------------------------------
- def create_confirm_window
- @confirm_window = Window_ConfirmLocation.new((Graphics.width / 5), ((Graphics.height / 5) * 2) + 10)
- @confirm_window.set_handler(:confirm, method(:command_confirm))
- @confirm_window.set_handler(:cancel, method(:command_cancel))
- @confirm_window.deactivate
- @confirm_window.select(0)
- @confirm_window.openness = 0
- end
- #--------------------------------------------------------------------------
- # * Create Windows
- #--------------------------------------------------------------------------
- def command_select
- @location_list_window.deactivate
- @confirm_window.open
- @confirm_window.select(0)
- @confirm_window.activate
- end
- #--------------------------------------------------------------------------
- # * Create Windows
- #--------------------------------------------------------------------------
- def command_confirm
- $game_system.teleporting = true
- return_scene
- end
- #--------------------------------------------------------------------------
- # * Create Windows
- #--------------------------------------------------------------------------
- def command_cancel
- @confirm_window.close
- @confirm_window.select(0)
- @confirm_window.deactivate
- @location_list_window.activate
- end
- #--------------------------------------------------------------------------
- # * Update Processing
- #--------------------------------------------------------------------------
- def update
- super
- case
- when Input.trigger?(:B)
- return_scene
- when Input.trigger?(:UP)
- $game_system.list_window_index = @location_list_window.index
- when Input.trigger?(:DOWN)
- $game_system.list_window_index = @location_list_window.index
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment