I'm using Maplinks V1.0.1 and i keep getting this error(Found in attachments.)
Code:
#==============================================================================
# ** Maplinks
#------------------------------------------------------------------------------
# Icarus Featherfight
# Version: 1.0.1
# August 22, 2007
#==============================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :maplink # maplink active?
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :icarus_maplinks_initialize, :initialize
def initialize
@maplink = false
# The Usual
icarus_maplinks_initialize
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :maps # maps table for links
attr_accessor :sizes # size of each map
attr_accessor :disabled # maps currently off limits
attr_accessor :fade # fade between maps
attr_reader :grid # current location in maps table
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :icarus_maplinks_initialize, :initialize
def initialize
# The Usual
icarus_maplinks_initialize
# Create size array for tables
# You can create multiple maplinks planes using the tables? z-axis
size = [8, 1, 2]
# Create map layout table for maplinks
@maps = Table.new(size)
@maps[0,0,0], @maps[1,0,0], @maps[2,0,0], @maps[3,0,0], @maps[4,0,0], @maps[5,0,0], @maps[6,0,0], @maps[7,0,0] = 1, 2, 3, 4, 5, 6, 7, 8
@maps.negitive_read = false
# Create map size arrays
sm, long, large = [50, 50], [80, 15], [40, 30]
# Define the size of each map
@sizes = Object_Table.new(size)
@maps[0,0,0], @maps[1,0,0], @maps[2,0,0], @maps[3,0,0], @maps[4,0,0], @maps[5,0,0], @maps[6,0,0], @maps[7,0,0] = sm, sm, sm, sm, sm, sm, sm, sm
# Disable access to curtain areas (@disabled[x, y[, z]] = true)
@disabled = Object_Table.new(size)
@fade = true
end
#--------------------------------------------------------------------------
# * Setup
# map_id : map ID
#--------------------------------------------------------------------------
alias_method :icarus_maplinks_setup, :setup
def setup(map_id)
# The Usual
icarus_maplinks_setup(map_id)
# Get grid
@grid = @maps.coordinates(map_id)
end
#--------------------------------------------------------------------------
# * Maplink Setup
#--------------------------------------------------------------------------
def maplink(x, y)
# Abort if outside grid
return if @grid.nil?
# Determine durection and turn player
if y == height
dir = 2
$game_player.turn_down
elsif x == -1
dir = 4
$game_player.turn_left
elsif x == width
dir = 6
$game_player.turn_right
elsif y == -1
dir = 8
$game_player.turn_up
end
# Abort if it's impossable to leave your current location
return unless passable?($game_player.x, $game_player.y, dir, $game_player)
# Find new map id
key = @grid.dup
new_id = @map_id
until new_id != @map_id
case dir
when 2 then key[1] += 1
when 4 then key[0] -= 1
when 6 then key[0] += 1
when 8 then key[1] -= 1
end
new_id = @maps[key]
end
# Abort if outside grid
return if new_id.nil?
# Find new_grid
new_grid = @maps.coordinates(new_id)
# Set up new x and y values
case dir
when 2
new_x = x
new_y = 0
when 4
new_x = @sizes[new_grid][0] - 1
new_y = y
when 6
new_x = 0
new_y = y
when 8
new_x = x
new_y = @sizes[new_grid][1] - 1
end
# If new map takes up more than one grid space
if key != new_grid
# Realine new_grid if necessary and shift new x and y values
case dir
when 2
new_x += difference(new_grid)[0]
when 4
new_y += difference(new_grid)[1]
when 6
while @maps[new_grid[0] + 1, new_grid[1], new_grid[2]] == new_id
new_grid[0] += 1
end
new_y += difference(new_grid)[1]
when 8
while @maps[new_grid[0], new_grid[1] + 1, new_grid[2]] == new_id
new_grid[1] += 1
end
new_x += difference(new_grid)[0]
end
end
# Find final destination
case dir
when 2
loop do
if @sizes[new_grid].nil?
break if new_x < @sizes[@maps.coordinates(@maps[new_grid])][0]
new_x -= @sizes[@maps.coordinates(@maps[new_grid])][0]
else
break if new_x < @sizes[new_grid][0]
new_x -= @sizes[new_grid][0]
end
new_grid[0] += 1 until @maps[new_grid] != new_id
new_id = @maps[new_grid]
end
when 4
loop do
if @sizes[new_grid].nil?
break if new_y < @sizes[@maps.coordinates(@maps[new_grid])][1]
new_y -= @sizes[@maps.coordinates(@maps[new_grid])][1]
else
break if new_y < @sizes[new_grid][1]
new_y -= @sizes[new_grid][1]
end
new_grid[1] += 1 until @maps[new_grid] != new_id
new_id = @maps[new_grid]
new_x = @sizes[@maps.coordinates(new_id)][0] - 1
end
when 6
loop do
if @sizes[new_grid].nil?
break if new_y < @sizes[@maps.coordinates(@maps[new_grid])][1]
new_y -= @sizes[@maps.coordinates(@maps[new_grid])][1]
else
break if new_y < @sizes[new_grid][1]
new_y -= @sizes[new_grid][1]
end
new_grid[1] += 1 until @maps[new_grid] != new_id
new_id = @maps[new_grid]
end
when 8
loop do
if @sizes[new_grid].nil?
break if new_x < @sizes[@maps.coordinates(@maps[new_grid])][0]
new_x -= @sizes[@maps.coordinates(@maps[new_grid])][0]
else
break if new_x < @sizes[new_grid][0]
new_x -= @sizes[new_grid][0]
end
new_grid[0] += 1 until @maps[new_grid] != new_id
new_id = @maps[new_grid]
new_y = @sizes[@maps.coordinates(new_id)][1] - 1
end
end
# Abort if map is off limits or if outside grid
return if @disabled[@maps.coordinates(new_id)] or new_id.nil?
# Abort if destination is impassable
return unless transfer_passable?(new_id, new_x, new_y, dir)
# Set maplink flag
$game_temp.maplink = true
# Set player move destination
$game_temp.player_new_map_id = new_id
$game_temp.player_new_x = new_x
$game_temp.player_new_y = new_y
$game_temp.player_new_direction = dir
# Rescue errors caused by incorrect configuration of @sizes table
rescue NoMethodError
[EMAIL=$@]$@[/EMAIL][0][/:(\d*)/]
error = "Game_Map's @sizes table contains incorrect data\n"
error += "and/or linked maps don't line up\n\n"
error += "Original Error:\n"
error += "Script 'Maplinks' line #{$1}: #{$!.class} occurred.\n\n"
error += "#$!"
raise ArgumentError, error
end
#--------------------------------------------------------------------------
# * Maplink Transfer
#--------------------------------------------------------------------------
def transfer
# Clear maplink flag
$game_temp.maplink = false
# Set transferring player flag
$game_temp.player_transferring = true
# If fade is set
if @fade
# Prepare for transition
Graphics.freeze
# Set transition processing flag
$game_temp.transition_processing = true
$game_temp.transition_name = ""
end
end
#--------------------------------------------------------------------------
# * Transfer Passable
#--------------------------------------------------------------------------
def transfer_passable?(id, x, y, dir)
# Abort if check is the same
return false if id == @last_id and x == @last_x and y == @last_y
@last_id, @last_x, @last_y = id, x, y
# Store current info
map = @map
passages = @passages
priorities = @priorities
events = @events
# Load new maps data temporarily
# Load map from file and set @map
@map = load_data(sprintf("Data/Map%03d.rxdata", id))
# Set tile set information in opening instance variables
tileset = $data_tilesets[@map.tileset_id]
@passages = tileset.passages
@priorities = tileset.priorities
# Set map event data
@events = {}
for i in @map.events.keys
@events[i] = Game_Event.new(@map_id, @map.events[i])
end
# Determine if transfer passable
passable = passable?(x, y, 10 - dir)
# Reset variables
@map = map
@passages = passages
@priorities = priorities
@events = events
return passable
end
#--------------------------------------------------------------------------
# * Difference
#--------------------------------------------------------------------------
def difference(grid)
x = shift(@grid)[0] - shift(grid)[0]
y = shift(@grid)[1] - shift(grid)[1]
return [x, y]
end
#--------------------------------------------------------------------------
# * Shift
#--------------------------------------------------------------------------
def shift(grid)
skip = 0
shift = [0, 0]
# Find x shift
for i in 0...grid[0]
next if skip == @maps[i, @grid[1], @grid[2]]
if @sizes[i, @grid[1], @grid[2]].nil?
skip = @maps[i, @grid[1], @grid[2]]
shift[0] += @sizes[@maps.coordinates(skip)][0]
else
shift[0] += @sizes[i, @grid[1], @grid[2]][0]
end
end
# Find y shift
for i in 0...grid[1]
next if skip == @maps[@grid[0], i, @grid[2]]
if @sizes[@grid[0], i, @grid[2]].nil?
skip = @maps[@grid[0], i, @grid[2]]
shift[1] += @sizes[@maps.coordinates(skip)][1]
else
shift[1] += @sizes[@grid[0], i, @grid[2]][1]
end
end
return shift
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================
class Game_Player
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant
#--------------------------------------------------------------------------
alias_method :icarus_maplinks_cett, :check_event_trigger_touch
def check_event_trigger_touch(x, y)
$game_map.maplink(x,y) unless $game_map.valid?(x, y)
# The Usual
icarus_maplinks_cett(x,y)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias_method :icarus_maplinks_update, :update
def update
$game_map.transfer if $game_temp.maplink
# The Usual
icarus_maplinks_update
end
end