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.

Zelda Style Map Transition

Zelda-Style Map ScrollVersion: 1.0
By: Glaciesflamma

Introduction

This is something I'm sure has been asked for before, but I hadn't seen anyone produce the script just yet - at least not quite in the way I had hoped for when I started looking around. So I set to work to make it myself.

This Script was possible only thanks to SephirothSpawn's Tilemap Class Rewrite. I Used his script as a base and edited it as needed

This script creates 2D Zelda-Style Map Transitioning. As the Game Player approaches the maps edge, and tries to move off it, the script will load and draw the adjacent map, pan the screen over, and then load the adjacent map completely once done. The only condition of these is that the adjacent edges of the map must be equal in size, and 'lined up' (i.e. if moving left/right, the x coordinates are parallel to each other.)

This is accomplished mostly through the script itself, though the Game Maker will have to make a single event on each map titled "Transfer" that indicates the map ids of the map located in each direction. Leaving a direction out will prevent the transition for attempting to happen.

Features
  • Zelda-Style Map scrolling from one map to another
  • Able to transition to maps with different tilesets
  • Will draw and support events located on new map as transition occurs

Screenshots

Currently, I do not have any screenshots [I feel this would be hard to demonstrate via screenshots anyhow]. However, feel free to check out the script at work in the demo!

Demo

Zelda Map Scroll Demo

Script


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

# Tilemap Class

#------------------------------------------------------------------------------

# Script by SephirothSpawn

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

 

 

 

 

class Tilemap

  #--------------------------------------------------------------------------

  Animated_Autotiles_Frames = 15

  #--------------------------------------------------------------------------

  Autotiles = [

    [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27,  6, 33, 34], [ 5,  6, 33, 34],

      [27, 28, 33, 12], [ 5, 28, 33, 12], [27,  6, 33, 12], [ 5,  6, 33, 12] ],

    [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27,  6, 11, 34], [ 5,  6, 11, 34],

      [27, 28, 11, 12], [ 5, 28, 11, 12], [27,  6, 11, 12], [ 5,  6, 11, 12] ],

    [ [25, 26, 31, 32], [25,  6, 31, 32], [25, 26, 31, 12], [25,  6, 31, 12],

      [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],

    [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],

      [39, 40, 45, 46], [ 5, 40, 45, 46], [39,  6, 45, 46], [ 5,  6, 45, 46] ],

    [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],

      [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],

    [ [37, 38, 43, 44], [37,  6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],

      [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1,  2,  7,  8] ]

  ]

  #--------------------------------------------------------------------------

  attr_reader   :layers

  attr_accessor :tileset

  attr_accessor :autotiles

  attr_accessor :map_data

  attr_accessor :flash_data

  attr_accessor :priorities

  attr_accessor :visible

  attr_accessor :ox

  attr_accessor :oy

  #--------------------------------------------------------------------------

  def initialize(viewport, map = $game_map.map)

    @layers = []

    for l in 0...6

      layer = (true ? Plane.new(viewport) : Sprite.new(viewport))

      layer.bitmap = Bitmap.new(map.width * 32, map.height * 32)

      layer.z = l * 160

      @layers << layer

    end

    @tileset    = nil  # Refers to Map Tileset Name

    @autotiles  = []   # Refers to Tileset Auto-Tiles (Actual Auto-Tiles)

    @map_data   = nil  # Refers to 3D Array Of Tile Settings

    @flash_data = nil  # Refers to 3D Array of Tile Flashdata

    @priorities = nil  # Refers to Tileset Priorities

    @visible    = true # Refers to Tilest Visibleness

    @ox         = 0    # Bitmap Offsets

    @oy         = 0    # bitmap Offsets

    @data       = nil  # Acts As Refresh Flag

    @map         = map

    @tone        = Tone.new(0,0,0,0)

    @plane       = true

    @zoom_x      = 1.0

    @zoom_y      = 1.0

    @tile_width  = 32

    @tile_height = 32

  end

  #--------------------------------------------------------------------------

  def prepare_transition(new_map, dir, viewport)

    @new_map = new_map

    @new_data = @new_map.data

    @dir = dir

    for l in 0...6

      @layers[l].dispose

      @layers[l] = nil

      layer = (true ? Plane.new(viewport) : Sprite.new(viewport))

      layer.bitmap = Bitmap.new((@map.width + @new_map.width) * 32, 

                                (@map.height + @new_map.height) * 32)

      layer.z = l * 160

      @layers[l] = layer

    end

    if @dir == 4

      @ox = @new_data.xsize * 53

    elsif @dir == 8

      @oy = @new_data.ysize * 128

    end

    merge_refresh

  end

  #--------------------------------------------------------------------------

  def dispose

    for layer in @layers

      layer.dispose

    end

  end

  #--------------------------------------------------------------------------

  def update

    if @data != @map_data or (@new_map != nil and @new_data != @new_data)

      if @new_map == nil

        refresh

      else

        merge_refresh

      end

    end

    unless @tone == $game_screen.tone

      @tone = $game_screen.tone

      @tone = Tone.new(0, 0, 0, 0) if @tone.nil?

      for layer in @layers

        layer.tone = @tone

        layer.tone = @tone

      end

    end

    for layer in @layers

      layer.ox = @ox

      layer.oy = @oy

      layer.z = @layers.index(layer) * 32

    end

    if Graphics.frame_count % Animated_Autotiles_Frames == 0

      refresh_autotiles

    end

  end

  #--------------------------------------------------------------------------

  def refresh

    @data = @map_data

    for p in 0..5

      for z in 0...@map_data.zsize

        for x in 0...@map_data.xsize

          for y in 0...@map_data.ysize

            id = @map_data[x, y, z]

            next if id == 0

            next unless p == @priorities[id]

            id < 384 ? draw_autotile(x, y, p, id) : draw_tile(x, y, p, id)

          end

        end

      end

    end

  end

  #--------------------------------------------------------------------------

  def merge_refresh

    @data = @map_data

    @new_data = @new_map.data

    z_max = @map_data.zsize

    if [2,8].include?(@dir)

      x_max = @map_data.xsize

      y_max = @map_data.ysize + @new_data.ysize

    elsif [4,6].include?(@dir)

      x_max = @map_data.xsize + @new_data.xsize

      y_max = @map_data.ysize

    end

    for p in 0..5

      for z in 0...z_max

        for x in 0...x_max

          for y in 0...y_max

            if [2,8].include?(@dir)

              if y < @map_data.ysize

                id = @map_data[x, y, z]

                draw_map = @map

              else

                id = @new_data[x, y - @map_data.ysize, z]

                draw_map = @new_map

              end

            elsif [4,6].include?(@dir)

              if x < @map_data.xsize

                id = @map_data[x, y, z]

                draw_map = @map

              else

                id = @new_data[x - @map_data.xsize, y, z]

                draw_map = @new_map

              end

            end

            next if id == 0

            next unless p == $data_tilesets[draw_map.tileset_id].priorities[id]

            id < 384 ? draw_autotile(x, y, p, id, draw_map) : draw_tile(x, y, p, id, draw_map)

          end

        end

      end

    end

  end

  #--------------------------------------------------------------------------

  def refresh_autotiles

    autotile_locations = Table.new(@map_data.xsize, @map_data.ysize,

      @map_data.zsize)

    for p in 0..5

      for z in 0...@map_data.zsize

        for x in 0...@map_data.xsize

          for y in 0...@map_data.ysize

            id = @map_data[x, y, z]

            next if id == 0

            next unless p == @priorities[id]

            if id < 384

              next unless @autotiles[id / 48 - 1].width / 96 > 1

              draw_autotile(x, y, p, id)

              autotile_locations[x, y, 0] = 1

              autotile_locations[x, y, 1] = 1

              autotile_locations[x, y, 2] = 1

            else

              if autotile_locations[x, y, z] == 1

                draw_tile(x, y, p, id)

              end

            end

          end

        end

      end

    end

  end

  #--------------------------------------------------------------------------

  def draw_tile(x, y, z, id, source=@map)

    tileset = RPG::Cache.tileset($data_tilesets[source.tileset_id].tileset_name)

    rect = Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32, 32, 32)

    x *= @tile_width

    y *= @tile_height

    if @tile_width == 32 && @tile_height == 32

      @layers[z].bitmap.blt(x, y, tileset, rect)

    else

      dest_rect = Rect.new(x, y, @tile_width, @tile_height)

      @layers[z].bitmap.stretch_blt(dest_rect, tileset, rect)

    end

  end

  #--------------------------------------------------------------------------

  def draw_autotile(x, y, z, tile_id, source = @map)

    if source == @map

      autotile = @autotiles[tile_id / 48 - 1]

    else

      autotile = RPG::Cache.autotile(@new_map.autotile_names[tile_id / 48 - 1])

    end

    tile_id %= 48

    bitmap = Bitmap.new(32, 32)

    tiles = Autotiles[tile_id / 8][tile_id % 8]

    frames = autotile.width / 96

    anim = (Graphics.frame_count / Animated_Autotiles_Frames) % frames * 96

    for i in 0...4

      tile_position = tiles[i] - 1

      src_rect = Rect.new(tile_position % 6 * 16 + anim,

        tile_position / 6 * 16, 16, 16)

      bitmap.blt(i % 2 * 16, i / 2 * 16, autotile, src_rect)

    end

    x *= @tile_width

    y *= @tile_height

    if @tile_width == 32 && @tile_height == 32

      @layers[z].bitmap.blt(x, y, bitmap, Rect.new(0, 0, 32, 32))

    else

      dest_rect = Rect.new(x, y, @tile_width, @tile_height)

      @layers[z].bitmap.stretch_blt(dest_rect, bitmap, Rect.new(0, 0, 32, 32))

    end

  end

  #--------------------------------------------------------------------------

  def bitmap

    bitmap = Bitmap.new(@layers[0].bitmap.width, @layers[0].bitmap.height)

    for layer in @layers

      bitmap.blt(0, 0, layer.bitmap, Rect.new(0, 0, 

        bitmap.width, bitmap.height))

    end

    return bitmap

  end

  #--------------------------------------------------------------------------

end

Code:
class Game_Temp

  attr_accessor :map_transitioning

  alias original_initialize initialize

  def initialize

    original_initialize

    @map_transitioning = false

  end

end

 

class Game_Map

  attr_reader   :map_link

  #--------------------------------------------------------------------------

  # * Setup

  #     map_id : map ID

  #--------------------------------------------------------------------------

  def setup(map_id)

    # Put map ID in @map_id memory

    @map_id = map_id

    # Load map from file and set @map

    @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))

    # set tile set information in opening instance variables

    tileset = $data_tilesets[@map.tileset_id]

    @tileset_name = tileset.tileset_name

    @autotile_names = tileset.autotile_names

    @panorama_name = tileset.panorama_name

    @panorama_hue = tileset.panorama_hue

    @fog_name = tileset.fog_name

    @fog_hue = tileset.fog_hue

    @fog_opacity = tileset.fog_opacity

    @fog_blend_type = tileset.fog_blend_type

    @fog_zoom = tileset.fog_zoom

    @fog_sx = tileset.fog_sx

    @fog_sy = tileset.fog_sy

    @battleback_name = tileset.battleback_name

    @passages = tileset.passages

    @priorities = tileset.priorities

    @terrain_tags = tileset.terrain_tags

    # Initialize displayed coordinates

    @display_x = 0

    @display_y = 0

    # Clear refresh request flag

    @need_refresh = false

    # Set map event data

    @events = {}

    @map_link = [nil,0,0,0,0]

    for i in @map.events.keys

      @events[i] = Game_Event.new(@map_id, @map.events[i])

      if @map.events[i].name == "Transfer"

        for command in @map.events[i].pages[0].list

          if command.parameters[0].is_a?(String)

            if command.parameters[0]upcase..include?("LEFT")

              left = command.parameters[0].split(':')[1]

            elsif command.parameters[0].upcase.include?("UP")

              up = command.parameters[0].split(':')[1]

            elsif command.parameters[0].upcase.include?("RIGHT")

              right = command.parameters[0].split(':')[1]

            elsif command.parameters[0].upcase.include?("DOWN")

              down = command.parameters[0].split(':')[1]

            end

          else

            break

          end

        end

        @map_link[1] = down.to_i

        @map_link[2] = left.to_i

        @map_link[3] = right.to_i

        @map_link[4] = up.to_i

      end

    end

    # Set common event data

    @common_events = {}

    for i in 1...$data_common_events.size

      @common_events[i] = Game_CommonEvent.new(i)

    end

    # Initialize all fog information

    @fog_ox = 0

    @fog_oy = 0

    @fog_tone = Tone.new(0, 0, 0, 0)

    @fog_tone_target = Tone.new(0, 0, 0, 0)

    @fog_tone_duration = 0

    @fog_opacity_duration = 0

    @fog_opacity_target = 0

    # Initialize scroll information

    @scroll_direction = 2

    @scroll_rest = 0

    @scroll_speed = 4

    @transition_direction = 2

    @transition_rest = 0

    @transition_speed = 4

  end

  #--------------------------------------------------------------------------

  # * Get Map

  #--------------------------------------------------------------------------

  def map

    return @map

  end

  #--------------------------------------------------------------------------

  # * Get Map

  #--------------------------------------------------------------------------

  def tileset_id

    return @map.tileset_id

  end

  #--------------------------------------------------------------------------

  # * Scroll Up or Down (Map Transition)

  #     distance : scroll distance

  #--------------------------------------------------------------------------

  def transition_up_down(distance)

    @display_y = @display_y + distance

  end

  #--------------------------------------------------------------------------

  # * Scroll Left or Right (Map Transition)

  #     distance : scroll distance

  #--------------------------------------------------------------------------

  def transition_left_right(distance)

    @display_x = @display_x + distance

  end

  #--------------------------------------------------------------------------

  # * Start Map Transition

  #     direction : scroll direction

  #     distance  : scroll distance

  #     speed     : scroll speed

  #--------------------------------------------------------------------------

  def start_transition(direction, distance, speed)

    @transition_direction = direction

    @transition_rest = distance

    @transition_speed = speed

  end

  #--------------------------------------------------------------------------

  # * Determine if Transitioning

  #--------------------------------------------------------------------------

  def transitioning?

    return @transition_rest > 0

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Refresh map if necessary

    if $game_map.need_refresh

      refresh

    end

    # If scrolling

    if @scroll_rest > 0

      # Change from scroll speed to distance in map coordinates

      distance = 2 ** @scroll_speed

      # Execute scrolling

      case @scroll_direction

      when 2  # Down

        scroll_down(distance)

      when 4  # Left

        scroll_left(distance)

      when 6  # Right

        scroll_right(distance)

      when 8  # Up

        scroll_up(distance)

      end

      # Subtract distance scrolled

      @scroll_rest -= distance

    end

    # If transitioning

    if @transition_rest > 0

      # Change from scroll speed to distance in map coordinates

      distance = 2 ** @transition_speed

      # Execute scrolling

      case @transition_direction

      when 2  # Down

        transition_up_down(-1 * distance)

      when 4  # Left

        transition_left_right(distance)

      when 6  # Right

        transition_left_right(-1 * distance)

      when 8  # Up

        transition_up_down(distance)

      end

      # Subtract distance scrolled

      @transition_rest -= distance

    end

    # Update map event

    for event in @events.values

      event.update

    end

    # Update common event

    for common_event in @common_events.values

      common_event.update

    end

    # Manage fog scrolling

    @fog_ox -= @fog_sx / 8.0

    @fog_oy -= @fog_sy / 8.0

    # Manage change in fog color tone

    if @fog_tone_duration >= 1

      d = @fog_tone_duration

      target = @fog_tone_target

      @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d

      @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d

      @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d

      @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d

      @fog_tone_duration -= 1

    end

    # Manage change in fog opacity level

    if @fog_opacity_duration >= 1

      d = @fog_opacity_duration

      @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d

      @fog_opacity_duration -= 1

    end

  end

end

 

class Game_Character

  attr_accessor :move_speed

  #--------------------------------------------------------------------------

  # * Get Screen X-Coordinates

  #--------------------------------------------------------------------------

  def screen_x(temp=false)

    # Get screen coordinates from real coordinates and map display position

    if temp and !self.is_a?(Game_Player)

      if $game_player.direction == 4

        return (@real_x - $game_map.display_x + 3) / 4 + 16 - 640

      elsif $game_player.direction == 6

        return (@real_x - $game_map.display_x + 3) / 4 + 16 + 640

      end

    end

    return (@real_x - $game_map.display_x + 3) / 4 + 16

  end

  #--------------------------------------------------------------------------

  # * Get Screen Y-Coordinates

  #--------------------------------------------------------------------------

  def screen_y(temp=false)

    # Get screen coordinates from real coordinates and map display position

    if temp and !self.is_a?(Game_Player)

      if $game_player.direction == 2

        y = (@real_y - $game_map.display_y + 3) / 4 + 32 + 480

      elsif $game_player.direction == 8

        y = (@real_y - $game_map.display_y + 3) / 4 + 32 - 480

      end

    end

    y = (@real_y - $game_map.display_y + 3) / 4 + 32 if y == nil

    # Make y-coordinate smaller via jump count

    if @jump_count >= @jump_peak

      n = @jump_count - @jump_peak

    else

      n = @jump_peak - @jump_count

    end

    return y - (@jump_peak * @jump_peak - n * n) / 2

  end

  #--------------------------------------------------------------------------

  # * Get Screen Z-Coordinates

  #     height : character height

  #--------------------------------------------------------------------------

  def screen_z(height = 0)

    # If display flag on closest surface is ON

    if @always_on_top

      # 999, unconditional

      return 999

    end

    # Get screen coordinates from real coordinates and map display position

    z = 0#(@real_y - $game_map.display_y + 3) / 4 + 32

    # If tile

    if @tile_id > 0

      # Add tile priority * 32

      return z + $game_map.priorities[@tile_id] * 32

    # If character

    else

      # If height exceeds 32, then add 31

      return z #+ ((height > 32) ? 31 : 0)

    end

  end

  #--------------------------------------------------------------------------

  # * Move Down

  #     turn_enabled : a flag permits direction change on that spot

  #--------------------------------------------------------------------------

  def move_down(turn_enabled = true, override = false)

    # Turn down

    if turn_enabled

      turn_down

    end

    # If passable

    if passable?(@x, @y, 2) or override

      # Turn down

      turn_down

      # Update coordinates

      @y += 1

      # Increase steps

      increase_steps

    # If impassable

    else

      # Determine if touch event is triggered

      check_event_trigger_touch(@x, @y+1)

    end

  end

  #--------------------------------------------------------------------------

  # * Move Left

  #     turn_enabled : a flag permits direction change on that spot

  #--------------------------------------------------------------------------

  def move_left(turn_enabled = true, override = false)

    # Turn left

    if turn_enabled

      turn_left

    end

    # If passable

    if passable?(@x, @y, 4) or override

      # Turn left

      turn_left

      # Update coordinates

      @x -= 1

      # Increase steps

      increase_steps

    # If impassable

    else

      # Determine if touch event is triggered

      check_event_trigger_touch(@x-1, @y)

    end

  end

  #--------------------------------------------------------------------------

  # * Move Right

  #     turn_enabled : a flag permits direction change on that spot

  #--------------------------------------------------------------------------

  def move_right(turn_enabled = true, override = false)

    # Turn right

    if turn_enabled

      turn_right

    end

    # If passable

    if passable?(@x, @y, 6) or override

      # Turn right

      turn_right

      # Update coordinates

      @x += 1

      # Increase steps

      increase_steps

    # If impassable

    else

      # Determine if touch event is triggered

      check_event_trigger_touch(@x+1, @y)

    end

  end

  #--------------------------------------------------------------------------

  # * Move up

  #     turn_enabled : a flag permits direction change on that spot

  #--------------------------------------------------------------------------

  def move_up(turn_enabled = true, override = false)

    # Turn up

    if turn_enabled

      turn_up

    end

    # If passable

    if passable?(@x, @y, 8) or override

      # Turn up

      turn_up

      # Update coordinates

      @y -= 1

      # Increase steps

      increase_steps

    # If impassable

    else

      # Determine if touch event is triggered

      check_event_trigger_touch(@x, @y-1)

    end

  end

  #--------------------------------------------------------------------------

  # * 1 Step Forward

  #--------------------------------------------------------------------------

  def move_forward(override=false)

    case @direction

    when 2

      move_down(false,override)

    when 4

      move_left(false,override)

    when 6

      move_right(false,override)

    when 8

      move_up(false,override)

    end

  end

end

 

class Game_Player

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Remember whether or not moving in local variables

    last_moving = moving?

    # If moving, event running, move route forcing, and message window

    # display are all not occurring

    unless moving? or $game_system.map_interpreter.running? or

           @move_route_forcing or $game_temp.message_window_showing

      # Move player in the direction the directional button is being pressed

      case Input.dir4

      when 2

        if $game_map.valid?(@x, @y+1)

          move_down

        elsif !$game_temp.map_transitioning

          @direction = 2

          $scene.begin_transfer

        end

      when 4

        if $game_map.valid?(@x-1, @y)

          move_left

        elsif !$game_temp.map_transitioning

          @direction = 4

          $scene.begin_transfer

        end

      when 6

        if $game_map.valid?(@x+1, @y)

          move_right

        elsif !$game_temp.map_transitioning

          @direction = 6

          $scene.begin_transfer

        end

      when 8

        if $game_map.valid?(@x, @y-1)

          move_up

        elsif !$game_temp.map_transitioning

          @direction = 8

          $scene.begin_transfer

        end

      end

    end

    # Remember coordinates in local variables

    last_real_x = @real_x

    last_real_y = @real_y

    super

    return if $game_temp.map_transitioning

    # If character moves down and is positioned lower than the center

    # of the screen

    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y

      # Scroll map down

      $game_map.scroll_down(@real_y - last_real_y)

    end

    # If character moves left and is positioned more let on-screen than

    # center

    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X

      # Scroll map left

      $game_map.scroll_left(last_real_x - @real_x)

    end

    # If character moves right and is positioned more right on-screen than

    # center

    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X

      # Scroll map right

      $game_map.scroll_right(@real_x - last_real_x)

    end

    # If character moves up and is positioned higher than the center

    # of the screen

    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y

      # Scroll map up

      $game_map.scroll_up(last_real_y - @real_y)

    end

    # If not moving

    unless moving?

      # If player was moving last time

      if last_moving

        # Event determinant is via touch of same position event

        result = check_event_trigger_here([1,2])

        # If event which started does not exist

        if result == false

          # Disregard if debug mode is ON and ctrl key was pressed

          unless $DEBUG and Input.press?(Input::CTRL)

            # Encounter countdown

            if @encounter_count > 0

              @encounter_count -= 1

            end

          end

        end

      end

      # If C button was pressed

      if Input.trigger?(Input::C)

        # Same position and front event determinant

        check_event_trigger_here([0])

        check_event_trigger_there([0,1,2])

      end

    end

  end

end

 

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

# ** Sprite_Character

#------------------------------------------------------------------------------

#  This sprite is used to display the character.It observes the Game_Character

#  class and automatically changes sprite conditions.

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

 

class Character_Sprite < RPG::Sprite

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :character                # character

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     viewport  : viewport

  #     character : character (Game_Character)

  #--------------------------------------------------------------------------

  def initialize(viewport, character = nil, section=0, temp=false)

    super(viewport)

    @character = character

    @section = section

    @temp = temp

    update

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    super

    # If tile ID, file name, or hue are different from current ones

    if @tile_id != @character.tile_id or

       @character_name != @character.character_name or

       @character_hue != @character.character_hue

      # Remember tile ID, file name, and hue

      @tile_id = @character.tile_id

      @character_name = @character.character_name

      @character_hue = @character.character_hue

      # If tile ID value is valid

      if @tile_id >= 384

        self.bitmap = RPG::Cache.tile($game_map.tileset_name,

          @tile_id, @character.character_hue)

        self.src_rect.set(0, 0, 32, 32)

        self.ox = 16

        self.oy = 32

      # If tile ID value is invalid

      else

        self.bitmap = RPG::Cache.character(@character.character_name,

          @character.character_hue)

        @cw = bitmap.width / 4

        @ch = bitmap.height / 4

        self.ox = @cw / 2

        self.oy = @ch

      end

    end

    # Set visible situation

    self.visible = (not @character.transparent)

    # If graphic is character

    if @tile_id == 0

      # Set rectangular transfer

      sx = @character.pattern * @cw

      sy = (@character.direction - 2) / 2 * @ch

      if @ch > 32

        ty = sy + @ch - ((@section + 1) * 32)

        if ty > sy

          @th = 32

        else

          @th = 32 + ty - sy

          ty = sy

        end

      else

        ty = sy

        @th = @ch

      end

      self.src_rect.set(sx, ty, @cw, @th)

      self.oy = @th

    end

    # Set sprite coordinates

    self.x = @character.screen_x(@temp)

    self.y = @character.screen_y(@temp) - (@section * 32)

    if $game_temp.map_transitioning

      self.z = @character.screen_z(@ch) + (@section * 32) + (1 - @section)

    else

      self.z = @character.screen_z(@ch) + (@section * 32)

    end

    # Set opacity level, blend method, and bush depth

    self.opacity = @character.opacity

    self.blend_type = @character.blend_type

    self.bush_depth = @section == 0 ? @character.bush_depth : 0

    # Animation

    if @character.animation_id != 0

      animation = $data_animations[@character.animation_id]

      animation(animation, true)

      @character.animation_id = 0

    end

  end

end

 

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

# ** Sprite_Character

#------------------------------------------------------------------------------

#  This sprite is used to display the character.It observes the Game_Character

#  class and automatically changes sprite conditions.

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

 

class Sprite_Character

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :character                # character

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     viewport  : viewport

  #     character : character (Game_Character)

  #--------------------------------------------------------------------------

  def initialize(viewport, character = nil, temp=false)

    bitmap = RPG::Cache.character(character.character_name, character.character_hue)

    @sprites = []

    for i in 0..(bitmap.height / 4 / 32)

      sprite = Character_Sprite.new(viewport, character, i, temp)

      @sprites << sprite

    end

    @viewport = viewport

    @character = character

    @temp = temp

  end

  #--------------------------------------------------------------------------

  # * Dispose

  #--------------------------------------------------------------------------

  def dispose

    for sprite in @sprites

      sprite.dispose

    end

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    for sprite in @sprites

      sprite.update

    end

  end

end

 

 

class Spriteset_Map

  alias original_dispose dispose

  alias original_update update

  #--------------------------------------------------------------------------

  # * Dispose

  #--------------------------------------------------------------------------

  def dispose

    if @new_panorama != nil

      # Dispose of panorama plane

      @new_panorama.dispose

      # Dispose of fog plane

      @new_fog.dispose

      # Dispose of character sprites

      for sprite in @new_character_sprites

        sprite.dispose

      end

    end

    original_dispose

  end

  #--------------------------------------------------------------------------

  # * Transition

  #--------------------------------------------------------------------------

  def transition_to(new_sprite_source)

    @new_sprite_source = new_sprite_source

    # Make tilemap

    # make_tilemap_sprites

    @tilemap.prepare_transition(@new_sprite_source, $game_player.direction, @viewport1)

    # Make panorama plane

    @new_panorama = Plane.new(@viewport1)

    @new_panorama.z = -1000

    # Make fog plane

    @new_fog = Plane.new(@viewport1)

    @new_fog.z = 3000

    # Make character sprites

    left_x = @new_sprite_source.display_x / 128

    top_y = @new_sprite_source.display_y / 128

    @new_character_sprites = []

    for i in @new_sprite_source.events.keys.sort

      if (left_x <= @new_sprite_source.events[i].x and @new_sprite_source.events[i].x < left_x + 20) and

         (top_y <= @new_sprite_source.events[i].y and @new_sprite_source.events[i].y < top_y + 15)

        sprite = Sprite_Character.new(@viewport1, @new_sprite_source.events[i], true)

        @new_character_sprites.push(sprite)

      end

    end

    # Frame update

    update

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Check for Transfer Data

    if @new_panorama != nil

      # If panorama is different from current one

      if @new_panorama_name != @new_sprite_source.panorama_name or

         @new_panorama_hue != @new_sprite_source.panorama_hue

        @new_panorama_name = @new_sprite_source.panorama_name

        @new_panorama_hue = @new_sprite_source.panorama_hue

        if @new_panorama.bitmap != nil

          @new_panorama.bitmap.dispose

          @new_panorama.bitmap = nil

        end

        if @new_panorama_name != ""

          @new_panorama.bitmap = RPG::Cache.panorama(@new_panorama_name, @new_panorama_hue)

        end

        Graphics.frame_reset

      end

      # If fog is different than current fog

      if @new_fog_name != @new_sprite_source.fog_name or 

         @new_fog_hue != @new_sprite_source.fog_hue

        @new_fog_name = @new_sprite_source.fog_name

        @new_fog_hue = @new_sprite_source.fog_hue

        if @new_fog.bitmap != nil

          @new_fog.bitmap.dispose

          @new_fog.bitmap = nil

        end

        if @new_fog_name != ""

          @new_fog.bitmap = RPG::Cache.fog(@new_fog_name, @new_fog_hue)

        end

        Graphics.frame_reset

      end

      # Update panorama plane

      @new_panorama.ox = @new_sprite_source.display_x / 8

      @new_panorama.oy = @new_sprite_source.display_y / 8

      # Update fog plane

      @new_fog.zoom_x = @new_sprite_source.fog_zoom / 100.0

      @new_fog.zoom_y = @new_sprite_source.fog_zoom / 100.0

      @new_fog.opacity = @new_sprite_source.fog_opacity

      @new_fog.blend_type = @new_sprite_source.fog_blend_type

      @new_fog.ox = @new_sprite_source.display_x / 4 + @new_sprite_source.fog_ox

      @new_fog.oy = @new_sprite_source.display_y / 4 + @new_sprite_source.fog_oy

      @new_fog.tone = @new_sprite_source.fog_tone

      # Update character sprites

      for sprite in @new_character_sprites

        sprite.update

      end

    end

    original_update

  end

end

 

 

class Scene_Map

  alias original_update update

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Loop

    loop do

      # Update map, interpreter, and player order

      # (this update order is important for when conditions are fulfilled 

      # to run any event, and the player isn't provided the opportunity to

      # move in an instant)

      $game_map.update

      if $game_temp.map_transitioning

        @transfer_map.update

      end

      $game_system.map_interpreter.update

      $game_player.update

      # Update system (timer), screen

      $game_system.update

      $game_screen.update

      # Abort loop if player isn't place moving

      unless $game_temp.player_transferring

        break

      end

      # Run place move

      transfer_player

      # Abort loop if transition processing

      if $game_temp.transition_processing

        break

      end

    end

    # Update sprite set

    @spriteset.update

    # Update message window

    @message_window.update

    # Check for Map Transition

    if $game_temp.map_transitioning

      unless $game_map.transitioning?

        finish_transfer

      end

      return

    end

    # If game over

    if $game_temp.gameover

      # Switch to game over screen

      $scene = Scene_Gameover.new

      return

    end

    # If returning to title screen

    if $game_temp.to_title

      # Change to title screen

      $scene = Scene_Title.new

      return

    end

    # If transition processing

    if $game_temp.transition_processing

      # Clear transition processing flag

      $game_temp.transition_processing = false

      # Execute transition

      if $game_temp.transition_name == ""

        Graphics.transition(20)

      else

        Graphics.transition(40, "Graphics/Transitions/" +

          $game_temp.transition_name)

      end

    end

    # If showing message window

    if $game_temp.message_window_showing

      return

    end

    # If encounter list isn't empty, and encounter count is 0

    if $game_player.encounter_count == 0 and $game_map.encounter_list != []

      # If event is running or encounter is not forbidden

      unless $game_system.map_interpreter.running? or

             $game_system.encounter_disabled

        # Confirm troop

        n = rand($game_map.encounter_list.size)

        troop_id = $game_map.encounter_list[n]

        # If troop is valid

        if $data_troops[troop_id] != nil

          # Set battle calling flag

          $game_temp.battle_calling = true

          $game_temp.battle_troop_id = troop_id

          $game_temp.battle_can_escape = true

          $game_temp.battle_can_lose = false

          $game_temp.battle_proc = nil

        end

      end

    end

    # If B button was pressed

    if Input.trigger?(Input::B)

      # If event is running, or menu is not forbidden

      unless $game_system.map_interpreter.running? or

             $game_system.menu_disabled

        # Set menu calling flag or beep flag

        $game_temp.menu_calling = true

        $game_temp.menu_beep = true

      end

    end

    # If debug mode is ON and F9 key was pressed

    if $DEBUG and Input.press?(Input::F9)

      # Set debug calling flag

      $game_temp.debug_calling = true

    end

    # If player is not moving

    unless $game_player.moving?

      # Run calling of each screen

      if $game_temp.battle_calling

        call_battle

      elsif $game_temp.shop_calling

        call_shop

      elsif $game_temp.name_calling

        call_name

      elsif $game_temp.menu_calling

        call_menu

      elsif $game_temp.save_calling

        call_save

      elsif $game_temp.debug_calling

        call_debug

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Player Place Move

  #--------------------------------------------------------------------------

  def begin_transfer

    # Set map transition flag

    $game_temp.map_transitioning = true

    # Discover map to transfer to

    new_map_id = $game_map.map_link[$game_player.direction/2]

    # Check for validity

    return if new_map_id == 0

    # Set Up next map

    @transfer_map = Game_Map.new

    @transfer_map.setup(new_map_id)

    @spriteset.transition_to(@transfer_map)

    case $game_player.direction

    when 2  # Moving Down

      @transfer_map.display_x = $game_map.display_x

      @transfer_map.display_y = -1920

      $game_temp.player_new_x = $game_player.x

      $game_temp.player_new_y = 0

    when 4  # Moving Left

      @transfer_map.display_x = 2560

      @transfer_map.display_y = $game_map.display_y

      $game_temp.player_new_x = @transfer_map.width - 1

      $game_temp.player_new_y = $game_player.y

    when 6  # Moving Right

      @transfer_map.display_x = -2560

      @transfer_map.display_y = $game_map.display_y

      $game_temp.player_new_x = 0

      $game_temp.player_new_y = $game_player.y

    when 8  # Moving Up

      @transfer_map.display_x = $game_map.display_x

      @transfer_map.display_y = 1920

      $game_temp.player_new_x = $game_player.x

      $game_temp.player_new_y = @transfer_map.height - 1

    end

    dist = [2,8].include?($game_player.direction) ? 1920 : 2560

    # Begin Transition

    $game_map.start_transition(10 - $game_player.direction, dist, 5)

    @transfer_map.start_transition(10 - $game_player.direction, dist, 5)

    # Move $game_player

    $game_player.move_speed = 1

    $game_player.move_forward(true)

  end

  #--------------------------------------------------------------------------

  # * Player Place Move

  #--------------------------------------------------------------------------

  def finish_transfer

    # Clear map transition flag

    $game_temp.map_transitioning = false

    # Reassign variables

    $game_map.setup(@transfer_map.map_id)

    @transfer_map = nil

    # Set up player position

    $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)

    # Update map (run parallel process event)

    $game_map.update

    # Transition Spriteset

    @spriteset.dispose

    @spriteset = Spriteset_Map.new

    # Run automatic change for BGM and BGS set on the map

    $game_map.autoplay

    # Frame reset

    Graphics.frame_reset

    # Update input information

    Input.update

    $game_player.move_speed = 4

  end

end

Instructions

1) Create a new Script just above main and paste the Tilemap Script
2) Create a new Script above main but below the Tilemap Script and paste the Zelda Scroll Script
3) On any map you'd like to use it on, create an Event an call it "Transfer". I usually like to put it in the upper left corner, but that isn't required.
4) In the Event, create a comment of "<direction>:<map id>" for each edge you would like to connect to the map.

In this case, <direction> is the direction the $game_player would be heading as he left the current map [Left, Right, Up, Down]
<map id> is the ID of the map you want to connect to.

Make sure there are no spaces.

5) Enjoy!

FAQ

I will add to this as questions arise

Compatibility

This script is NOT SDK compatible.

That said, it edits a large number of methods and classes, so I'm sure there will be some compatibility issues.

As a note, it completely rewrites the Sprite_Character class. In also rewrites the update method for Game_Map, Game_Player, and Scene_Map completely.

Credits and Thanks

SephirothSpawn for his Tilemap Class

Author's Notes

This is a rough, general version without alot of thrills or extras. That said, it works pretty well.

If you have any questions or comments, I'd love to hear them. However, I don't stop by this board that often, so I would recommend PMing me or emailing me if you have any pressing concerns. Otherwise, I will reply whenever I happen by.

Terms and Conditions

Feel free to use the scripts however you like, so long as credit is given to SephirothSpawn for the Tilemap Class and myself for the rest. However, please do not post this anywhere else without my permission. Thanks!
 
I've already seen this kind of script before. But you didn't copy, that's what matters.
Very useful script, mainly for Zelda lovers / projects. :)

Good work!

Code:
################################################################################

################################################################################

##########################  RTH Zelda Transfer  ##################################

################################################################################

################################################################################

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

# Criado por : Renan Tsuneo Hangai Junior

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

 

$RTHScript = {} if $RTHScript.nil?

$RTHScript["Zelda_Transfer"] = true

 

class Tile_Maps_Transfer

  

  # Velocidade de mudança dos mapas

  

  CHANGE_MAP_SPEED = 17

  

  # Definição dos autotiles

  

  AUTOLTILES = [

  26, 27, 32, 33, 4,  27, 32, 33, 26, 5,  32, 33, 4,  5,  32, 33,

  26, 27, 32, 11, 4,  27, 32, 11, 26, 5,  32, 11, 4,  5,  32, 11,

  26, 27, 10, 33, 4,  27, 10, 33, 26, 5,  10, 33, 4,  5,  10, 33,

  26, 27, 10, 11, 4,  27, 10, 11, 26, 5,  10, 11, 4,  5,  10, 11,

  24, 25, 30, 31, 24, 5,  30, 31, 24, 25, 30, 11, 24, 5,  30, 11,

  14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,

  28, 29, 34, 35, 28, 29, 10, 35, 4,  29, 34, 35, 4,  29, 10, 35,

  38, 39, 44, 45, 4,  39, 44, 45, 38, 5,  44, 45, 4,  5,  44, 45,

  24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,

  16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4,  41, 46, 47,

  36, 37, 42, 43, 36, 5,  42, 43, 12, 17, 18, 23, 12, 13, 42, 43,

  36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0,  1,  6,  7

  ]

 

  attr_reader :dif_x

  attr_reader :dif_y

  attr_reader :ready

  attr_reader :mapa

  

  def initialize(id, player, direction)

    @player = player

    @sprites = []

    @direction_transfer = direction

    @dif_x = (direction == 4 ? CHANGE_MAP_SPEED : direction == 6 ? -CHANGE_MAP_SPEED : 0)

    @dif_y = (direction == 2 ? -CHANGE_MAP_SPEED : direction == 8 ? CHANGE_MAP_SPEED : 0)

    @player_x_dif = $game_temp.player_pre_tel_x - $game_player.screen_x

    @player_y_dif = $game_temp.player_pre_tel_y - $game_player.screen_y

    @player_raise_rate_x = (@player_x_dif.abs.to_f / (640.0 / @dif_x.abs.to_f))

    @player_raise_rate_y = (@player_y_dif.abs.to_f / (480.0 / @dif_y.abs.to_f))

    if direction == 6

      @player_raise_rate_x *= -1

    elsif direction == 2

      @player_raise_rate_y *= -1

    end

    for i in 0..2

      @sprites[i] = Sprite.new

    end

    $bitmaps_maps = [] if $bitmaps_maps == nil

    @mapa = Game_Map.new

    @mapa.setup(id)

    @autotiles = []

    for i in 0..6

      @autotiles[i] = RPG::Cache.autotile(mapa.autotile_names[i])

    end

    if $bitmaps_maps[id] == nil

      $bitmaps_maps[id] = []

      for i in 0..2

        $bitmaps_maps[id][i] = Bitmap.new(mapa.width * 32, mapa.height * 32)

      end

      vx = [0, 1, 0, 1]

      vy = [0, 0, 1, 1]

      for i in 0...(mapa.width * mapa.height)

        x = i % mapa.width

        y = i / mapa.width

        for level in 0..2

          tile_id = mapa.data[x, y, level]

          if tile_id >= 384 

            tileset_bitmap = RPG::Cache.tile(mapa.tileset_name, tile_id, 0)

            src_rect = Rect.new(0, 0, 32, 32)

            $bitmaps_maps[id][level].blt(x * 32, y * 32, tileset_bitmap, src_rect)

          elsif tile_id >= 48 and tile_id < 384

            aid = tile_id / 48 - 1

            for j in 0..3

              h = 4 * (tile_id % 48) + j

              src_rect = Rect.new((AUTOLTILES[h] % 6) * 16, (AUTOLTILES[h] / 6 ) * 16, 16, 16)

              ax = x * 32 + vx[j] * 16

              ay = y * 32 + vy[j] * 16

              $bitmaps_maps[id][level].blt(ax, ay, @autotiles[aid], src_rect)

            end

          end 

        end

      end

    end

    for i in 0..2

      @sprites[i].bitmap = $bitmaps_maps[id][i].dup

    end

    @pos_x = (direction == 4 ? -@sprites[0].bitmap.width : direction == 6 ? 640 : -($game_map.display_x / 4))

    @pos_y = (direction == 2 ? 480 : direction == 8 ? -@sprites[0].bitmap.height : -($game_map.display_y / 4))

    fx = (player ? (direction == 4 ? -640 : direction == 6 ? 640 : 0) :0)

    fy = (player ? (direction == 2 ? 480 : direction == 8 ? -480 : 0) :0)

    view = Viewport.new(0, 0, 640, 480)

    view.z = 9999

    @fog = Plane.new(view)

    @fog.z = 9999

    @fog.bitmap = RPG::Cache.fog(@mapa.fog_name, @mapa.fog_hue)

    v2 = Viewport.new(0, 0, 640, 480)

    v2.z = -1000

    @panorama = Plane.new(v2)

    @panorama.bitmap = RPG::Cache.panorama(@mapa.panorama_name, @mapa.panorama_hue)

    @panorama.z = -1000000

    for i in 0..2

      @sprites[i].x = @pos_x

      @sprites[i].y = @pos_y

    end

    @character_sprites = []

    for i in mapa.events.keys.sort

      sprite = Sprite_Character.new(@viewport1, mapa.events[i])

      @character_sprites.push(sprite)

    end

    for sprite in @character_sprites

      sprite.update

      sprite.y += @pos_y

      sprite.x += (direction == 2 ? 0 : @pos_x)

    end

    if @player

      @train_actors_sprites = []

      if $RTHScript["Train Actor"]

        for i in 0...$train_actor.size

          sprite = Sprite_Character.new(@viewport1, $train_actor[i])

          sprite.x = $game_temp.train_actors_tel_x[i]

          sprite.y = $game_temp.train_actors_tel_y[i]

          @train_actors_sprites.push(sprite)

        end

      end

      @player_sprite = Sprite_Character.new(@viewport1, $game_player)

      @player_sprite.x = $game_temp.player_pre_tel_x

      @player_sprite.y = $game_temp.player_pre_tel_y

    end

    @ready = false

    update

  end

 

  def update

    @fog.ox -= @dif_x

    @fog.oy -= @dif_x

    for sprite in @sprites + @character_sprites

      sprite.x += @dif_x

      sprite.y += @dif_y

    end     

    if @player

      for sprite in @train_actors_sprites

        sprite.x += @player_raise_rate_x

        sprite.y += @player_raise_rate_y

      end

      @player_sprite.x += @player_raise_rate_x

      @player_sprite.y += @player_raise_rate_y

    end

    case @direction_transfer

    when 2

      @ready = (@sprites[0].y <= 0)

    when 4

      @ready = (@sprites[0].x >= (640 - @sprites[0].bitmap.width))

    when 6

      @ready = (@sprites[0].x <= 0)

    when 8

      @ready = (@sprites[0].y >= (480 - @sprites[0].bitmap.height))

    end

  end

  

  def dispose

    for sprite in @sprites + @character_sprites

      sprite.bitmap.dispose unless sprite.bitmap.nil?

      sprite.dispose

    end

    @fog.bitmap.dispose

    @fog.dispose

    @panorama.bitmap.dispose

    @panorama.dispose

    if @player

      for sprite in @train_actors_sprites

        sprite.bitmap.dispose unless sprite.bitmap.nil?

        sprite.dispose

      end

      @player_sprite.bitmap.dispose

      @player_sprite.dispose

    end

  end

  

end

 

class Game_Temp

  attr_accessor :zelda_transfer

  attr_accessor :zelda_transfer_direction

  attr_accessor :player_pre_tel_x

  attr_accessor :player_pre_tel_y

  attr_accessor :train_actors_tel_x

  attr_accessor :train_actors_tel_y

  @zelda_transfer

  @zelda_transfer_direction

  @player_pre_tel_x

  @player_pre_tel_y

  @train_actors_tel_x

  @train_actors_tel_y

end

 

class Interpreter

  

  alias rth_zelda_transfer_int_command_201 command_201

  def command_201

    if $game_temp.in_battle

      return true

    end

    if $game_temp.player_transferring or

       $game_temp.message_window_showing or

       $game_temp.transition_processing

      return false

    end

    item = @list[@index-1]

    if item != nil and item.code == 108

      if item.parameters[0].downcase =~ /zelda[ ]?transfer[ ]?(\d+)?/

        $game_temp.zelda_transfer_direction = $1.to_i

        $game_temp.zelda_transfer = true

      end

    end

    return rth_zelda_transfer_int_command_201

  end

  

end

    

class Spriteset_Map

  attr_reader :character_sprites

  attr_reader :tilemap

end

 

class Scene_Map

  

  alias rth_zelda_transfer_scene_map_transfer_player transfer_player

  def transfer_player

    $game_temp.zelda_transfer = false if $game_temp.zelda_transfer == nil

    if $game_temp.zelda_transfer == false

      rth_zelda_transfer_scene_map_transfer_player

      return

    end  

    $game_temp.zelda_transfer = false

    $game_temp.player_pre_tel_x = $game_player.screen_x

    $game_temp.player_pre_tel_y = $game_player.screen_y

    if $RTHScript["Train Actor"]

      $game_temp.train_actors_tel_x = []

      $game_temp.train_actors_tel_y = []

      for i in 0...$train_actor.size

        $game_temp.train_actors_tel_x[i] = $train_actor[i].screen_x

        $game_temp.train_actors_tel_y[i] = $train_actor[i].screen_y

      end

    end     

    $game_temp.player_pre_tel_x = $game_player.screen_x

    $game_temp.player_pre_tel_y = $game_player.screen_y

    now_id = $game_map.map_id

    # Limpar flag de teletransporte

    $game_temp.player_transferring = false

    # Se o destino for para outro mapa

    if $game_map.map_id != $game_temp.player_new_map_id

      # Definir o novo mapa

      $game_map.setup($game_temp.player_new_map_id)

    end

    # Definir o destino de Jogador

    $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)

    # Definir a direção

    case $game_temp.player_new_direction

    when 2  # Abaixo

      $game_player.turn_down

    when 4  # Esquerda

      $game_player.turn_left

    when 6  # Direita

      $game_player.turn_right

    when 8  # Acima

      $game_player.turn_up

    end

    # Alinhar a posição do Jogador

    $game_player.straighten

    # Atualizar mapa (executar eventos de Processo Paralelo)

    $game_map.update

    # Recriar o Spriteset

    tile_new_map = Tile_Maps_Transfer.new($game_temp.player_new_map_id, true, $game_temp.zelda_transfer_direction)

    Graphics.transition(1)

    loop {

      Graphics.update

      Input.update

      tile_new_map.update

      #@spriteset.tilemap.ox -= tile_new_map.dif_x

      #@spriteset.tilemap.oy -= tile_new_map.dif_y

      @spriteset.tilemap.viewport.rect.x += tile_new_map.dif_x

      @spriteset.tilemap.viewport.rect.y += tile_new_map.dif_y

      for sprite in @spriteset.character_sprites

        if sprite.character.is_a?(Game_Player)

          sprite.visible = false

        end

        if $RTHScript["Train Actor"] and sprite.character.is_a?(Train_Actor)

          sprite.visible = false

        end

        #sprite.x += tile_new_map.dif_x

        #sprite.y += tile_new_map.dif_y

      end

      break if tile_new_map.ready

    }

    tile_new_map.dispose

    @spriteset.dispose

    @spriteset = Spriteset_Map.new

    # Se estiver processando uma transição

    if $game_temp.transition_processing

      # Limpar flag de transição

      $game_temp.transition_processing = false

      # Executar transição

      Graphics.transition(20)

    end

    # Executar as definições do mapa como BGM e BGS

    $game_map.autoplay

    # Aqui os frames são resetados

    Graphics.frame_reset

    # Atualizar a entrada de informações

    Input.update

  end

 

end
 
I've seen a few of these as well... iirc, one of them was from Yeyinde, but that's really all I remember... can't really comment on the script itself, as my smartphone won't display more than the first 18 lines, but I'll try to remember to tomorrow.

That aside, I really prefer this kind of transition to the generic teleportation, so I think people without Zelda projects should take a look as well.
 

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