This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
Yes, that's right. Ever been annoyed by events stopping at the edge of your map, only to fade away? Why not make them go off the map instead? Why not make the player leave the map when teleporting, instead of the screen just fading?
What it does:
This lets events and players step over the edges (if you toggle the switch). Useful for birds flying, events walking away, player teleporting, etc. Get the demo and check it out.
This is a script that's pretty useless without a demo to show its practical uses, so that's why there is one. Of course, you can still get the script here and figure it out yourself.
The script
Code:
#===============================#
# EDGE WALKING
# By Jimme Reashu
# Version 1
# Last edit: October 21
# This header may not be removed
#===============================#
# Change these two numbers to adjust the edge-walking switches
PLAYER_EDGE = 5
EVENT_EDGE = 6
class Game_Character
alias jimmr_edgewalk_passable? passable?
def passable?(x,y,d)
unless (self.is_a?(Game_Event) && $game_switches[EVENT_EDGE] == true) or (self.is_a?(Game_Player) && $game_switches[PLAYER_EDGE] == true)
return jimmr_edgewalk_passable?(x,y,d)
else
$game_switches[EVENT_EDGE] = false if self.is_a?(Game_Event)
$game_switches[PLAYER_EDGE] = false if self.is_a?(Game_Player)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
unless $game_map.valid?(new_x, new_y) and $game_map.valid?(x, y)
return true
end
if @through
return true
end
unless $game_map.passable?(x, y, d, self)
return false
end
unless $game_map.passable?(new_x, new_y, 10 - d)
return false
end
for event in $game_map.events.values
if event.x == new_x and event.y == new_y
unless event.through
if self != $game_player
return false
end
if event.character_name != ""
return false
end
end
end
end
if $game_player.x == new_x and $game_player.y == new_y
unless $game_player.through
if @character_name != ""
return false
end
end
end
return true
end
end
end
class Game_Player < Game_Character
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
if $DEBUG and Input.press?(Input::CTRL) and $game_map.valid?(new_x, new_y)
return true
end
super
end
end
autoteleporting
Code:
JRFADE = true
# Set this to false to avoid the screen fading when teleporting
#Minor MODS
class Scene_Map
attr_accessor :spriteset
alias jimmr_auto_tele_transfer transfer_player
def transfer_player
$jredges = {}
jimmr_auto_tele_transfer
end
end
class Scene_Title
def initialize
$jredges = {}
end
end
# The edges are defined like this:
# Create an event on the map, autostart or par. proc.
# Make it run once, and execute the following:
# Simple version (Connecting maps have matching edges)
# Call Script:
# $jredges['right'] = [ID of map to teleport to when on the right edge]
# $jredges['left'] = [ID of map to teleport to when on the left edge]
# $jredges['top'] = [ID of map to teleport to when on the top edge]
# $jredges['bottom'] = [ID of map to teleport to when on the bottom edge]
# Advanced version (Connecting maps edges do not match)
# Call Script:
# $jredges['right'] = [[ID of the first map that the right edge connects to,
# the Y position that this edge starts on,
# the Y position that this edge ends on,
# the Y position that this edge starts on on the target map
# ],
# [Map ID 2, startY2, endY2, targetY2], [etc.]
# ]
# (Quite the same for the left edge)
#
# $jredges['right'] = [[ID of the first map that the right edge connects to,
# the X position that this edge starts on,
# the X position that this edge ends on,
# the X position that this edge starts on on the target map
# [Map ID 2, startX 2, endX2, targetX2], [etc.]
#
# (Quite the same for the bottom edge)
# Extra mode - For maps smaller than 15x20 (excess space on sides)
# Call Script:
# $jredges['size'] = [StartX, StartY, EndX, EndY]
#
# $jredges['right'] = [[ID of the first map that the right edge connects to,
# the Y position that this edge starts on,
# the Y position that this edge ends on,
# the Y position that this edge starts on on the target map,
# the X position that this edge starts on on the target map,
# the number of tiles this edge is],
# [Map ID 2, startY 2, endY2, goalY2, goalX2], [etc.]
# ]
# (Quite the same for the left edge)
#
# $jredges['top'] = [[ID of the first map that the right edge connects to,
# the X position that this edge starts on,
# the X position that this edge ends on,
# the X position that this edge starts on on the target map,
# the Y position that this edge starts on on the target map,
# the number of tiles this edge is],
# [Map ID 2, startX 2, endX2, goalX2, goalY2], [etc.]
#
# (Quite the same for the bottom edge)
# The simple version is demonstrated in maps 1-4
# The advanced on in maps 5-9
# The extra in maps 10-14
# A final word
# You can COMBINE all three types for the different edges. So even if one edge is messed up, you
# can still use the simple version in the rest.
class Game_Player < Game_Character
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
#================================
if $scene.is_a?(Scene_Map) and not ($jredges == nil or $jredges == {})
case d
when 2
edges = $jredges['bottom']
when 4
edges = $jredges['left']
when 6
edges = $jredges['right']
when 8
edges = $jredges['top']
end
if edges.is_a?(Integer)
case d
when 2
if new_y == $game_map.height
$game_temp.player_new_map_id = edges
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = 0
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 4
if new_x == (-1)
$game_temp.player_new_map_id = edges
map = load_data(sprintf("Data/Map%03d.rxdata", edges))
$game_temp.player_new_x = (map.width-1)
$game_temp.player_new_y = 0
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 6
if new_x == $game_map.width
$game_temp.player_new_map_id = edges
$game_temp.player_new_x = 0
$game_temp.player_new_y = $game_player.y
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 8
if new_y == (-1)
$game_temp.player_new_map_id = edges
map = load_data(sprintf("Data/Map%03d.rxdata", edges))
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = (map.height-1)
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
end
elsif edges.is_a?(Array)
if edges[0].size == 4 #Advanced
case d
when 2
if new_y == $game_map.height
target_x = nil
edges.each{|a|if a[1]<=new_x and a[2] >= new_x; target_x = (a[3] + new_x - a[1]); @mid = a[0];break;end}
$game_temp.player_new_map_id = @mid
$game_temp.player_new_x = target_x
$game_temp.player_new_y = 0
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 4
if new_x == (-1)
target_y = nil
edges.each{|a|if a[1]<=new_y and a[2] >= new_y; target_y = (a[3] + new_y - a[1]); @mid = a[0];break;end}
$game_temp.player_new_map_id = @mid
map = load_data(sprintf("Data/Map%03d.rxdata", @mid))
$game_temp.player_new_x = (map.width-1)
$game_temp.player_new_y = target_y
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 6
if new_x == $game_map.width
target_y = nil
edges.each{|a|if a[1]<=new_y and a[2] >= new_y; target_y = (a[3] + new_y - a[1]); @mid = a[0]; break; end}
$game_temp.player_new_map_id = @mid
$game_temp.player_new_x = 0
$game_temp.player_new_y = target_y
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 8
if new_y == (-1)
target_x = nil
edges.each{|a|if a[1]<=new_x and a[2] >= new_x; target_x = (a[3] + new_x - a[1]); @mid = a[0];break;end}
$game_temp.player_new_map_id = @mid
map = load_data(sprintf("Data/Map%03d.rxdata", @mid))
$game_temp.player_new_x = target_x
$game_temp.player_new_y = (map.height-1)
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
end
elsif edges[0].size == 5 #EXTRA
if $jredges['size'] == nil
$jredges['size'] = [0,0,$game_map.width-1,$game_map.height-1]
end
case d
when 2
if new_y == ($jredges['size'][3]+1)
target_x = nil
edges.each{|a|if a[1]<=new_x and a[2] >= new_x; target_x = (a[3] + new_x - a[1]); @mid = a[0]; @gy = a[4]; break;end}
$game_temp.player_new_map_id = @mid
$game_temp.player_new_x = target_x
$game_temp.player_new_y = @gy
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 4
if new_x == ($jredges['size'][0]-1)
target_x = nil
edges.each{|a|if a[1]<=new_y and a[2] >= new_y; target_y = (a[3] + new_y - a[1]); @mid = a[0]; @gx = a[4]; break;end}
$game_temp.player_new_map_id = @mid
$game_temp.player_new_x = @gx
$game_temp.player_new_y = target_y
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 6
if new_x == ($jredges['size'][2]+1)
target_x = nil
edges.each{|a|if a[1]<=new_y and a[2] >= new_y; target_y = (a[3] + new_y - a[1]); @mid = a[0]; @gx = a[4]; break;end}
$game_temp.player_new_map_id = @mid
$game_temp.player_new_x = @gx
$game_temp.player_new_y = target_y
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
when 8
if new_y == ($jredges['size'][1]-1)
target_x = nil
edges.each{|a|if a[1]<=new_x and a[2] >= new_x; target_x = (a[3] + new_x - a[1]); @mid = a[0]; @gy = a[4]; break;end}
$game_temp.player_new_map_id = @mid
$game_temp.player_new_x = target_x
$game_temp.player_new_y = @gy
$game_temp.player_transferring = true
@x = new_x
@y = new_y
end
end
end
end
if $game_temp.player_transferring == true
until ((@real_x == (@x*128)) && (@real_y == (@y*128)))
update_move
$game_map.update
$scene.spriteset.update
Graphics.update
end
Graphics.freeze
$game_temp.transition_processing = JRFADE
$game_temp.transition_name = ""
end
end
#================================
if $DEBUG and Input.press?(Input::CTRL) and $game_map.valid?(new_x, new_y)
return true
end
super
end
end
Now, turn switch #5 on to allow the player to walk over edges, and #6 for events. They are automatically reset afterwards, so don't worry...
You just need to copy and paste the script,, there's no setup required. However, you'll need to be able to handle events for it to work fully. If you get the demo, read the Readme! There are important changes to mapping if you're going to use the same events as I do in the demo!
Attached File Edge_Walking.rar ( 242.69k ) Number of downloads: 527
EDIT::
The autoteleport script has been added. It's somewhat hard to use in its more advanced forms, but the simple one is just that, simple.
On any map with autoteleporting, use this call script in an event:
If there is no map to the right/left/top/bottom, simply remove that line from the call script.
The MAP_ID is of course the ID of the map you want the player to teleport to when walking over the edge.
If your edges do not match, you'll have to use the more advanced options. More on that in the script itself.
A DEMO of this and an SDK version (for whatever reason) will be available eventually.
I've a demo of my own game to finish first ;)