Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Teleport
- # -- Author : Dekita
- # -- Version : 1.2
- # -- Level : Normal
- # -- Requires : $D13x - Core v1.8+
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Teleport]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 16/o5/2o13 - Update, (improved disable/enable code)
- # - (added Hidden_Name feature's)
- # - (fixed typo's)
- # 14/o5/2o13 - Update, (added auto-jump selection cursor)
- # 12/o5/2o13 - Finished,
- # 1o/o5/2o13 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script enables a reasonably animated teleportation scene.
- # Each teleport location can cost gold.
- # Easy script calls to add/remove each teleport location and
- # disable/enable each available teleport location.
- #
- # This script also replicates the "Search" feature from FF10.
- # This feature allows the player to "search" the map for specific co-ordinates,
- # if certain co-ordinates are found it will activate/enable a new
- # location.
- #
- # Remember. This script needs images to function, Check the $D13x Master Demo
- # If you need the images.
- #
- # NOTE: You MUST!! have at least 1 telepoprt location available before calling
- # the teleport scene. the easiest way of doing this is to add a teleport before
- # calling the scene.
- # If party already has a location it cannot be re-added and will be ignored.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # $game_party.can_port = BOOL
- # use this script call to disable ALL unocked teleport id's,
- # it will also disable the menu command(if enabled).
- #
- # $game_party.add_teleport(ID)
- # Script call to add a teleport location to the available list.
- #
- # $game_party.find_new_teleport(ID)
- # Script call to add a teleport location to the available list.
- # This call will make the name initially hidden.
- #
- # $game_party.del_teleport(ID)
- # Call to remove a Teleport Location from the current list.
- #
- # $game_party.disable_port(ID)
- # Call to Disable an available teleport location.
- #
- # $game_party.enable_port(ID)
- # Call to enable a disabled teleport location.
- #
- # $game_party.hide_teleport_name(ID)
- # Call to hide a teleport location's name.
- #
- # $game_party.show_teleport_name(ID)
- # Call to show a teleport location's name (if name is hidden).
- #
- # $game_party.auto_port(ID, Cost Gold ? = false)
- # Call to automatically teleport to a location, also adds the teleport id
- # into the available list if not already added.
- #
- # BOOL = true / false (default is true)
- # ID = The Teleport::List[ id ] (defined below)
- # Cost_Gold = true / false (autoport automatically reduce gold? default = false)
- #
- #-------------------------------------------------------------------------------
- # SceneManager.call(Scene_Teleport)
- # ^ To call teleport scene.
- #
- #===============================================================================
- module Teleport
- #===============================================================================
- List=[] # << Keep
- General={# << Keep
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ General Vocab
- #--------------------------------------------------------------------------
- # << Used for help wind while confirming travel.
- :confirm => "Confirm Travel To %s for %s Gold ?",
- :cancel => "Cancel Travel To %s ?",
- # << Used for confirm travel commands
- :conf_B => "Confirm",
- :canc_B => "Cancel",
- # << Used in Co-Ordinate Screen
- :co_ords => "Co-ords :",
- # << Used in gold Screen, format = [icon id, "Text" ]
- :gold => [361, "Gold :"],
- }# << Keep
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Command Settings
- #--------------------------------------------------------------------------
- # << Max visible Commands
- Max_Commands = 2
- # << Commands Alignment
- Command_Align = 1
- # << Commands Shown
- Commands=[
- [:teleport, "Teleport", "Select Teleport Destination."],
- [:search , "Find", "Search Map Co-Ordinates For New Locations." ],
- [:exit, "Exit", "Return To Map."],
- ]
- # Add Teleport command into menu ? format = [ show? , "Name" ]
- Add_2_Menu = [ true , "Teleport" ]
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Teleport Configuration
- #--------------------------------------------------------------------------
- # << Animation id's
- Start_Tele_Ani = 112
- End_Tele_Ani = 113
- # This is where all teleport information is stored, things such as map id,
- # direction ect.. map img x/y are the map image display co-ordinates.
- # ie where you search to find the location and where the cursor moves to
- # when selecting location from available list.
- # [id] = [name , map, x, y, dir, 'info', cost, map img x, map img y]
- List[1] = ['Oak Forest', 2, 12, 2, 2, "Teleport To Oak Forest. \nPrice : Free", 0, 108, 86]
- List[2] = ['Stone Cave', 3, 22, 11, 2, "Teleport To Stone Cavern. \nPrice : Free", 0, 102, 80]
- List[3] = ['Green Land', 3, 5, 5, 2, "Teleport To Green Land. \nPrice : Free", 0, 38, 271]
- List[4] = ['Underground', 3, 5, 5, 2, "Teleport Underground. \nPrice : Free", 0, 370, 23]
- List[5] = ['Big Palace', 3, 5, 5, 2, "Teleport Into The Big Palace. \nPrice : Free", 0, 169, 139]
- # << ADD More List[ id ] here. Follow the same format as above.
- # The items in this list are "hidden" ie they can be found by searching
- # the map image for locations, simply enter the List[ id ] number for the
- # list items that should be found by searching.
- Hidden_List = [ 3, 4, 5 ]
- # This will be the name for a newly found location using the search feature.
- # The name will change(to above setting) after teleporting to the area.
- Hidden_Name = '???'
- # Use Hidden_Name feature ? true = yes, false = no.
- Use_Hid_Nam = true
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Graphic Settings
- #--------------------------------------------------------------------------
- # Graphics used for Map and Selector. MUST Be In The Graphics\\System Folder.
- Map_Image = "Teleport Map" # "FF-CT Map"
- Sel_Image = "Teleport Selector"
- # Selection Cursor Move Type. Can be :scroll or :select
- # :scroll = cursor slowly moves to set co-ordinates
- # :select = cursor auto-jumps to set co-ordinates
- # Does NOT effect Search feature.
- Sel_Type = :select # :scroll
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- class Game_Temp
- #===============================================================================
- #--------------------------------------------------------------------------
- # Pi Variables
- #--------------------------------------------------------------------------
- attr_accessor :tele_search
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :init_de_tele :initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- init_de_tele
- @tele_search = [0,0]
- end
- end
- #===============================================================================
- class Game_Party < Game_Unit
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_accessor :can_port
- attr_accessor :tp_list
- attr_accessor :new_tp_id
- attr_accessor :tps_disabled
- attr_accessor :just_ported
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :init_tp_list :initialize
- #-----------------------------------------------------------------------------
- # Object Initialization
- #-----------------------------------------------------------------------------
- def initialize
- init_tp_list
- @can_port = true
- @just_ported = false
- @tp_list = Array.new
- @tps_disabled = Array.new(Teleport::List.size) {false}
- @new_tp_id = Array.new(Teleport::Hidden_List.size) {true}
- end
- #-----------------------------------------------------------------------------
- # Add Teleport To List
- #-----------------------------------------------------------------------------
- def add_teleport(id)
- return unless Teleport::List[id] != nil
- @tp_list << id unless @tp_list.include?(id)
- @new_tp_id[id] = false if @new_tp_id[id] != false
- @tp_list.sort!
- end
- #-----------------------------------------------------------------------------
- # Add Teleport To List (via search)
- #-----------------------------------------------------------------------------
- def find_new_teleport(id)
- add_teleport(id)
- @new_tp_id[id] = true
- end
- #-----------------------------------------------------------------------------
- # Remove Teleport From List
- #-----------------------------------------------------------------------------
- def del_teleport(id)
- return unless @tp_list[id] != nil
- @new_tp_id[id] = true if @new_tp_id[id] != true
- @tp_list.delete(id)
- @tp_list.sort!
- end
- #-----------------------------------------------------------------------------
- # Disable Available Teleport
- #-----------------------------------------------------------------------------
- def disable_port(id)
- @tps_disabled[id] = true if @tps_disabled[id] != true
- end
- #-----------------------------------------------------------------------------
- # Enable Disabled Teleport
- #-----------------------------------------------------------------------------
- def enable_port(id)
- @tps_disabled[id] = false if @tps_disabled[id] != false
- end
- #-----------------------------------------------------------------------------
- # Hide Teleport Name
- #-----------------------------------------------------------------------------
- def hide_teleport_name(id)
- @new_tp_id[id] = true if @new_tp_id[id] != true
- end
- #-----------------------------------------------------------------------------
- # Show Teleport Name
- #-----------------------------------------------------------------------------
- def show_teleport_name(id)
- @new_tp_id[id] = false if @new_tp_id[id] != false
- end
- #-----------------------------------------------------------------------------
- # Automatic Teleport (also adds teleport if not in list)
- #-----------------------------------------------------------------------------
- def auto_port(id, cost_gold = false)
- add_teleport(id)
- info = Teleport::List[id]
- $game_party.gain_gold(-info[6]) if (info[6] > 0) && (cost_gold)
- $game_player.reserve_transfer(info[1],info[2],info[3],info[4])
- $game_player.transparent = true
- $game_player.animation_id = Teleport::Start_Tele_Ani
- $game_player.followers.each do |char|
- next unless char.actor != nil
- char.transparent = true
- char.animation_id = Teleport::Start_Tele_Ani
- end
- @just_ported = true
- show_teleport_name(id)
- end
- end
- #===============================================================================
- class Window_MenuCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :add_teleport_commands :add_original_commands
- #-----------------------------------------------------------------------------
- # For Adding Original Commands
- #-----------------------------------------------------------------------------
- def add_original_commands
- add_teleport_commands
- add_tele_command if Teleport::Add_2_Menu[0]
- end
- #-----------------------------------------------------------------------------
- # Add Teleport Command
- #-----------------------------------------------------------------------------
- def add_tele_command
- add_command(Teleport::Add_2_Menu[1], :teleport, can_add_tele)
- end
- #-----------------------------------------------------------------------------
- # Can Enable Teleport ?
- #-----------------------------------------------------------------------------
- def can_add_tele
- return false unless $game_party.can_port
- return false if $game_party.tp_list.empty?
- return true
- end
- end
- #===============================================================================
- class Window_TeleportCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Object Initialization
- #-----------------------------------------------------------------------------
- def initialize(x, y)
- @type = :normal
- super(x, y)
- end
- #-----------------------------------------------------------------------------
- # Get Window Width
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width / 4
- end
- #--------------------------------------------------------------------------
- # Get Window Height
- #--------------------------------------------------------------------------
- def window_height
- fitting_height(Teleport::Max_Commands)
- end
- #-----------------------------------------------------------------------------
- # Alignment
- #-----------------------------------------------------------------------------
- def alignment
- return Teleport::Command_Align
- end
- #-----------------------------------------------------------------------------
- # Set Type
- #-----------------------------------------------------------------------------
- def type=(val)
- return unless @type != val
- @type = val
- refresh
- end
- #-----------------------------------------------------------------------------
- # Get Type
- #-----------------------------------------------------------------------------
- def type
- return @type
- end
- #-----------------------------------------------------------------------------
- # Create Command List
- #-----------------------------------------------------------------------------
- def make_command_list
- case @type
- when :normal
- for command in Teleport::Commands
- add_command(command[1],command[0])
- end
- when :confirm
- add_command(Teleport::General[:conf_B],:confirm)
- add_command(Teleport::General[:canc_B] ,:cancelC)
- end
- end
- end
- #===============================================================================
- class Window_TeleportList < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Object Initialization
- #-----------------------------------------------------------------------------
- def initialize(x, y, height)
- @height = height
- super(x, y)
- select(-1)
- deactivate
- end
- #-----------------------------------------------------------------------------
- # Get Window Width
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width / 4
- end
- #-----------------------------------------------------------------------------
- # Window Height
- #-----------------------------------------------------------------------------
- def window_height
- return @height
- end
- #-----------------------------------------------------------------------------
- # Create Command List
- #-----------------------------------------------------------------------------
- def make_command_list
- for c in $game_party.tp_list
- list = Teleport::List[c]
- bool = Teleport::Use_Hid_Nam
- inew = $game_party.new_tp_id[c]
- name = Teleport::Hidden_Name
- name = list[0] unless (bool && inew)
- add_command(name,:location, cle?(c))
- end
- end
- #-----------------------------------------------------------------------------
- # Can Enable Command (meets gold requirement?)
- #-----------------------------------------------------------------------------
- def cle?(c)
- return false unless Teleport::List[c]
- return false unless $game_party.can_port
- return false unless $game_party.gold >= Teleport::List[c][6]
- return (!$game_party.tps_disabled[c])
- end
- end
- #===============================================================================
- class Window_TeleMap < Window_Selectable
- #===============================================================================
- #--------------------------------------------------------------------------
- # Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x,y,w,h)
- super(x, y, w, h)
- refresh
- end
- #--------------------------------------------------------------------------
- # Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- end
- end
- #===============================================================================
- class Window_TeleGold < Window_Base
- #===============================================================================
- #--------------------------------------------------------------------------
- # Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- y = Graphics.height - fitting_height(1)
- super(0, y, Graphics.width/3, fitting_height(1))
- refresh
- end
- #--------------------------------------------------------------------------
- # Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- wid = self.width - (standard_padding*2)
- draw_de_icon(Teleport::General[:gold][0],-3,-3, 0, true)
- draw_text(22,0,wid,line_height, Teleport::General[:gold][1])
- draw_text(0 ,0,wid,line_height, $game_party.gold.to_i ,2)
- end
- #--------------------------------------------------------------------------
- # Open Window
- #--------------------------------------------------------------------------
- def open
- refresh
- super
- end
- end
- #===============================================================================
- class Window_TeleTime < Window_Base
- #===============================================================================
- #--------------------------------------------------------------------------
- # Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- y = Graphics.height - fitting_height(1)
- super(Graphics.width/3, y, Graphics.width/3, fitting_height(1))
- refresh
- end
- #--------------------------------------------------------------------------
- # Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- t = Time.now
- wid = self.width - (standard_padding*2)
- text = "#{t.strftime("%H")}:#{t.strftime("%M")}:#{t.strftime("%S")}"
- draw_text(0,0,wid,line_height, text, 1)
- end
- end
- #===============================================================================
- class Window_TelePosi < Window_Base
- #===============================================================================
- #--------------------------------------------------------------------------
- # Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- y = Graphics.height - fitting_height(1)
- super(Graphics.width/3*2, y, Graphics.width/3, fitting_height(1))
- refresh
- end
- #--------------------------------------------------------------------------
- # Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- wid = self.width - (standard_padding*2)
- text = "#{$game_temp.tele_search[0]-142}, #{$game_temp.tele_search[1]-78}"
- text = "0, 0" if $game_temp.tele_search == [0,0]
- draw_text(0,0,wid,line_height, Teleport::General[:co_ords])
- draw_text(0,0,wid,line_height, text, 2)
- end
- end
- #===============================================================================
- class Scene_Map < Scene_Base
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :updt_tp_map :update
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- updt_tp_map
- update_port_ani
- end
- #-----------------------------------------------------------------------------
- # Update Teleport Animation
- #-----------------------------------------------------------------------------
- def update_port_ani
- return unless $game_party.just_ported
- $game_player.perform_transfer
- $game_map.autoplay
- $game_player.transparent = false
- $game_player.animation_id = Teleport::End_Tele_Ani
- $game_player.followers.each do |char|
- next unless char.actor != nil
- char.transparent = false
- char.animation_id = Teleport::End_Tele_Ani
- end
- $game_party.just_ported = false
- end
- end
- #===============================================================================
- class Scene_Menu < Scene_MenuBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :teleport_create_command_window :create_command_window
- #-----------------------------------------------------------------------------
- # Create Command Window
- #-----------------------------------------------------------------------------
- def create_command_window
- teleport_create_command_window
- add_port_com if Teleport::Add_2_Menu[0]
- end
- #-----------------------------------------------------------------------------
- # Add Teleport command
- #-----------------------------------------------------------------------------
- def add_port_com
- @command_window.set_handler(:teleport, method(:call_teleport))
- end
- #-----------------------------------------------------------------------------
- # Call Teleport Scene
- #-----------------------------------------------------------------------------
- def call_teleport
- SceneManager.call(Scene_Teleport)
- end
- end
- #===============================================================================
- class Scene_Teleport < Scene_MenuBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Start Processing
- #-----------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_command_window
- create_gold_window
- create_time_window
- create_posi_window
- create_list_window
- create_map
- end
- #--------------------------------------------------------------------------
- # Create Halp Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Deki_Help.new
- @help_window.viewport = @viewport
- @help_window.x = Graphics.width / 4
- end
- #-----------------------------------------------------------------------------
- # Create Command Window
- #-----------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_TeleportCommand.new(0, 0)
- @command_window.viewport = @viewport
- @command_window.help_window = @help_window
- @command_window.set_handler(:teleport,method(:command_sel_dest))
- @command_window.set_handler(:search, method(:command_search))
- @command_window.set_handler(:exit, method(:return_scene))
- @command_window.set_handler(:confirm, method(:confirm_tele))
- @command_window.set_handler(:cancelC, method(:cancel_tele))
- end
- #-----------------------------------------------------------------------------
- # Create Gold Window
- #-----------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_TeleGold.new
- end
- #-----------------------------------------------------------------------------
- # Create Time Window
- #-----------------------------------------------------------------------------
- def create_time_window
- @time_window = Window_TeleTime.new
- @time_ref_ = Time.now.sec
- end
- #-----------------------------------------------------------------------------
- # Create Position Window
- #-----------------------------------------------------------------------------
- def create_posi_window
- @pos_window = Window_TelePosi.new
- end
- #-----------------------------------------------------------------------------
- # Create List Window
- #-----------------------------------------------------------------------------
- def create_list_window
- y = @command_window.height
- h = Graphics.height - y - @gold_window.height
- @list_window = Window_TeleportList.new(0,y,h)
- @list_window.viewport = @viewport
- @list_window.help_window = @help_window
- @list_window.set_handler(:location, method(:command_travel))
- @list_window.set_handler(:cancel, method(:back_to_coommand))
- end
- #-----------------------------------------------------------------------------
- # Create Map Window
- #-----------------------------------------------------------------------------
- def create_map
- x = @command_window.width
- y = @help_window.height
- w = Graphics.width - x
- h = Graphics.height - y - @gold_window.height
- @map_wind = Window_TeleMap.new(x,y,w,h)
- make_map_img(x,y,w,h)
- make_sel_img
- end
- #-----------------------------------------------------------------------------
- # Create Map Image
- #-----------------------------------------------------------------------------
- def make_map_img(x,y,w,h)
- p "#{x},#{y}"
- @map_view = Viewport.new(x+6,y+6,w-12,h-12)
- @map_view.z = 201
- @map_img = Plane.new
- @map_img.viewport = @map_view
- @map_img.bitmap = Cache.system(Teleport::Map_Image)
- @map_img.opacity = 200
- end
- #-----------------------------------------------------------------------------
- # Create Map Selector Image
- #-----------------------------------------------------------------------------
- def make_sel_img
- @map_sel = Sprite.new
- @map_sel.bitmap = Cache.system(Teleport::Sel_Image)
- wid = (@map_view.rect.width/2)-(@map_sel.bitmap.width/2)
- hei = (@map_view.rect.height/2)-(@map_sel.bitmap.height/2)
- @map_sel.ox = (@map_sel.bitmap.width/2)+6
- @map_sel.oy = (@map_sel.bitmap.height/2)+6
- @map_sel.opacity = 222
- @map_sel.z = 201
- @map_sel.x = Teleport::List[$game_party.tp_list[0]][7]+(@map_view.rect.x)
- @map_sel.y = Teleport::List[$game_party.tp_list[0]][8]+(@map_view.rect.y)
- $game_temp.tele_search = [@map_sel.x,@map_sel.y]
- end
- #--------------------------------------------------------------------------
- # Termination Processing
- #--------------------------------------------------------------------------
- def terminate
- super
- @map_img.bitmap.dispose
- @map_img.dispose
- @map_sel.bitmap.dispose
- @map_sel.dispose
- @map_view.dispose
- $game_temp.tele_search = [0,0]
- end
- #-----------------------------------------------------------------------------
- # Command Select Destination
- #-----------------------------------------------------------------------------
- def command_sel_dest
- @command_window.deactivate
- @command_window.select(-1)
- @list_window.activate
- @list_window.select(0)
- end
- #-----------------------------------------------------------------------------
- # Command Search
- #-----------------------------------------------------------------------------
- def command_search
- @command_window.deactivate
- @command_window.select(-1)
- @map_wind.activate
- end
- #-----------------------------------------------------------------------------
- # Command Travel
- #-----------------------------------------------------------------------------
- def command_travel
- info = Teleport::List[$game_party.tp_list[@list_window.index]]
- return @list_window.activate unless info != nil
- return check_price(info)
- end
- #-----------------------------------------------------------------------------
- # Check Price
- #-----------------------------------------------------------------------------
- def check_price(info)
- cost = info[6]
- gold = $game_party.gold.to_i
- if gold >= cost
- confirm_price
- else
- @help_window.set_text('Not Enough Gold')
- 60.times { Graphics.update }
- @list_window.activate
- end
- end
- #-----------------------------------------------------------------------------
- # Confirm Price
- #-----------------------------------------------------------------------------
- def confirm_price
- @list_window.deactivate
- @command_window.type = :confirm
- @command_window.select(0)
- @command_window.activate
- end
- #-----------------------------------------------------------------------------
- # Confirm Teleport
- #-----------------------------------------------------------------------------
- def confirm_tele
- info = $game_party.tp_list[@list_window.index]
- # info = Teleport::List[$game_party.tp_list[@list_window.index]]
- # $game_party.gain_gold(-info[6]) if info[6] > 0
- perform_travel(info, true)
- end
- #-----------------------------------------------------------------------------
- # Cancel Teleport
- #-----------------------------------------------------------------------------
- def cancel_tele
- @command_window.type = :normal
- @command_window.select(-1)
- @command_window.deactivate
- @list_window.activate
- end
- #-----------------------------------------------------------------------------
- # Perform Travel
- #-----------------------------------------------------------------------------
- def perform_travel(info, bool)
- SceneManager.return
- $game_party.auto_port(info, bool)
- # $game_player.reserve_transfer(info[1],info[2],info[3],info[4])
- # $game_player.transparent = true
- # $game_player.animation_id = Teleport::Start_Tele_Ani
- # $game_player.followers.each do |char|
- # next unless char.actor != nil
- # char.transparent = true
- # char.animation_id = Teleport::Start_Tele_Ani
- # end
- # $game_party.just_ported = true
- end
- #-----------------------------------------------------------------------------
- # Back To Command Window
- #-----------------------------------------------------------------------------
- def back_to_coommand
- @list_window.select(-1)
- @list_window.deactivate
- @command_window.select(0)
- @command_window.activate
- @map_wind.deactivate
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- super
- update_cancel
- update_help
- update_time
- update_map
- update_map_II
- update_find
- end
- #-----------------------------------------------------------------------------
- # Update Cancel Key(s)
- #-----------------------------------------------------------------------------
- def update_cancel
- return unless @command_window.active
- return unless Input.trigger?(:B)
- return_scene if @command_window.type == :normal
- cancel_tele if @command_window.type == :confirm
- end
- #-----------------------------------------------------------------------------
- # Update Help
- #-----------------------------------------------------------------------------
- def update_help
- for data in Teleport::Commands
- if @command_window.current_symbol == data[0]
- @help_window.set_text(data[2])
- end
- end
- case @command_window.current_symbol
- when :confirm
- info = Teleport::List[$game_party.tp_list[@list_window.index]]
- text = sprintf(Teleport::General[:confirm], info[0], info[6])
- @help_window.set_text(text)
- when :cancelC
- info = Teleport::List[$game_party.tp_list[@list_window.index]]
- text = sprintf(Teleport::General[:cancel], info[0])
- @help_window.set_text(text)
- end
- if @list_window.active
- info = Teleport::List[$game_party.tp_list[@list_window.index]]
- @help_window.set_text(info[5])
- end
- end
- #-----------------------------------------------------------------------------
- # Update Time
- #-----------------------------------------------------------------------------
- def update_time
- return unless @time_ref_ != Time.now.sec
- @time_window.refresh
- end
- #-----------------------------------------------------------------------------
- # Update Map
- #-----------------------------------------------------------------------------
- def update_map
- return unless @list_window.active
- info = Teleport::List[$game_party.tp_list[@list_window.index]]
- @map_view.update
- case Teleport::Sel_Type
- when :scroll
- @map_sel.x += 1 if @map_sel.x < (info[7]+(@map_view.rect.x))
- @map_sel.x -= 1 if @map_sel.x > (info[7]+(@map_view.rect.x))
- @map_sel.y += 1 if @map_sel.y < (info[8]+(@map_view.rect.y))
- @map_sel.y -= 1 if @map_sel.y > (info[8]+(@map_view.rect.y))
- when :select
- @map_sel.x = (info[7]+(@map_view.rect.x))
- @map_sel.y = (info[8]+(@map_view.rect.y))
- end
- if $game_temp.tele_search != [@map_sel.x,@map_sel.y]
- $game_temp.tele_search = [@map_sel.x,@map_sel.y]
- @pos_window.refresh
- end
- end
- #-----------------------------------------------------------------------------
- # Update Map (search)
- #-----------------------------------------------------------------------------
- def update_map_II
- return unless @map_wind.active
- val = Input.press?(:SHIFT) ? 2 : 1
- @map_sel.y -= val if Input.press?(:UP)
- @map_sel.y += val if Input.press?(:DOWN)
- @map_sel.x -= val if Input.press?(:LEFT)
- @map_sel.x += val if Input.press?(:RIGHT)
- back_to_coommand if Input.press?(:B)
- @map_sel.x = @map_view.rect.x+12 if @map_sel.x <= (@map_view.rect.x+12)
- if @map_sel.x >= (@map_view.rect.x+@map_view.rect.width)
- @map_sel.x = (@map_view.rect.x+@map_view.rect.width)
- end
- @map_sel.y = @map_view.rect.y+12 if @map_sel.y <= (@map_view.rect.y+12)
- if @map_sel.y >= (@map_view.rect.y+@map_view.rect.height)
- @map_sel.y = (@map_view.rect.y+@map_view.rect.height)
- end
- if $game_temp.tele_search != [@map_sel.x,@map_sel.y]
- $game_temp.tele_search = [@map_sel.x,@map_sel.y]
- @pos_window.refresh
- end
- end
- #-----------------------------------------------------------------------------
- # Update Find
- #-----------------------------------------------------------------------------
- def update_find
- return unless @map_wind.active
- if Input.trigger?(:C)
- Teleport::Hidden_List.each do |data|
- next unless data != nil
- info = Teleport::List[data]
- if info[7] == ($game_temp.tele_search[0]-(@map_view.rect.x)) &&
- info[8] == ($game_temp.tele_search[1]-(@map_view.rect.y))
- if !$game_party.tp_list.include?(data)
- text = sprintf("Found Location : %s", info[0])
- @help_window.set_text(text)
- $game_party.find_new_teleport(data)
- @list_window.refresh
- return 60.times { Graphics.update }
- end
- end
- end
- end
- Teleport::Commands.each do |com|
- next unless com[0] == :search
- @help_window.set_text(com[2])
- end
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Add Comment
Please, Sign In to add comment