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.

HBGames

Maplinks
Version: 1.2.1

Introduction

My maplinks script allows you to effortlessly tile maps together to create regions without any transfer events. The underlying Object_Table class provides a powerful platform for this script. This script can handle any combination of maps you throw at it.

Features
  • Seamlessly tiles multiple maps together into a world map, dungeon, cave etc.
  • No need for any transfer events between linked maps
  • Can tile differently sized and shaped maps together
  • Map dimensions are not restricted to multiples of a number
  • Only transfers when you try to leave the map
  • Will not transfer if current location or destination is impassable in the direction you are travelling
  • You can create multiple maplinks planes using the tables? z-axis
  • Optional looping of maplinks planes in each direction
  • Dynamically, enable and disable maps as your adventure progresses
  • Disable access to maps from certain directions
  • Option to have player sprite leave map before transferring
  • Easy to setup tables
  • New Object_Table class
  • Thoroughly tested
  • No noticeable impact on frame rate

Screenshots

Picture a screen fading from one map to another...

Demo
Not available.

Instructions

  • Object Table script above main.
  • Install Maplinks script above main.
  • If not using the SDK; install the Interpreter Script Fix. It's included in the SDK.

To setup my maplinks script you need to edit its initialize method to reflect your project. For reference here's the demo's initialize.

Code:
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias_method :icarus_maplinks_initialize, :initialize
  def initialize
    # The Usual
    icarus_maplinks_initialize
    # Create size array for tables
    # You can create multiple maplinked planes using the tables? z-axis
    size = [4, 4, 1]
    # Create map layout table for maplinks
    @maps = Object_Table.new(*size)
    @maps[0,0,0], @maps[1,0,0], @maps[2,0,0], @maps[3,0,0] =  1,  2,  3,  4
    @maps[0,1,0], @maps[1,1,0], @maps[2,1,0], @maps[3,1,0] =  5,  6,  6,  7
    @maps[0,2,0], @maps[1,2,0], @maps[2,2,0], @maps[3,2,0] =  8,  6,  6,  9
    @maps[0,3,0], @maps[1,3,0], @maps[2,3,0], @maps[3,3,0] = 10, 10, 10, 10
    @maps.negative_read = false
    # Create map size arrays
    sm, long, large = [20, 15], [80, 15], [40, 30]
    # Define the size of each map
    @sizes = Object_Table.new(*size)
    @sizes[0,0,0], @sizes[1,0,0], @sizes[2,0,0], @sizes[3,0,0] = sm, sm, sm, sm
    @sizes[0,1,0], @sizes[1,1,0],                @sizes[3,1,0] = sm, large,  sm
    @sizes[0,2,0],                               @sizes[3,2,0] = sm,         sm 
    @sizes[0,3,0]                                              = long
    # Disable access to curtain maps by direction
    # Down = 1, Left = 2, Right = 4, Up = 8, All = 15
    # ie. Down + Right = 1 + 4 = 5
    @disabled = []
    # @disabled[map_id] = value
    @disabled[1] = 4
    # Enable looped maplinked planes by direction
    # Down = 1, Left = 2, Right = 4, Up = 8, All = 15
    # ie. Left + Right = 2 + 4 = 6
    @looped = []
    # @looped[plane z] = value
    @looped[0] = 15
    # Fade between maps
    @fade = true
    # Walk off map before transferring
    @leave_map = true
  end
Customize table size array. The size array's elements become the x, y, and z coordinate maximums of the tables. Therefore, xmax and ymax should be the gridded size of the largest regional plane. The zmax should be set to the total number of different maplinked regions.
Code:
    # Create size array for tables [xmax, ymax, zmax]
    # You can index multiple maplinks regions on the tables? z-axis
    size = [4, 4, 1]
Modify @maps table to reflect the map ids of your linked regions
Code:
    # Create map layout table for maplinks
    @maps = Object_Table.new(*size)
    @maps[0,0,0], @maps[1,0,0], @maps[2,0,0], @maps[3,0,0] =  1,  2,  3,  4
    @maps[0,1,0], @maps[1,1,0], @maps[2,1,0], @maps[3,1,0] =  5,  6,  6,  7
    @maps[0,2,0], @maps[1,2,0], @maps[2,2,0], @maps[3,2,0] =  8,  6,  6,  9
    @maps[0,3,0], @maps[1,3,0], @maps[2,3,0], @maps[3,3,0] = 10, 10, 10, 10
    @maps.negative_read = false
Record the size of each map in the @sizes table
Code:
    # Create map size arrays
    sm, long, large = [20, 15], [80, 15], [40, 30]
    # Define the size of each map
    @sizes = Object_Table.new(*size)
    @sizes[0,0,0], @sizes[1,0,0], @sizes[2,0,0], @sizes[3,0,0] = sm, sm, sm, sm
    @sizes[0,1,0], @sizes[1,1,0],                @sizes[3,1,0] = sm, large,  sm
    @sizes[0,2,0],                               @sizes[3,2,0] = sm,         sm 
    @sizes[0,3,0]                                              = long
Optional: Disable access to curtain areas in your region
Code:
    # Disable access to curtain maps by direction
    # Down = 1, Left = 2, Right = 4, Up = 8, All = 15
    # ie. Down + Right = 1 + 4 = 5
    @disabled = []
    # @disabled[map_id] = value
    @disabled[1] = 4
Optional: Loop curtain maplinked planes
Code:
    # Enable looped maplinked planes by direction
    # Down = 1, Left = 2, Right = 4, Up = 8, All = 15
    # ie. Left + Right = 2 + 4 = 6
    @looped = []
    # @looped[plane z] = value
    @looped[0] = 15
Optional: Change miscellaneous settings
Code:
    # Fade between maps
    @fade = true
    # Walk off map before transferring
    @leave_map = true

Compatibility

SDK compliant
Does not require the SDK
All edited methods are aliased with alias_method for compatibility and are automatically logged if the SDK is used
Aliases Game_Map(initialize, setup) and Game_Player(check_event_trigger_touch, update)

Credits and Thanks

Wachunga - Activating Maplinks when the player tries to leave the map; a feature of his Maplinks script.
G-man - Requesting the ability to have the player sprite leave the map before transferring.
Regimos - Major Bug Report (Save/Load Error)
Cheatking - Bug Report (Table Axis Error)
Busbuzz - Bug Report

Author's Notes

I've spent quite a while on this script so far and have already rewritten it twice. If you have any errors please post your edited initialize method and a screenshot of the error dialogue box.

Next Version: 1.3.0
Maps Folio V1.0.0 - Regional maps drawn up from maplinks data (world maps, dungeon maps etc.)

Current Version: 1.2.1 - October 25, 2007
Fixed map id 0 bug
Split Difference and Shift methods by x and y axis for faster processing
1.2.0 - October 23, 2007
Option to have looped regions where each edge of the region is connected to the opposite side
Option to have certain maps in a region partially disabled; with access on certain sides only
Completely rebuilt Object_Table class
Removed RGSS.Table

1.1.1 - October 3, 2007
Fixes save/load error in RGSS.Table and Object_Table

1.1.0 - September 22, 2007
Added option to have the player leave the map before transferring
Fixed and enhanced RGSS.Table and Object_Table
Replaced @disabled Object_Table with Array

1.0.1 - August 22, 2007
Changes @disabled table handling for multi-grid maps
Object_Table is now initialized with nil

1.0.0 - August 21, 2007
Original Release

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