Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Who made this?

prepe

Member

Can someone tell me who made this, and possible what it dose?,

Code:
#============================================================================== 
# ★ FSG_Teleport ver 0.12 By Mackie at www.tekepon.net
#------------------------------------------------------------------------------ 
# Been to the city and choose the moment to move the Teleport is available 
# Item skills and allow you to the script material. 
#==============================================================================

# â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½
module FSG
module Teleport

# â–¼ identifying string of Teleport 
# The string of Notes that are included when the Teleport is assumed. 
# [Effective range is None, when available, the menu only. 
SIGNATURE = "*TELEPORT"

# â–¼ Teleport allow switch ID 
# This number switch to ON, the Teleport is available. 
# Ongoing events in the dungeon, and you can is OFF.
PERMISSION_SID = 1

# â–¼ Move to allow vehicles switch ID 
# ON switch to the number of the vehicle when Teleport moves are effective. 
# Front of the vehicle, such as OFF If you do not want to move on please.
ENABLE_BOAT_SID    = 1    # boat
ENABLE_SHIP_SID    = 1    # ship
ENABLE_AIRSHIP_SID = 1    # airship

# â–¼ allow Teleport set of embarkation 
# If you ride, whether to allow Teleport set. 
# Permit, even if you allow Teleport Teleport when the switch is OFF. 
# (True: Allow false: Do not allow) 
ENABLE_IN_VEHICLE = true

# â–¼ Teleport location data table
# Switch ID, name the player to move the boat to move a large ship's destination, 
# Airship to move in order to store enough of an array of ranks. 
# ON corresponding to the switch the location to teleport there. 
# 
# <How to specify the destination> 
# Players, each of the following vehicles, please specify. 
# [Map ID, X coordinate, Y coordinates, after moving orientation (numeric response, as if 0) 
# Players are required to move the vehicle to move the case out of [].
PLACES =
[
  [1, "Location A", [1, 0, 0, 0], [1, 1, 0, 0], [1, 2, 0, 0], [1, 3, 0, 0]],
  [1, "where B", [1, 0, 0, 0], [], [], []],
  [1, "Location C", [1, 0, 0, 0], [], [], []],
] # End PLACES

# â–¼ SE runtime Teleport
# SE name, volume, pitch, in that order, please specify. 
# (If you do not specify []) 
SE = ["Teleport", 80, 100]

end
end
# â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½ â–² â–½

module FSG
  # Script introduced flag 
  RGSS = {} unless defined?(RGSS)
  RGSS["Teleport"] = true
end

module FSG::Teleport
  #-------------------------------------------------------------------------- 
  # ☆ determine Teleport available 
  #-------------------------------------------------------------------------- 
  def self.can_use?
    return false if $game_temp.in_battle
    return false if PLACES.empty?
    return false unless $game_switches[PERMISSION_SID]
    return false if (not ENABLE_IN_VEHICLE and $game_player.in_vehicle?)
    PLACES.each {|place| return true if $game_switches[place[0]]}
    return false
  end
  #-------------------------------------------------------------------------- 
  # ☆ Players move 
  # Places: at Teleport data (sequence) 
  #--------------------------------------------------------------------------
  def self.set_player(places)
    place = places[2]
    $game_player.reserve_transfer(place[0], place[1], place[2], place[3])
  end
  #-------------------------------------------------------------------------- 
  # ☆ Vehicles move 
  # Places: at Teleport data (sequence) 
  #--------------------------------------------------------------------------
  def self.set_vehicles(places)
    # Boat
    if $game_switches[ENABLE_BOAT_SID]
      place = places[3]
      unless place.empty?
        $game_map.boat.set_location(place[0], place[1], place[2])
        $game_map.boat.set_direction(place[3])
      end
    end
    # Ship
    if $game_switches[ENABLE_SHIP_SID]
      place = places[4]
      unless place.empty?
        $game_map.ship.set_location(place[0], place[1], place[2])
        $game_map.ship.set_direction(place[3])
      end
    end
    # Airship
    if $game_switches[ENABLE_AIRSHIP_SID]
      place = places[5]
      unless place.empty?
        $game_map.airship.set_location(place[0], place[1], place[2])
        $game_map.airship.set_direction(place[3])
      end
    end
  end

  module Sound
    # Teleport
    def self.play_teleport
      RPG::SE.new(SE[0], SE[1], SE[2]).play unless SE.empty?
    end
  end
end

#==============================================================================

class RPG::UsableItem
  #-------------------------------------------------------------------------- 
  # ☆ Teleport for determining whether or not 
  #--------------------------------------------------------------------------
  def is_teleport?
    return @note.include?(FSG::Teleport::SIGNATURE)
  end
end

#==============================================================================

class Game_Actor
  #-------------------------------------------------------------------------- 
  # â—‹ determine the skills available 
  # Skill: skill 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_skill_can_use? skill_can_use?
  def skill_can_use?(skill)
    return false unless skill.is_a?(RPG::Skill)
    return FSG::Teleport::can_use? if skill.is_teleport?
    return _FSG_Teleport_skill_can_use?(skill)
  end
end

class Game_Party
  #-------------------------------------------------------------------------- 
  # â—‹ available in judgement 
  # Item: Item 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_item_can_use? item_can_use?
  def item_can_use?(item)
    return false unless item.is_a?(RPG::Item)
    return false if item_number(item) == 0
    return FSG::Teleport::can_use? if item.is_teleport?
    return _FSG_Teleport_item_can_use?(item)
  end
end

class Game_Player
  #-------------------------------------------------------------------------- 
  # â—‹ published instance variable 
  #--------------------------------------------------------------------------
  attr_accessor :fsg_teleport_places     # data at Teleport 
  #-------------------------------------------------------------------------- 
  # â—‹ object initialization 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_initialize initialize
  def initialize
    _FSG_Teleport_initialize
    @fsg_teleport_places = []
  end
  #-------------------------------------------------------------------------- 
  # â—‹ moved execution 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_perform_transfer perform_transfer
  def perform_transfer
    fsg_prepare_teleport
    _FSG_Teleport_perform_transfer
    fsg_perform_teleport
  end
  #-------------------------------------------------------------------------- 
  # ☆ Teleport reservation 
  # Places: at Teleport data (sequence) 
  #--------------------------------------------------------------------------
  def fsg_reserve_teleport(places)
    @fsg_teleport_places = places
    FSG::Teleport::set_player(places)
  end
  #-------------------------------------------------------------------------- 
  # ☆ Preparing Teleport 
  #--------------------------------------------------------------------------
  def fsg_prepare_teleport
    return if @fsg_teleport_places.empty?
    return unless in_vehicle?
    $game_map.vehicles[@vehicle_type].get_off     # processing step down 
    @vehicle_type = -1                            # erase type vehicles 
    @move_speed = 4                               # move back to speed 
    @through = false                              # through OFF  
    @walking_bgm.play                             # return BGM
  end
  #-------------------------------------------------------------------------- 
  # ☆ Teleport run 
  #--------------------------------------------------------------------------
  def fsg_perform_teleport
    return if @fsg_teleport_places.empty?
    FSG::Teleport::Sound.play_teleport
    FSG::Teleport::set_vehicles(@fsg_teleport_places)
    @fsg_teleport_places = []
    @transparent = false                          # transparent lift 
    make_encounter_count                          # a initial count of encounter
  end
end

#============================================================================== 
# ★ Window_Teleport 
#------------------------------------------------------------------------------
# Teleport at the suggestion of a list of the window.
#==============================================================================

class FSG_Window_Teleport < Window_Selectable
  #--------------------------------------------------------------------------
  # ☆ object initialization 
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 272, 416)
    refresh
  end
  #--------------------------------------------------------------------------
  # ☆ Item acquisition 
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ☆ Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @data = []
    for place in FSG::Teleport::PLACES
      if $game_switches[place[0]]
        @data.push(place)
      end
    end
    @item_max = [@data.size, 1].max
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ☆ Also drawing
  # Index: item numbers 
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    self.contents.clear_rect(rect)
    place = @data[index]
    if place != nil
      self.contents.draw_text(rect, place[1])
    end
  end
end

#==============================================================================

class Scene_Item
  #--------------------------------------------------------------------------
  # â—‹ start processing 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_start start
  def start
    _FSG_Teleport_start
    @teleport_window = FSG_Window_Teleport.new
    fsg_hide_teleport_window
  end
  #--------------------------------------------------------------------------
  # â—‹ termination 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_terminate terminate
  def terminate
    _FSG_Teleport_terminate
    @teleport_window.dispose
  end
  #--------------------------------------------------------------------------
  # â—‹ frame update
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_update update
  def update
    teleport_active = @teleport_window.active
    _FSG_Teleport_update
    @teleport_window.update
    if teleport_active
      fsg_update_teleport_selection
    end
  end
  #--------------------------------------------------------------------------
  # â—‹ Item decision
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_determine_item determine_item
  def determine_item
    if @item.is_teleport?
      fsg_show_teleport_window(@item_window.index % 2 == 0)
    else
      _FSG_Teleport_determine_item
    end
  end
  #--------------------------------------------------------------------------
  # ☆ Display TEREPOTOUINDOU 
  # Right: right justification flags (false, left justification) 
  #--------------------------------------------------------------------------
  def fsg_show_teleport_window(right)
    @item_window.active = false
    width_remain = 544 - @teleport_window.width
    @teleport_window.x = right ? width_remain : 0
    @teleport_window.visible = true
    @teleport_window.active = true
    @teleport_window.index = 0
    if right
      @viewport.rect.set(0, 0, width_remain, 416)
      @viewport.ox = 0
    else
      @viewport.rect.set(@teleport_window.width, 0, width_remain, 416)
      @viewport.ox = @teleport_window.width
    end
  end
  #--------------------------------------------------------------------------
  # ☆ Hide TEREPOTOUINDOU
  #--------------------------------------------------------------------------
  def fsg_hide_teleport_window
    @item_window.active = true
    @teleport_window.visible = false
    @teleport_window.active = false
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # ☆ Teleport selected update
  #--------------------------------------------------------------------------
  def fsg_update_teleport_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      fsg_hide_teleport_window
    elsif Input.trigger?(Input::C)
      fsg_determine_teleport
    end
  end
  #--------------------------------------------------------------------------
  # ☆ Teleport decision
  #--------------------------------------------------------------------------
  def fsg_determine_teleport
    places = @teleport_window.item
    if places == nil
      Sound.play_buzzer
    else
      Sound.play_use_item
      $game_party.last_item_id = @item.id
      $game_party.consume_item(@item)
      $game_player.fsg_reserve_teleport(places)
      $scene = Scene_Map.new
    end
  end
end

class Scene_Skill
  #--------------------------------------------------------------------------
  # â—‹ start processing
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_start start
  def start
    _FSG_Teleport_start
    @teleport_window = FSG_Window_Teleport.new
    fsg_hide_teleport_window
  end
  #--------------------------------------------------------------------------
  # â—‹ termination 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_terminate terminate
  def terminate
    _FSG_Teleport_terminate
    @teleport_window.dispose
  end
  #--------------------------------------------------------------------------
  # â—‹ frame update 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_update update
  def update
    teleport_active = @teleport_window.active
    _FSG_Teleport_update
    @teleport_window.update
    if teleport_active
      fsg_update_teleport_selection
    end
  end
  #--------------------------------------------------------------------------
  # â—‹ decision skills 
  #--------------------------------------------------------------------------
  alias _FSG_Teleport_determine_skill determine_skill
  def determine_skill
    if @skill.is_teleport?
      fsg_show_teleport_window(@skill_window.index % 2 == 0)
    else
      _FSG_Teleport_determine_skill
    end
  end
  #--------------------------------------------------------------------------
  # ☆ Display TEREPOTOUINDOU 
  # Right: right justification flags (false, left justification) 
  #--------------------------------------------------------------------------
  def fsg_show_teleport_window(right)
    @skill_window.active = false
    width_remain = 544 - @teleport_window.width
    @teleport_window.x = right ? width_remain : 0
    @teleport_window.visible = true
    @teleport_window.active = true
    @teleport_window.index = 0
    if right
      @viewport.rect.set(0, 0, width_remain, 416)
      @viewport.ox = 0
    else
      @viewport.rect.set(@teleport_window.width, 0, width_remain, 416)
      @viewport.ox = @teleport_window.width
    end
  end
  #--------------------------------------------------------------------------
  # ☆ Hide TEREPOTOUINDOU
  #--------------------------------------------------------------------------
  def fsg_hide_teleport_window
    @skill_window.active = true
    @teleport_window.visible = false
    @teleport_window.active = false
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # ☆ Teleport selected update
  #--------------------------------------------------------------------------
  def fsg_update_teleport_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      fsg_hide_teleport_window
    elsif Input.trigger?(Input::C)
      fsg_determine_teleport
    end
  end
  #--------------------------------------------------------------------------
  # ☆ Teleport decision
  #--------------------------------------------------------------------------
  def fsg_determine_teleport
    places = @teleport_window.item
    if places == nil
      Sound.play_buzzer
    else
      Sound.play_use_skill
      @actor.last_skill_id = @skill.id
      @actor.mp -= @actor.calc_mp_cost(@skill)
      $game_player.fsg_reserve_teleport(places)
      $scene = Scene_Map.new
    end
  end
end

I think it is a script to teleport you from a vehicle, to a map by pushing a button. Like entering the inside of a vehicle from the world map?, but I'm not shore I can't code or read it? Any help would be great!

Thanks
~prepe~
 

Akin

Member

it looks like what it does it setup a "Teleport Skill" or "Teleport Item" that when used brings up a menu that lists places you can teleport to. No idea how to actually use it, but I'm 90% sure that is what it does.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top