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.

teleport from save points, world map screen script

Maker version: XP

ill post an image first
mapscreenexamplecopy.png

and now how i would like it to function:

call script that opens a screen similar to the example pic so it could be used in a save point or waystone in a map.

the list updates as you discover the location.

the map itself doesnt have any text on it. it will be a hand drawn then photoshopped map with its own text on the image

id like there to be a cursor that moves around the map as you scroll down the list of discovered areas pointing to the corresponding spot on the map image. see image, "list a" is selected and there is a red arrow above where "location a" is at, as you scroll to "list b" the arrow moves to "location b" and so on

ok, so basicly, you discover a location, and then via teleport option on key save points or waystones around the world youre able to transfer to previously visited areas. simple concept, similar to how the orange save pints work in ff12 only with a visual map instead of just a list. if you have any other questions about finer details go ahead and ask but i feel that my description should pretty much cover what i would like. thanks
 
Well, I made a script (that I should post here on rmxp.org, too) for teleports.

Author: Kyonides alias kyonides-arkanthos, shadowball

XP Version
http://www.box.net/shared/99j6kcmtpl

VX Version - just in case....
http://www.box.net/shared/llvcgy9xnt

I know for sure that you won't understand what the characters are saying there, but just take a look at the menu. By the way, you can open the menu if you press SHIFT or Z button on the map. You'll start with 2 predefined destinations but you can get a third one during gameplay.

If you add more options to the destination menu, they'll also appear there. It also includes a sword (used as a pointer) or and X if the location is unavailable.

You can use one of 2 different maps (one at a time).

If MenuVisible is true, you'll see a menu on the left hand side of the screen and the map should be smaller (width: 460 px). If MenuVisible is false, you won't see the menu and the map should be wider (width: 640 px). It's up to you which option suits your needs the most.
 
cool i should be able to work with this, might need to use google translator to translate the commented stuff and make it a bit easier on myself. its almost exactly what i was looking for, and i assume i can do this via a call script rather than having the map screen bound to a key correct?

thanks a bunch
 
Of course, you can also call the script like this: $scene = KyoTeleTrans.new

Later I'll edit this post to include some translated version of my script.

Edit...

Here's the translated script. Just copy and replace the one on the demo with this one.

Code:
##==========================================================

##

##   KyoTeleTrans XP v 1.3.0  (20090328 - 0402)

##   by Kyonides  alias kyonides-arkanthos, shadowball

##

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

=begin

  Instructions:

 

   Copy and paste the script above Main.

   To open the menu window press A or SHIFT button once.

   

   To make the destination menu visible:

   

   MenuVisible = true

   

   To make the destination menu disappear:

   

   MenuVisible = false

   

   To create a destination entry for your party a new array is needed

   

   Campment = ['Campment', DE01, 1, 7, 13, 0, 0, 40, 160]

   

   Array Values Description:

   

   Place = [

     Name, Description, MapID, MapX, MapY, Character direction on map, 

     City Sprite, CityX, CityY

   ]

   

   I personally encourage the use of Constants whenever it's possible,

   except for number values.

 

   You don't know where to get the MapX and MapY coordinates?

   Take a look at the bottom of the RPG Maker screen.

 

   #ID    Name    Dimensions  Coord. X,Y

   001: Campment   (21x18)     010,014

 

  Script Calls

  

   You can also call the script by entering the following line:

   

   $scene = KyoTeleTrans.new

 

   Adding New Places to the $places variable

 

     KyoVocab.new_place =

     KyoVocab::NameOfDestination

 

   Forgetting previously saved Destinations

 

     KyoVocab.forget_place =

     KyoVocab::NameOfDestination

 

   The path is blocked, you can go there...

 

     KyoVocab.forbidden = 'Name of Location'

     

   The path is now open, you may travel to X destination...

   

     KyoVocab.available = 'Name of Location'

 

   You may use Constants for the names of all destinations, i.e.

   

   Loc01 = 'My Workplace'

 

=end

module KyoVocab

  # Destination Menu Visible or Invisible

  MenuVisible = true

  # Mapa Sprite (Small One): Width 372, Height 304 px

  MAP = 'mini_mapaxp' if MenuVisible

  # Map Sprite (Large One): Width 640, Height 304 px

  MAP = 'gran_mapaxp' if MenuVisible == false

  # Constant for A Simple Question

  QUESTION = 'Where do you want to go now?'

  # Lands or Countries

  Land01 = 'Kaythege'

  # Places Constants

  Loc01 = 'Campamento'

  Loc02 = 'Cementerio'

  Loc03 = 'Montaña'

  # Sprites

  Pic01 = 'city01'

  Pic02 = 'city02'

  Pic03 = 'city03'

  Pic04 = 'city04'

  Pic05 = 'city05'

  Pic06 = 'city06'

  Pic07 = 'city01'

  Pic08 = 'mountain'

  # Descriptions (Strings)

  DE01 = 'Great community of 4 tents only...'

  DE02 = 'Last home for many losers like...'

  DE03 = 'One of the most dangerous cliffs...'

  # Available Places

  Campment = [Loc01, DE01, 1, 7, 13, 0, Pic01,  60, 168]

  Graveyard = [Loc02, DE02, 2, 9, 17, 0, Pic02,  88,  88]

  Mountain  = [Loc03, DE03, 3, 8,  5, 0, Pic08, 160, 140]

  NoPlace   = ['No Destinations']

  $places = [Graveyard, Montain]

  $forbidden = [Loc01]

  # Other Constants

  X, Y, Pointer, Error = 28, 16, 'sword', 'wrong'

  # Save new destination if not included already

  def self.new_place=(place)

    $places.push place if !$places.include?(place)

  end

  # Forget destination if already included

  def self.forget_place=(place)

    $places.delete place if $places.include?(place)

  end

  # Cannot travel to x destination if forbidden

  def self.forbidden=(place)

    $forbidden.push place if !$forbidden.include?(place)

  end

  # Cannot now travel to x destination, restriction lifted / waived

  def self.available=(place)

    $forbidden.delete place if $forbidden.include?(place)

  end

end

# Pointer Sprite Class

class Sprite_KyoArrow < Sprite

  def initialize(viewport)

    @viewport = viewport

    super(@viewport)

    self.x, self.y, self.z = x+8, y-16, 1000

  end

  

  def show_arrow(x,y) # Show Pointer if player can travel

    self.bitmap = RPG::Cache.picture(KyoVocab::Sword)

    self.x, self.y = x+8, y-16

    return

  end

  

  def show_cross(x,y) # Show error mark if forbidden

    self.bitmap = RPG::Cache.picture(KyoVocab::Error)

    self.x, self.y = x-4, y-8

    return

  end

end

# City Sprite Class

class Sprite_KyoCity < Sprite

  def initialize(viewport,picture,index,x,y,ox=0,oy=0)

    @viewport = viewport

    @viewport.z = 2500

    super(@viewport)

    # Use instance variables instead of global ones, create arrey

    @index, @places, @forbidden, @disabled = index, $places, $forbidden, []

    self.bitmap = RPG::Cache.picture(picture)

    self.x, self.y = x, y

    self.ox, self.oy = ox, oy

    self.zoom_x, self.zoom_y = 0.45, 0.45

    refresh

  end

  

  def dispose

    self.bitmap.dispose

    super

  end

  

  def disabled?(index)

    if @disabled.include?(index)

      return true

    else

      return false

    end

  end

  

  def refresh

    # If a location is forbidden, push its value into

    # disabled locations array

    if @forbidden.include?(@places[@index][0])

      @disabled.push @index if !@disabled.include?(@index)

      self.opacity = 128

    else

      self.opacity = 255

    end

  end

end

# City Name Sprite Class (shown on destination map)

class Sprite_KyoCityName < Sprite

  def initialize(viewport, city, x, y, index)

    super(viewport)

    @city, @index, @disabled = city, index, []

    # Use instance variables instead of global ones

    @places, @forbidden = $places, $forbidden

    self.bitmap = Bitmap.new(92, 44)

    self.bitmap.font.name = 'Arial'

    self.bitmap.font.size = 16

    self.x, self.y, self.z = x, y, 200

    update

  end

  

  def dispose

    self.bitmap.dispose

    super

  end

  

  def disabled?(index)

    if @disabled.include?(index)

      return true

    else

      return false

    end

  end

  

  def update

    super

    self.visible = true

    self.bitmap.font.bold = true

    # If a location is forbidden, push its value into

    # disabled locations array

    if @forbidden.include?(@places[@index][0])

      @disabled.push @index if !@disabled.include?(@index)

      self.bitmap.font.color.set(255,255,255,128)

    else

      self.bitmap.font.color.set(255,255,255,255)

    end

    self.bitmap.draw_text(self.bitmap.rect, @city, 1)

  end

end

# Window_Help Class Replacement

class Window_KyoHelp < Window_Base

  def initialize(x=180, y=416, w=460) # Default Values

    super(x, y, w, 64) # (X, Y, Width values required)

    self.contents = Bitmap.new(width - 32, height - 32)

  end

  

  def set_text(text, align=0, color=0)

    if text != @text or align != @align

      self.contents.clear

      self.contents.font.color = normal_color if color == 0

      self.contents.font.color = system_color if color == 1

      self.contents.draw_text(0, 0, self.width - 40, 32, text, align)

      @text = text

      @align = align

      @actor = nil

    end

    self.visible = true

  end

end

 

class Window_KyoTeleTrans < Window_Selectable

  include KyoVocab

  def initialize(x=0, y=64)

    super(x, y, 180, 352) #(0, 128, 180, 352)

    @column_max = 1

    # Use instance variables instead of global ones, create array

    @places, @forbidden, @disabled = $places, $forbidden, []

    # Make window disappear if MenuVisible value is false

    self.opacity, self.back_opacity = 0, 0 if MenuVisible == false

    refresh

    self.index = 0

  end

 

  def all_places # get contents of places array

    return @places

  end

 

  def place # get all contents of a single destination array

    return @places[self.index]

  end

  

  def place_name(index) # get destination name

    return @places[index][0]

  end

  

  def description # get destination description

    return @places[self.index][1]

  end

  

  def map_id(index) # get new MapID

    return @places[index][2]

  end

  

  def map_x(index) # get new map X coordinate

    return @places[index][3]

  end

  

  def map_y(index) # get new map Y coordinate

    return @places[index][4]

  end

  

  def char_dir(index) # get character sprite direction

    return @places[index][5]

  end

  

  def sprite(index) # get city sprite name

    return @places[index][6]

  end

  

  def city_x(index) # get city X coordinate on dest. map

    return @places[index][7]

  end

  

  def city_y(index) # get city Y coordinate on dest. map

    return @places[index][8]

  end

  

  def disabled?(index) # check forbidden destinations array

    if @disabled.include?(index)

      return true

    else

      return false

    end

  end

 

  def refresh

    if self.contents != nil

      self.contents.dispose

      self.contents = nil

    end

    # If no place found, create temporary array

    @item_max = NoPlace.size if @places.empty?

    # Get places array values size if it's not empty

    @item_max = @places.size if !@places.empty?

    if @item_max > 0

      self.contents = Bitmap.new(width - 32, row_max * 32)

      for i in 0...@item_max

        draw_place(i)

      end

    else

      self.contents.draw_text(4, 0, 212, 32, NoHay[0], 0)

    end

  end

 

  def draw_place(index)

    x = 4 + index % 1 * (288 + 32)

    y = index * 32

    # Destination Travel Permit Check

    if @forbidden.include?(place_name(index))

      @disabled.push index if !@disabled.include?(index)

      self.contents.font.color = disabled_color

    elsif @places.empty? and MenuVisible

      self.contents.font.color = normal_color

    end

    if !@places.empty? and MenuVisible

      self.contents.draw_text(4, y, 212, 32, place_name(index), 0)

    elsif @places.empty? and MenuVisible

      self.contents.font.color = disabled_color

      self.contents.draw_text(4, y, 212, 32, NoHay[0], 0)

    elsif MenuVisible == false

      self.contents.font.color.alpha = 0

    end

  end

  # Modified Parent Class Method - Pointer position and visibility

  def update_cursor_rect

    if @index < 0 or MenuVisible == false # If MenuVisible is false

      self.cursor_rect.empty # Menu cursor is invisible

      return

    end

    row = @index / @column_max

    if row < self.top_row

      self.top_row = row

    end

    if row > self.top_row + (self.page_row_max - 1)

      self.top_row = row - (self.page_row_max - 1)

    end

    cursor_width = self.width / @column_max - 32

    x = @index % @column_max * (cursor_width + 32)

    y = @index / @column_max * 32 - self.oy

    self.cursor_rect.set(x, y, cursor_width, 32)

  end

 

  def update_help # Update Current Destination Description

    @help_window.set_text(self.place == nil ? "" : description)

  end

end

 

# if =begin and =end are commented out you have the script calls

# for adding a new destination to the list may look like in the

# examples on the Instructions section above.

#   KyoVocab.new_place = Campment

# If not commented out, you may call a script function like this:

#   new_place = Campment

 

#=begin

class Interpreter;  include KyoVocab;  end

#=end

class KyoTeleTrans

  include KyoVocab

  def initialize

    @kyon_active_teletransport = false

  end

 

  def main

    #@spriteset = Spriteset_Map.new

    @map = Sprite.new 

    @map.bitmap = RPG::Cache.picture(MAP)

    @map.x, @map.y = 180, 64 if MenuVisible

    @map.x, @map.y =   0, 64 if MenuVisible == false

    # Show Country Name - To be improved in future releases

    @country_window = Window_KyoHelp.new(0,416,180)

    @country_window.set_text(Land01,1,1)

    @question_window = Window_Help.new

    @question_window.set_text(QUESTION,1)

    @help_window = Window_KyoHelp.new

    # Available Destinations Menu Window

    @teletrans_window = Window_KyoTeleTrans.new

    # Link TeleTrans Window to Window_Help Window

    @teletrans_window.help_window = @help_window

    create_places_sprites

    Graphics.transition(60, "Graphics/Transitions/015-Diamond01")

    Graphics.transition

    loop do

      Graphics.update

      Input.update

      update

      if $scene != self;  break;  end

    end

    Graphics.freeze

    dispose_places_sprites

    @country_window.dispose

    @question_window.dispose

    @help_window.dispose

    @teletrans_window.dispose

    @map.dispose

    unless @kyon_active_teletransport

      Graphics.transition(60, "Graphics/Transitions/015-Diamond01")

    else

      Graphics.transition(60, "Graphics/Transitions/006-Stripe02")

    end

    #@spriteset.dispose

  end

  

  def create_places_sprites # Create City and City Name Sprites

    @places_sprites, @places_names = [], []

    # Map, Cursor and Places Viewport if menu is visible

    @view = Viewport.new(180, 64, 372, 320) if MenuVisible

    # Map, Cursor and Places Viewport if menu is invisible

    @view = Viewport.new(0, 64, 640, 320)   if MenuVisible == false

    # Default Pointer location on Destination Map

    x = @teletrans_window.city_x(0)

    y = @teletrans_window.city_y(0)

    @arrow = Sprite_KyoArrow.new(@view)

    @arrow.show_arrow(x,y)

    for i in 0...@teletrans_window.all_places.size

      x = @teletrans_window.city_x(i)

      y = @teletrans_window.city_y(i)

      city_name = @teletrans_window.place_name(i) # Get city name

      @sprite = @teletrans_window.sprite(i)   # Get its sprite filename

      # If Sprite name is nil, randomly select a custom sprite filename

      random_city_picture(@teletrans_window.sprite(i)) if @sprite == nil

      # Sprites de Ciudades y Otros Lugares

      @places_sprites.push(Sprite_KyoCity.new(@view, @sprite, i, x, y))

      # Leyendas de Nombres de Ciudades y Otros Lugares

      name_sprite = Sprite_KyoCityName.new(@view, city_name, x-X, y+Y, i)

      @places_names.push(name_sprite)

    end

  end

  # Dispose City, City name and Pointer Sprites

  def dispose_places_sprites

    (@places_sprites+@places_names).each {|sprite| sprite.dispose}

    @arrow.dispose

  end

  # If Sprite name is nil, randomly select a custom sprite filename

  def random_city_picture(sprite=nil)

    case rand(7) # Random Value Assignment

    when 0,1; @sprite = 'city01'

    when 2;   @sprite = 'city02'

    when 3;   @sprite = 'city03'

    when 4;   @sprite = 'city04'

    when 5;   @sprite = 'city05'

    when 6;   @sprite = 'city06'

    when 7;   @sprite = 'city07'

    end

  end

  

  def update

    @arrow.update

    @country_window.update

    @question_window.update

    @help_window.update

    @teletrans_window.update

    @index = @teletrans_window.index

    if @teletrans_window.active;  update_places;  return;  end

  end

  

  def update_places

    update_arrow

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      @kyon_active_teletransport = false

      $scene = Scene_Map.new

      return

    end

    if Input.trigger?(Input::C)

      if $places.size == 0 or @teletrans_window.disabled?(@index)

        $game_system.se_play($data_system.buzzer_se)

        return

      end

      $game_system.se_play($data_system.decision_se)

      # Interruptor para cambiar Efecto de Transición

      @kyon_active_teletransport = true

      # Procesar teletransportación

      $game_temp.player_transferring = true

      $game_temp.player_new_map_id = @teletrans_window.map_id(@index)

      $game_temp.player_new_x = @teletrans_window.map_x(@index)

      $game_temp.player_new_y = @teletrans_window.map_y(@index)

      $game_temp.player_new_direction = @teletrans_window.char_dir(@index)

      Graphics.freeze

      $game_temp.transition_processing = true

      $scene = Scene_Map.new

      #$game_temp.transition_name = "015-Diamond01"

      return

    end

  end

  # Change pointer if next location is available or grayed out

  def update_arrow

    if @index != @i

      if @teletrans_window.disabled?(@index)

        @arrow.show_cross(@teletrans_window.city_x(@index),

            @teletrans_window.city_y(@index))

      else

        @arrow.show_arrow(@teletrans_window.city_x(@index), 

            @teletrans_window.city_y(@index))

      end

      @i = @index

    end

  end

end

 

class Scene_Map

  alias kyon_sm_up update

  def update

    # If player press A or SHIFT button, call script

    if Input.trigger?(Input::A) or Input.trigger?(Input::Z)

      $game_system.se_play($data_system.decision_se)

      $scene = KyoTeleTrans.new # Go to Dest. Map and Menu Scene

      return

    end

    kyon_sm_up

  end

end

 

class Scene_Save  

  alias kyon_write_save_data write_save_data

  def write_save_data(file)

    kyon_write_save_data(file)

    # Saved non-standard global variables

    Marshal.dump($places, file)

    Marshal.dump($forbidden, file)

  end

end

 

class Scene_Load

  alias kyon_read_save_data read_save_data

  def read_save_data(file)

    kyon_read_save_data(file)

    # Load non-standard global variables

    $places    = Marshal.load(file)

    $forbidden = Marshal.load(file)

  end

end
 

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