Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BenMakesGames/9eba058948e3190f38a4 to your computer and use it in GitHub Desktop.
Save BenMakesGames/9eba058948e3190f38a4 to your computer and use it in GitHub Desktop.
# by Ben Hendel-Doying
# Buy Me a Coffee? :D https://ko-fi.com/A0A12KQ16
#
# the following scripts are for RPG Maker VX Ace
#
# they allow for the automatic movement of the party between maps simply by walking
# to the edge, without the need to create ANY events on any map.
#
# BUT: it's required that all maps be only one screen in size. (it should be easy
# to remove this limitation, though I have not tried it.)
#
# think "Legend of Zelda" for the NES.
#
# a "note tag" must be added to each map, telling that map which maps to link to,
# in the north, east, south, and west directions. the note tag takes this form:
#
# <dir: NORTH EAST SOUTH WEST>
#
# where NORTH, EAST, SOUTH, and WEST should be replaced with the IDs of the maps
# to link to, or 0 if no automatic linking is desired. (leave out the note tag
# entirely for no automatic linking at all.)
#
# for example, here are the IDs and note tags of 6 hypothetical maps, arranged in
# a 3x2 grid:
#
# +----------------+----------------+----------------+
# | MAP ID 1 | MAP ID 2 | MAP ID 3 |
# | | | |
# | <dir: 0 2 4 0> | <dir: 0 3 5 1> | <dir: 0 0 6 2> |
# +----------------+----------------+----------------+
# | MAP ID 4 | MAP ID 5 | MAP ID 6 |
# | | | |
# | <dir: 1 5 0 0> | <dir: 2 6 0 4> | <dir: 3 0 0 5> |
# +----------------+----------------+----------------+
#
# these scripts assume you are happy with a window size of 640x360, and maps of
# 22x13. (this is also changeable, with a little math and some tweaks to the
# code.)
#
# to see it all in action, along with a full explanation of the code, check out
# my YouTube video at: https://youtu.be/Qj3wQSLuS3w
### RIGHTS/COPYRIGHT INFORMATION
# I, the author, release all rights to the following code, as is, to the public
# domain; no rights reserved; use it freely, without limitation, and at your own
# risk.
### FINALLY
# please check out my non-RPG Maker VX Ace game, "Mysterious Space"; available on
# Steam for $5 :) profits are donated to awesome causes, like space exploration.
### ON TO THE CODE: add the following in "Main", under "Main Process"
# SETS SCREEN SIZE TO 640x360 (16:9 widescreen resolution; half 720p... 360p?)
# the outer edge of tiles will be just off-screen (again, assuming 22x13 maps)
Graphics.resize_screen(640, 360)
### add the following to a new script, under "Materials"
# PREVENTS SCROLLING - ALL MAPS TAKE UP ONE SCREEN
# simply removing this whole "class" block should be enough to restore normal
# scrolling behavior. allowing maps of any size will require additional tweaks,
# however. (see below.)
class Game_Map
def set_display_pos(x, y)
@display_x = 1 # the left-most column of every map is hidden
@display_y = 1 - 0.125 # the top-most row of every map is hidden, except for a few pixels (due to the 640x360 resolution)
@parallax_x = 1
@parallax_y = 1 - 0.125
end
# override built-in scroll methods, making them empty (prevents scrolling)
def scroll_down(distance)
end
def scroll_left(distance)
end
def scroll_right(distance)
end
def scroll_up(distance)
end
end
# AUTOMATICALLY CAUSE MOVEMENT WHEN THE PLAYER MOVES TO THE EDGE OF A MAP
# assumes all maps are 22x13 tiles; if you want to change this, you'll need to edit
# the following code...
class Game_Player < Game_Character
def check_event_trigger_here(triggers)
# do original logic; leave this alone
start_map_event(@x, @y, triggers, false)
# do EXTRA logic
if(x == 0 && $game_map.west.to_i != 0)
$game_temp.fade_type = 2
$game_player.reserve_transfer($game_map.west.to_i, 20, y, 0) # 20 = map width - 2
elsif(x == 21 && $game_map.east.to_i != 0) # 21 = map width - 1 (0 is the 1st column, so 21 is the 22nd column)
$game_temp.fade_type = 2
$game_player.reserve_transfer($game_map.east.to_i, 1, y, 0) # 1 = 1
elsif(y == 0 && $game_map.north.to_i != 0)
$game_temp.fade_type = 2
$game_player.reserve_transfer($game_map.north.to_i, x, 11, 0) # 11 = map height - 2
elsif(y == 12 && $game_map.south.to_i != 0) # 12 = map width - 1 (0 is the 1st row, so 12 is the 13th row)
$game_temp.fade_type = 2
$game_player.reserve_transfer($game_map.south.to_i, x, 1, 0) # 1 = 1
end
end
end
# GET MAP IDS FROM NOTE TAG (there's probably no reason to change this)
class Game_Map
def north
load_notetag_coordinates
return @north
end
def east
load_notetag_coordinates
return @east
end
def south
load_notetag_coordinates
return @south
end
def west
load_notetag_coordinates
return @west
end
def load_notetag_coordinates
regex = /<dir:\s*([0-9]+)\s*([0-9]+)\s*([0-9]+)\s*([0-9]+)\s*>/i
result = @map.note.match(regex)
if result
@north = result[1]
@east = result[2]
@south = result[3]
@west = result[4]
else
@north = 0
@east = 0
@south = 0
@west = 0
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment