Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Easy Teleport 1.0c by Balrogic
- =begin
- This script enables a very simple teleportation system that
- requires minimal configuration by you, the game developer.
- There are two teleport lists. Both can be used at the same
- time if you feel like it. One is unsorted and adds locations
- to the list in the same order they are added. The other needs
- to be told which location belongs where in the list. Both lists
- automatically set the new location equal to the current map's
- display name and the player's location. You can override this
- behavior if you so choose by adding arguments when you call
- the method.
- To add a location to the unsorted list put this in a script call.
- I like making the player step on an event set to event touch.
- Balrogic::Teleport::nosetup
- To add a location to the sorted list put this in a script call.
- Replace 0 with whatever sorting number you want for that location.
- Balrogic::Teleport::somesetup(0)
- For finer control, include as many of the following arguments as
- you want.
- For direction, 0 is retain. 2 is down. 4 is left. 6 is right. 8 is up.
- Balrogic::Teleport::nosetup("name", map_id, x, y, direction)
- Balrogic::Teleport::somesetup(sorting, "name", map_id, x, y, direction)
- To access the teleport list put the following in a script call.
- For the unsorted list:
- Balrogic::Teleport::unsorted
- For the sorted list:
- Balrogic::Teleport::sorted
- To disable access to teleportation, use script call below.
- Balrogic::Teleport::disable
- To re-enable:
- Balrogic::Teleport::enable
- =end
- module Balrogic # Module 1
- module Teleport # Module 2
- # Configuration - Comment out anything you don't want to use.
- # Display message when selecting teleport destination.
- @destination = "Please select your destination."
- # Message to show when you don't know any destinations.
- @nodestination = "You don't know where to go!"
- # Message to show when teleportation is disabled.
- @disabled = "Teleportation sealed."
- # Sound effect to play on teleportation.
- @sound = Proc.new {
- RPG::SE.new("Teleport", 100, 100).play # Sound name, volume and pitch.
- } # Leave this alone.
- # Transition effect. 0 is default black, 1 is white, 2 for none.
- @transition = Proc.new {
- $game_temp.fade_type = 1
- } # Leave this alone too.
- # End configuration.
- def self.unsorted
- $game_self_switches[[:balrogic, :teleport, :override]] = true
- if $game_self_switches[[:balrogic, :teleport, :disabled]]
- $game_message.add(@disabled) if @disabled
- $game_self_switches[[:balrogic, :teleport, :override]] = nil
- else
- if $game_self_switches[[:balrogic, :teleport]]
- $game_message.choice_cancel_type = 999999999999
- $game_self_switches[[:balrogic, :teleport]].each{ |x|
- $game_message.choices << x[0]
- }
- $game_message.choice_proc = Proc.new { |x|
- $game_player.reserve_transfer($game_self_switches[[:balrogic, :teleport]][x][1], $game_self_switches[[:balrogic, :teleport]][x][2], $game_self_switches[[:balrogic, :teleport]][x][3], $game_self_switches[[:balrogic, :teleport]][x][4])
- Balrogic::Teleport::configuration
- }
- $game_message.add(@destination) if @destination
- else
- $game_message.add(@nodestination) if @nodestination
- $game_self_switches[[:balrogic, :teleport, :override]] = nil
- end
- end
- end
- def self.sorted
- $game_self_switches[[:balrogic, :teleport, :override]] = true
- if $game_self_switches[[:balrogic, :teleport, :disabled]]
- $game_message.add(@disabled) if @disabled
- $game_self_switches[[:balrogic, :teleport, :override]] = nil
- else
- if $game_self_switches[[:balrogic, :teleport_manual]]
- $game_message.choice_cancel_type = 999999999999
- @sorted_list = []
- $game_self_switches[[:balrogic, :teleport_manual]].each{ |x|
- @sorted_list << x if x
- }
- @sorted_list.each{ |x|
- $game_message.choices << x[0]
- }
- $game_message.choice_proc = Proc.new { |x|
- $game_player.reserve_transfer(@sorted_list[x][1], @sorted_list[x][2], @sorted_list[x][3], @sorted_list[x][4])
- Balrogic::Teleport::configuration
- }
- $game_message.add(@destination) if @destination
- else
- $game_message.add(@nodestination) if @nodestination
- $game_self_switches[[:balrogic, :teleport, :override]] = nil
- end
- end
- end
- def self.nosetup(name=$game_map.display_name, map=$game_map.map_id, x=$game_player.x, y=$game_player.y, dir=2)
- $game_self_switches[[:balrogic, :teleport]] ||= []
- $game_self_switches[[:balrogic, :teleport]] << [name, map, x, y, dir]
- end
- def self.somesetup(sort, name=$game_map.display_name, map=$game_map.map_id, x=$game_player.x, y=$game_player.y, dir=2)
- $game_self_switches[[:balrogic, :teleport_manual]] ||= []
- $game_self_switches[[:balrogic, :teleport_manual]][sort] = [name, map, x, y, dir]
- end
- def self.disable
- $game_self_switches[[:balrogic, :teleport, :disabled]] = true
- end
- def self.enable
- $game_self_switches[[:balrogic, :teleport, :disabled]] = nil
- end
- def self.configuration
- @transition.call if @transition
- @sound.call if @sound
- $game_self_switches[[:balrogic, :teleport, :override]] = nil
- end
- def self.update
- $game_self_switches[[:balrogic, :teleport]] = $game_self_switches["Balrogic Teleport"] if $game_self_switches["Balrogic Teleport"]
- $game_self_switches[[:balrogic, :teleport_manual]] = $game_self_switches["Balrogic Teleport Manual"] if $game_self_switches["Balrogic Teleport Manual"]
- $game_self_switches[[:balrogic, :teleport, :disabled]] = $game_self_switches["Balrogic Teleport Disabled"] if $game_self_switches["Balrogic Teleport Disabled"]
- $game_self_switches["Balrogic Teleport"] = nil
- $game_self_switches["Balrogic Teleport Manual"] = nil
- $game_self_switches["Balrogic Teleport Disabled"] = nil
- end
- end # Module 2
- end # Module 1
- class Window_ChoiceList < Window_Command
- alias balrogic_old_update_placement update_placement
- def update_placement
- if $game_self_switches[[:balrogic, :teleport, :override]]
- self.width = [max_choice_width + 12, 96].max + padding * 2
- self.width = [width, Graphics.width].min
- self.height = fitting_height($game_message.choices.size) if $game_message.choices.size <= 8
- self.height = fitting_height(8) if $game_message.choices.size >= 9
- self.x = Graphics.width - width
- if @message_window.y >= Graphics.height / 2
- self.y = @message_window.y - height
- else
- self.y = @message_window.y + @message_window.height
- end
- else
- balrogic_old_update_placement
- end
- end
- end
- class Game_SelfSwitches
- def [](key)
- @data[key] || false
- end
- end
RAW Paste Data