[Joe Pro] Teleportation System

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by JoePro, Aug 4, 2014.

  1. JoePro

    JoePro None Newb Veteran

    Messages:
    78
    Likes Received:
    17
    First Language:
    English
    [​IMG]

    class Teleportation System(version 1.0)

    def Initialize:
    Creates a scene where the player can choose from a list of locations they can travel too.
    end

    def Features:
    • New teleportation system.
    • Add locations as you play.
    end

    def How 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

    def Script:
    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",                         #[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  endend#==============================================================================# ** 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(-10, -10, ((Graphics.width / 5) * 3), 50, Teleportation_System::Teleport_Header_Text, 1)  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)  endend#==============================================================================# ** 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)) }  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_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?(:      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  endend
    end

    def Credit, 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
     
    Last edited by a moderator: Nov 26, 2014
    #1
    vindaca, whitesphere and luiscesjr like this.
  2. SerpentRose

    SerpentRose Veteran Veteran

    Messages:
    46
    Likes Received:
    12
    Location:
    Texas
    First Language:
    English
    Just what I needed! However, does it require a png of the world map, or can this be accessed straight from the menu with just a popup list of locations? I have a character with a Teleport spell, but can only teleport to locations already visited before (and restricted by skill cooldown.)
     
    #2
  3. JoePro

    JoePro None Newb Veteran

    Messages:
    78
    Likes Received:
    17
    First Language:
    English
    You can access it from the menu but you would have to set that up on your own. The way it is set-up as of now you can only call the scene via script call.

    As for the png of the map, there is no map used in the scene. It is just a list of locations you allow the player.

    And last but not least, there is instructions in the top of the script for adding locations. There is also a place to set up your locations in the customizeable area of the script.
     
    Last edited by a moderator: Nov 25, 2014
    #3
  4. SerpentRose

    SerpentRose Veteran Veteran

    Messages:
    46
    Likes Received:
    12
    Location:
    Texas
    First Language:
    English
    Still fairly new to this so I don't really understand scripting yet. Think you could help me implementing such a script call that the window comes up on skill use? If not that's alright, and I understand.
     
    #4
  5. JoePro

    JoePro None Newb Veteran

    Messages:
    78
    Likes Received:
    17
    First Language:
    English
    Im not by a computer right now but I have the next 3 days off. I'll work on updating this script a little if I get a chance.
     
    #5
  6. Sixth

    Sixth Veteran Veteran

    Messages:
    1,904
    Likes Received:
    672
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    You can do this even now without any scripting.
    Make your teleport skill, and make it call a common event. The common event should contain this script call: 'teleport' (without the ' signs). Make the scope of the skill "None" and make it a "Menu Only" skill.


    You now have have a skill which calls JoePro's teleport window on usage.
     
    #6
  7. JoePro

    JoePro None Newb Veteran

    Messages:
    78
    Likes Received:
    17
    First Language:
    English
    Well there you go. Thank you Sixth.
     
    #7
  8. SerpentRose

    SerpentRose Veteran Veteran

    Messages:
    46
    Likes Received:
    12
    Location:
    Texas
    First Language:
    English
    That's about what I thought. Alright, thank you!


    Ok so I did some testing and it's giving me a script error. http://gyazo.com/c4352f299f929c50bd00dd642da5cb18


    Here's my setup, per instructions:


    http://gyazo.com/5cdcbd08f243b2f070e1a300a2b181b0


    http://gyazo.com/1903c7063783ee177ca2547a504def17


    http://gyazo.com/368bfe881a2bd82e6a9d774b47810523 For this I made sure each x,y was a valid tile and the Map IDs corresponded to the location names. Unless the 0 is supposed to be there too? Like, 02, 034, etc? Although it threw the same error before I even changed those.


    And here's the other scripts I use: http://gyazo.com/a41b9bf3c8b96132b8febb1d9a06519d Think it might be conflicting with BlackMorning's ColumnMenu? http://forums.rpgmakerweb.com/index.php?/topic/24109-blackmorning-scripts/?hl=menu
     
    Last edited by a moderator: Nov 26, 2014
    #8
  9. JoePro

    JoePro None Newb Veteran

    Messages:
    78
    Likes Received:
    17
    First Language:
    English
    Well i edited the script from my phone so it should work but i think it messed up the format.

    Can someone let me know how it looks on a pc?
     
    #9
  10. SerpentRose

    SerpentRose Veteran Veteran

    Messages:
    46
    Likes Received:
    12
    Location:
    Texas
    First Language:
    English
    #10
  11. JoePro

    JoePro None Newb Veteran

    Messages:
    78
    Likes Received:
    17
    First Language:
    English
    No problem. Thanks for the feedback. Let me know if you have anymore questions.
     
    #11
  12. C-C-C-Cashmere (old)

    C-C-C-Cashmere (old) Resident Weirdo Veteran

    Messages:
    833
    Likes Received:
    341
    First Language:
    English
    Lol your headings and subheadings are set up as a class with methods xD


    I also like your eye for simplicity.


    Nice script too. Seems useful. ^_^
     
    #12
  13. JoePro

    JoePro None Newb Veteran

    Messages:
    78
    Likes Received:
    17
    First Language:
    English
    That is what I strive for. (Plus it looks neater too)

    Lol really thank you. I'm glad you caught the extra bits of ruby in there too. Your the first to comment about it. Im just hoping the humor and fun of my post rub off on others and their work.

    Smile :D
     
    #13

Share This Page