################################################################################
# Zelda like Map-changing v.1.1 #
# by Tidloc #
#------------------------------------------------------------------------------#
# As Requested by Sasquatch927 on RMRK.net this script allows on a defined #
# Worldmap to teleport at the borders without events or parallel processes. #
# Predefined is a Worldmap of 10x10 maps, which means a total of 100 maps. #
# These maps should be the first 100 within all map-IDs or you have to change #
# zelda_maps after the for in the module. #
#------------------------------------------------------------------------------#
# Description of the modifiable constants: #
# Zelda_World_Width ..... Defines how many maps will be in X-direction #
# Zelda_World_Heigth .... Defines how many maps will be in Y-direction #
# zelda_map_width ....... Defines how broad the maps are #
# zelda_map_height ...... Defines how high the maps are #
# Zelda_2nd_World ....... Defines if a second world shall be used parallel #
# to the first one. The other constants will also #
# be used for this second world. #
# Pixel_Movement_Rate ... If you're using a pixel movement script you may #
# have to adjust this. 0 means no pixel movement #
# 1 means two moves per tile, 2 means four, 3 means #
# 8,... #
#==============================================================================#
# If you need to turn off temporarily the transportation at the edge of the #
# map you'll have toused the following command: #
# $game_temp.tidloc_zelda_trans = false #
# To turn it on again just write true instead of false and everything is #
# working again. #
#==============================================================================#
# You're free to use this script in any of your games, but please credit me #
# for this work. ^^ #
################################################################################
module Tidloc
Zelda_World_Width = 10
Zelda_World_Height = 10
zelda_map_width = 100
zelda_map_height = 100
Zelda_2nd_World = true
Pixel_Movement_Rate = 1
Zelda_World_MapMax = Zelda_World_Width * Zelda_World_Height
zelda_maps = []
for i in 0...Zelda_World_MapMax
zelda_maps.push i
end
Zelda_Maps = zelda_maps
Pixel_Movement = 2 ** Pixel_Movement_Rate
Zelda_Map_Width = zelda_map_width * Pixel_Movement
Zelda_Map_Height = zelda_map_height * Pixel_Movement
end
class Game_Temp
attr_accessor :tidloc_zelda_trans
alias _tidloc_zelda_init initialize
def initialize
_tidloc_zelda_init
self.tidloc_zelda_trans = true
end
end
class Scene_Map
alias wo_zelda_map_update update
def update
wo_zelda_map_update
map = $game_map.map_id
mapmax = Tidloc::Zelda_World_Width * Tidloc::Zelda_World_Height
if map < mapmax+1 && $game_temp.tidloc_zelda_trans
if $game_player.x == 0
if map % Tidloc::Zelda_World_Width == 1
$game_temp.player_new_map_id = map + Tidloc::Zelda_World_Width-1
else
$game_temp.player_new_map_id = map - 1
end
$game_temp.player_new_x = Tidloc::Zelda_Map_Height-2
$game_temp.player_new_y = $game_player.y
$game_temp.player_transferring = true
elsif $game_player.x == Tidloc::Zelda_Map_Width-1
if map % Tidloc::Zelda_World_Width == 0
$game_temp.player_new_map_id = map - (Tidloc::Zelda_World_Width-1)
else
$game_temp.player_new_map_id = map + 1
end
$game_temp.player_new_x = 1
$game_temp.player_new_y = $game_player.y
$game_temp.player_transferring = true
elsif $game_player.y == 0
if map <= Tidloc::Zelda_World_Width
$game_temp.player_new_map_id = map + mapmax - Tidloc::Zelda_World_Width
else
$game_temp.player_new_map_id = map - Tidloc::Zelda_World_Width
end
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = Tidloc::Zelda_Map_Height - 2
$game_temp.player_transferring = true
elsif $game_player.y == Tidloc::Zelda_Map_Height - 1
if map > mapmax - Tidloc::Zelda_World_Width
$game_temp.player_new_map_id = map - (mapmax - Tidloc::Zelda_World_Width)
else
$game_temp.player_new_map_id = map + Tidloc::Zelda_World_Width
end
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = 1
$game_temp.player_transferring = true
end
$game_temp.player_new_x *= Tidloc::Pixel_Movement
$game_temp.player_new_y *= Tidloc::Pixel_Movement
$game_temp.player_new_map_id = Tidloc::Zelda_Maps[$game_temp.player_new_map_id]
elsif Tidloc::Zelda_2nd_World && map < mapmax*2+1 && $game_temp.tidloc_zelda_trans
map -= mapmax
if $game_player.x == 0
if map % Tidloc::Zelda_World_Width == 1
$game_temp.player_new_map_id = map + Tidloc::Zelda_World_Width-1
else
$game_temp.player_new_map_id = map - 1
end
$game_temp.player_new_x = Tidloc::Zelda_Map_Height-2
$game_temp.player_new_y = $game_player.y
$game_temp.player_transferring = true
elsif $game_player.x == Tidloc::Zelda_Map_Width-1
if map % Tidloc::Zelda_World_Width == 0
$game_temp.player_new_map_id = map - (Tidloc::Zelda_World_Width-1)
else
$game_temp.player_new_map_id = map + 1
end
$game_temp.player_new_x = 1
$game_temp.player_new_y = $game_player.y
$game_temp.player_transferring = true
elsif $game_player.y == 0
if map <= Tidloc::Zelda_World_Width
$game_temp.player_new_map_id = map + mapmax - Tidloc::Zelda_World_Width
else
$game_temp.player_new_map_id = map - Tidloc::Zelda_World_Width
end
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = Tidloc::Zelda_Map_Height - 2
$game_temp.player_transferring = true
elsif $game_player.y == Tidloc::Zelda_Map_Height - 1
if map > mapmax - Tidloc::Zelda_World_Width
$game_temp.player_new_map_id = map - (mapmax - Tidloc::Zelda_World_Width)
else
$game_temp.player_new_map_id = map + Tidloc::Zelda_World_Width
end
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = 1
$game_temp.player_transferring = true
end
$game_temp.player_new_x *= Tidloc::Pixel_Movement
$game_temp.player_new_y *= Tidloc::Pixel_Movement
$game_temp.player_new_map_id = Tidloc::Zelda_Maps[$game_temp.player_new_map_id + mapmax]
end
end
end