[Joe Pro] Teleportation System
class Teleportation System(version 1.0)
defInitialize:
Creates a scene where the player can choose from a list of locations they can travel too.
end
defFeatures:
[*]New teleportation system.
[*]Add locations as you play.
end
defHow to use:
This script has a Customizeable Area inside of the script's module as well as details how to set up and add locations.
end
defScript:
Spoiler Code:
#################################################################################↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓##↓ ↓##↓ 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", # :location => [ 4, 8 , 4 , 2 ], }, 1 => { :display_name => "AEIOU Facility", # :location => [ 5, 3 , 55 , 2 ], }, 2 => { :display_name => "Creadair Chamber", # :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 Locationsattr_accessor :teleporting # Teleport Locationsattr_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 = 0endend#==============================================================================# ** 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_Typeend#--------------------------------------------------------------------------# * 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 x = current_map_info y = current_map_info direction = current_map_info $game_player.reserve_transfer(map_id, x, y, direction) $game_temp.fade_type = 1 Audio.se_play(teleport_se, teleport_se, teleport_se)endend#==============================================================================# ** 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 = Teleportation_System::Locationsendend#==============================================================================# ** 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 refreshend #--------------------------------------------------------------------------# * Refresh Processing#--------------------------------------------------------------------------def refresh contents.clear draw_text(-10, -10, ((Graphics.width / 5) * 3), 50, Teleportation_System::Teleport_Header_Text, 1)endend#==============================================================================# ** Window_Command#------------------------------------------------------------------------------#This window deals with general command choices.#==============================================================================class Window_ConfirmLocation < Window_Command #--------------------------------------------------------------------------# * Refresh Processing#--------------------------------------------------------------------------def alignment return 1end#--------------------------------------------------------------------------# * Refresh Processing#--------------------------------------------------------------------------def col_max return item_maxend#--------------------------------------------------------------------------# * Refresh Processing#--------------------------------------------------------------------------def window_width return (Graphics.width / 5) * 3end#--------------------------------------------------------------------------# * Refresh Processing#--------------------------------------------------------------------------def window_height return 50end#--------------------------------------------------------------------------# * Get Window Height#--------------------------------------------------------------------------def make_command_list add_command("Confirm", :confirm) add_command("Cancel", :cancel)endend#==============================================================================# ** Window_Command#------------------------------------------------------------------------------#This window deals with general command choices.#==============================================================================class Window_LocationList < Window_Command #--------------------------------------------------------------------------# * Get Window Width#--------------------------------------------------------------------------def window_width (Graphics.width / 5) * 2end #--------------------------------------------------------------------------# * Get Window Height#--------------------------------------------------------------------------def window_height (Graphics.height / 5) * 3end#--------------------------------------------------------------------------# * Teleport Locations#--------------------------------------------------------------------------def teleport_locations $game_system.teleport_locationsend#--------------------------------------------------------------------------# * Check For Current Map#--------------------------------------------------------------------------def not_current_map?(index) return (teleport_locations[:location] != $game_map.map_id)end#--------------------------------------------------------------------------# * Get Window Height#--------------------------------------------------------------------------def make_command_list teleport_locations.each_key { |i| add_command(teleport_locations[:display_name], :select, not_current_map?(i)) }endend#==============================================================================# ** 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_windowsend#--------------------------------------------------------------------------# * Free Viewport#--------------------------------------------------------------------------def dispose_main_viewport @viewport.dispose if @viewportend #--------------------------------------------------------------------------# * Create Windows#--------------------------------------------------------------------------def create_windows create_header_window create_list_window create_confirm_windowend#--------------------------------------------------------------------------# * 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 = 0end#--------------------------------------------------------------------------# * Create Windows#--------------------------------------------------------------------------def command_select @location_list_window.deactivate @confirm_window.open @confirm_window.select(0) @confirm_window.activateend#--------------------------------------------------------------------------# * Create Windows#--------------------------------------------------------------------------def command_confirm $game_system.teleporting = true return_sceneend#--------------------------------------------------------------------------# * Create Windows#--------------------------------------------------------------------------def command_cancel @confirm_window.close @confirm_window.select(0) @confirm_window.deactivate @location_list_window.activateend#--------------------------------------------------------------------------# * Update Processing#--------------------------------------------------------------------------def update super case when Input.trigger?(: 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 endendend
end
defCredit, Licence & Commercial Usage:
This script is free to use for non-commercial use. If you want to obtain a license to use this script in a commercial game(contests included)
please PM me. Credit is to be give to myself, JoePro.
end
end
本贴来自国际rpgmaker官方论坛作者:JoePro处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/joe-pro-teleportation-system.30700/
页:
[1]