iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
2 Pages V   1 2 >  
Reply to this topicStart new topic
> Map Edge Transfers (v 1.2b), Turn the whole edge of your map into a transfer event.
Mithran
post Dec 29 2009, 05:06 AM
Post #1


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Map Edge Transfers v 1.2b
by Mithran


Introduction
Setting up transfer events is an important part of creating your world. Using mapping techniques to funnel the edge of an area into one or two transfer events is one way. However, this can be a bit more time consuming if you are going for an open edge feel. This script gives a simple setup to turn the entire edge of the map into a transfer event.

Features
- specify a map id, coordiantes, and direction to transfer to for each edge of the map
- ability to specificy all edges at once (ie, as if 'leaving town', all edges transfer to the same coordinates)
- ability to link an event to the mapedge (to perform tests, eg., 'cannot leave town', or play a sound effect)
- now support coordinate offsets and multiple transfer tests per edge, for maps that are not exactly the same size
- works well with OriginalWij's Map Slide cool.gif

How to Use
Install on its own script page in the materials section of the script editor above main and below default scripts. Goes below OriginalWij's Map Slide, if used.

Script
Spoiler:
CODE
# Mapedge Transfers
# v 1.2b
# By Mithran
# Turns the entire edge of the map into a transfer event.
# Install: Insert in the materials section above main.

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Changelog:

# v 1.2b
  # Added offsets and coordinate range support for auto-setup
  # (v.b) Added compact syntax for offset / range
  
# v 1.1
  # Added passability test for destination map for auto setup
  # (v.b) Added passability test tolerance option
  
# v 1.0
  # Initial Script.  Easily turn the edge of the map into a transfer event.

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Usage: Simply set up an autorun event.  The end of the event should have Erase Event.
# This will make it run once every time you enter the map.
# Once set, the character can change maps simply by walking into the edge of the
# map. (Eg., if you are at the rightmost tile and press right, you will be transferred
# to the next map.)
# If you use the LAST_TILE_TRANSFER setting below, the tile closest to the edge
# of the map will also trigger a transfer when you step on it.

# In the event, use one or more of the following Advanced > Script Commands

# mapedge_all(map_id, x, y, dir)
# mapedge_n(map_id, x, y, dir, offset, range)
# mapedge_s(map_id, x, y, dir, offset, range)
# mapedge_e(map_id, x, y, dir, offset, range)
# mapedge_w(map_id, x, y, dir, offset, range)
# mapedge_event(event_id = 0)

# * NEW * Compact syntax for autosetup:
# mapedge_qn(map_id, offset, range)
# mapedge_qs(map_id, offset, range)
# mapedge_qe(map_id, offset, range)
# mapedge_qw(map_id, offset, range)
# * Offset and range are still optional.  x, y, and direction are assumed as -1

# using mapedge_all will set all directions at the same time.  This is useful
# for towns where you want all edges to exit to the same coordinate on the map
# The other options will set the mapedge for their direction, eg. mapedge_n
# sets the transfer cooridnates for the north edge.
# The latest settings for any given direction are the ones that are used.
  
# map_id is replaced by the map you are transferring to
  # use :clear as the map_id to clear the settings for that direction
  # example: mapedge_n(:clear) will erase the transfer event from the north map edge
  # using a map_id of nil will prevent transfer to those areas, but may be used
  # with a specific range, eg.
  # mapedge_n(nil, -1, -1, -1, 0, 5..20)
  # OR
  # mapedge_qn(nil, 0, 5..20)
  # would prevent a transfer on tiles 5 through 20 on the north edge of the map

# * NOTE *
  # If you use any of the arguments following map_id, all arguments prior to them
  # on the list MUST be present.
  # eg., if you want to specify a direction, you must include x and y first

# x is optional.  The x coordinate where you want to go on the new map.
  # Setting this to -1 is 'auto setup'.  Depending on the direction you are going
  # x will be adjusted to the logical coordiante in the next map (eg., if you are
  # going left, you will be placed on the rightmost edge of the next map)

# y is optional.  The y coordinate where you want to go on the new map.
  # Setting this to -1 is 'auto setup'.  Depending on the direction you are going
  # y will be adjusted to the logical coordiante in the next map (eg., if you are
  # going up, you will be placed on the southmost edge of the next map)
  
# dir is optional.  if ommited, or -1, direction is not changed
  # 2 = face down
  # 4 = face left
  # 6 = face right
  # 8 = face up
    
# offset it optional (default is 0)
  # this is the amount of offset to give the desired destination coordinate of the
  # adjoining map.  Negative numbers subtract, positive numbers add
  # example:
  # mapedge_e(3, -1, -1, -1, 5)
  # OR
  # mapedge_qe(3, 5)
  # turns the entire right edge of the map into a transfer to map 3
  # however, the 'y' coordinate of the transfer on map 3 will be 5 more than the
  # source coordinate on the current map

# range is optional.  
  # This is a range of tiles along the edge of the map.  It is only used in autosetup
  # range is expressed as n..m where n is the begginning coordiante and m is the ending
  # coordiantes start at the upper left corner of the map and count down or right
  # eg.,
  # mapedge_n(2, -1, -1, -1, 0, 0..15)
  # OR
  # mapedge_qn(2, 0, 0..15)
  # would make a transfer for the north edge of the map for only x coordinates 0..15
  # you may add a second mapedge_n(3, -1, -1, -1, 0, 16..30) to have it transfer to map 3
  # for the remaining tiles
  # if a range is nil or not supplied, the entire mapedge is assumed.

# mapedge_event sets up an event to be run every time the edge is touched.
# Using mapedge_event(0) will remove the map edge event.
# If a transfer is performed, the player is moved, or the scene is changed, the
# normal mapedge transfer is broken.  You can use this to prevent a character from
# leaving a map.  If not, the transfer will continue, so you can safely play a SE.  

# Notes:
# You can change the transfer coordiantes in an event after the map has loaded.

# Compatability:
# Not likely to work with pixel movement systems.  Works with OriginalWij's Map Slide.

module Mapedge
  LAST_TILE_TRANSFER = true
  # If set to true, the last tile on each respective edge of the map will trigger
  # the automatic transfer.
  PASS_TEST_TOLERANCE = 0 # the number of tiles to test for passability in either
  # direction (autosetup) of the next map before deeming the transfer invalid
end


class Game_Player
  alias check_event_trigger_touch_mith_mapedge check_event_trigger_touch
  def check_event_trigger_touch(x, y)
    return true if check_event_trigger_touch_mith_mapedge(x, y)
    check_mapedge_transfer_abs(x,y)
  end
  
  def check_mapedge_transfer_abs(x,y)
    # cut short if eventing, showing message, or transferring
    return if $game_map.interpreter.running? || $game_message.visible || self.transfer?
    # cut short if tile is a valid walkable tile
    return if $game_map.valid?(x,y)
    do_mapedge_transfer
  end
  
  alias check_touch_event_mapedge check_touch_event
  def check_touch_event
    notrans = (defined?($game_temp.no_trigger) && $game_temp.no_trigger)
    # above - checking if OriginalWij's map slide is being used, if so, ignore last
    # tile transfer when transferring in
    return if check_touch_event_mapedge # if there is an event here, use this instead
    return if notrans
    return unless Mapedge::LAST_TILE_TRANSFER
    return mapedge_transfer_last(self.x, self.y)
  end
  
  def mapedge_transfer_last(x,y)
    # cut short if eventing, showing message, or transferring
    return if $game_map.interpreter.running? || $game_message.visible || self.transfer?
    check_mapedge_transfer_abs($game_map.x_with_direction(x, @direction), $game_map.y_with_direction(y, @direction))
  end
  
  def do_mapedge_transfer
    x = self.x
    y = self.y
    access = case @direction
    when 2;  "s" # walking down, go south
    when 4;  "w" # walking left, go west
    when 6;  "e" # walking right, go east
    when 8;  "n" # walking up, go north
    else; nil
    end
    return if access.nil?
    data = $game_map.mapedge_data[access]
    return if data.nil? # no data for this direction
    test = false
    for ary in data.reverse
      map_id, goto_x, goto_y, dir, offset, rng = *ary[0..5]
      next unless case @direction
      when 2, 8; rng.nil? || rng.empty? ? true : rng.find {|r| r === x}
      when 4, 6; rng.nil? || rng.empty? ? true : rng.find {|r| r === y}
      else false; end
      return false if map_id.nil?
      break test = true
    end
    return unless test
    new_map = Game_Map.new
    new_map.setup(map_id)
    # if you get an error on the above line, your map does not exist or is corrupted
    test_pass_x = test_pass_y = false
    if goto_x == -1
      goto_x = case @direction
      when 2, 8; self.x + offset # north and south, modify by offset
      when 4; new_map.width - 1 # west, maximum x coordinate
      when 6; 0 # east, 0 x coordinate
      else nil # not valid/supported direction
      end
      test_pass_x = true if [2,8].include?(@direction)
    end
    return if goto_x.nil?
    if goto_y == -1
      goto_y = case @direction
      when 4, 6; self.y + offset # east and west, modify by offset
      when 8; new_map.height - 1 # north, y is maximum
      when 2; 0 # south, 0 y coordinate
      else nil # not valid/supported direction
      end
      test_pass_y = true if [4,6].include?(@direction)
    end
    return if goto_y.nil?
    goto_x = mapedge_pass_test_x(goto_x, goto_y, new_map) if test_pass_x
    goto_y = mapedge_pass_test_y(goto_x, goto_y, new_map) if test_pass_y
    if dir == -1
      dir = @direction
    end
    return if dir.nil?
    gm_real = $game_map
    $game_map = new_map
    test_pass = $game_player.passable?(goto_x, goto_y)
    $game_map = gm_real
    return unless test_pass # if target tile passabiltiy fails
    event_id = $game_map.mapedge_data['event']
    if event_id.is_a?(Integer) && event_id > 0
      return true if event_loop_local(event_id)
    end
    self.reserve_transfer(map_id, goto_x, goto_y, dir)
    return true
  end
  
  def mapedge_pass_test_x(test_x, test_y, new_map)
    gm_real = $game_map
    $game_map = new_map
    i = 0
    result = while i <= Mapedge::PASS_TEST_TOLERANCE
      n = test_x + i
      m = test_x - i
      break n if $game_player.passable?(n, test_y)
      break m if $game_player.passable?(m, test_y)
      i += 1
    end
    $game_map = gm_real
    return result || test_x
  end
  
  def mapedge_pass_test_y(test_x, test_y, new_map)
    gm_real = $game_map
    $game_map = new_map
    i = 0
    result = while i <= Mapedge::PASS_TEST_TOLERANCE
      n = test_y + i
      m = test_y - i
      break n if $game_player.passable?(test_x, n)
      break m if $game_player.passable?(test_x, m)
      i += 1
    end
    $game_map = gm_real
    return result || test_y
  end
  
  def event_loop_local(event_id)
    coords = [$game_player.x, $game_player.y]
    common_event = $data_common_events[event_id]
    $game_map.interpreter.setup(common_event.list)
    loop do
      $game_map.interpreter.update
      return true if $game_player.transfer?
      # if a transfer was setup
      return true if $game_temp.next_scene != nil
      # if the scene was changed
      return true if coords != [$game_player.x, $game_player.y]
      # if the player moved
      return false unless $game_map.interpreter.running?
      # if event completed without moving
      $scene.update_basic
    end
  end

end

class Game_Interpreter
  ['n','s','e','w'].each { |dir|
  aStr = %Q(
  def mapedge_#{dir}(map_id, x = -1, y = -1, direction = -1, offset = 0, *range)
    if map_id == :clear
      $game_map.mapedge_data["#{dir}"] = []
      return
    end
    if range.compact.empty?
      $game_map.mapedge_data["#{dir}"] = [[map_id, x, y, direction, offset, range.compact]]
    else
      data = [map_id, x, y, direction, offset, range.compact]
      $game_map.mapedge_data["#{dir}"].push(data)
    end
  end
  
  def mapedge_q#{dir}(map_id, offset = 0, *range)
    mapedge_#{dir}(map_id, -1, -1, -1, offset, *range)
  end
  
  )
  module_eval(aStr)
  }
  
  def mapedge_all(map_id, x = -1, y = -1, direction = -1, offset = 0)
    ['n','s','e','w'].each { |dir|
      if map_id == :clear
        $game_map.mapedge_data[dir] = []
      else
        $game_map.mapedge_data[dir] = [[map_id, x, y, direction, offset, [] ]]        
      end
    }
  end
  
  def mapedge_event(event_id = 0)
    $game_map.mapedge_data['event'] = event_id
  end
  
end

class Game_Map

  def mapedge_data
    @mapedge_data ||= Hash['n', [], 's', [], 'e', [], 'w', []]
  end
    
  alias setup_mapedge setup
  def setup(*args)
    setup_mapedge(*args)
    @mapedge_data = Hash['n', [], 's', [], 'e', [], 'w', []]
  end
  
end


Demo
Purple Olrac put together a short demo for this script:
http://www.l-o-l-s.eu/Demo%20Mapedge.rar

FAQ
Q: How do you use an event to cancel a transfer?
A: Use a force move route on the player to move back one square. If the player moves, the transfer will be cancelled.

Q: The player is walking along the map edge and not transferring.
A: You must approach the map edge to initiate a transfer, even if using the LAST_TILE_TRANSFER option. Walking parallel to the map edge will not initiate the transfer.

Q: One of my map edges wont transfer / part of the edge wont transfer using auto setup.
A: These settings are mainly for maps of the same size. They use relative coordiantes based on how far you were from the upper left edge, so if you are transferring from a bigger map to a smaller one on the lower or right edges of the map, which would land you outside of the next map, the transfer will not perform. - EDIT: Updated to have an option for tolerance in either direction when using auto setup.
A: There are now advanced options available for setting an offset cooridnate for the new map using an auto setup. Try adjusting the range of your transfer, or your offset.

Credit and Thanks
- Mithran
- additional feature requests by ShadowXzygon, rugear1277

Author's Notes
Feedback is welcome. Please do not redistribute without asking.


--------------------
Go to the top of the page
 
+Quote Post
   
ShadowXzygon
post Dec 29 2009, 05:28 AM
Post #2


The Interloper
Group Icon


Type: Writer
Alignment: Chaotic Evil




This script works great. Except for one thing.
My maps aren't all the same size.
So when I did the map transfer thing using this script,
it went to an impassible tile.
The only thing I specified was the map ID of the teleport.
So what I'm asking is that could you make the script transfer the player to the next and closest passable tile?
(Yeah, I know you can change transfer coordinates. But it'd be harder if there was multiple entrances to a map on one side.)

This post has been edited by ShadowXzygon: Dec 29 2009, 05:47 AM


--------------------


QUOTE
"You die a lot. That's not healthy."


QUOTE
Real life contains glitches, what the %&$@?
Go to the top of the page
 
+Quote Post
   
Mithran
post Dec 29 2009, 06:43 AM
Post #3


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Updated to include an option to test the edge of the adjacent map given impassability of the desired autosetup tile. The option is in the setup section. It will test this number of tiles, one at a time, first down then up (for east/west transfers) or first right then left (for north/south transfers) until a passable tile is found to drop the player on. If one is not found, no transfer is performed. This is for autosetup only. Thanks for the suggestion, ShadowXzygon.


--------------------
Go to the top of the page
 
+Quote Post
   
ShadowXzygon
post Dec 29 2009, 07:07 AM
Post #4


The Interloper
Group Icon


Type: Writer
Alignment: Chaotic Evil




no problem, glad to help out. (Especially since I'll be using this script happy.gif )


--------------------


QUOTE
"You die a lot. That's not healthy."


QUOTE
Real life contains glitches, what the %&$@?
Go to the top of the page
 
+Quote Post
   
Shanghai
post Dec 29 2009, 01:38 PM
Post #5



Group Icon


Type: Undisclosed




I can't help but to feel this was made to go along with Map Sliding. Good job, Mithran!


--------------------
Go to the top of the page
 
+Quote Post
   
ShadowXzygon
post Dec 29 2009, 11:53 PM
Post #6


The Interloper
Group Icon


Type: Writer
Alignment: Chaotic Evil




I have another suggestion. Can it check for events as well? And if the event is Same As Characters, it'll just do the same thing as if it was an impassible tile?


--------------------


QUOTE
"You die a lot. That's not healthy."


QUOTE
Real life contains glitches, what the %&$@?
Go to the top of the page
 
+Quote Post
   
Mithran
post Dec 30 2009, 12:02 AM
Post #7


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (Shanghai @ Dec 29 2009, 05:38 AM) *
I can't help but to feel this was made to go along with Map Sliding. Good job, Mithran!


Thanks, and yes, I did have that in mind. I made sure that they work together.

QUOTE (ShadowXzygon @ Dec 29 2009, 03:53 PM) *
I have another suggestion. Can it check for events as well? And if the event is Same As Characters, it'll just do the same thing as if it was an impassible tile?


It should already do that with the last update. I tested it in my project and thats how it works (if the event is impassable, it is counted as an impassable tile).


--------------------
Go to the top of the page
 
+Quote Post
   
ShadowXzygon
post Dec 30 2009, 12:51 AM
Post #8


The Interloper
Group Icon


Type: Writer
Alignment: Chaotic Evil




Oh, okay then. Just wanted to make sure, cuz I tried it with an event that had "Same as Character", no graphic, and it transferred the player onto the event.
Probably just a mistake on my side.


--------------------


QUOTE
"You die a lot. That's not healthy."


QUOTE
Real life contains glitches, what the %&$@?
Go to the top of the page
 
+Quote Post
   
munkis
post Jan 22 2010, 04:00 AM
Post #9


And the dead shall rise...
Group Icon


Type: Writer
Alignment: Chaotic Good




If a particular transfer event needs other things to be done before or after the player is actually transferred (map name pop-ups, day/night settings, etc.), can those things be set up normally? Also, can standard transfer event commands be used when appropriate?


--------------------
Support bars:
Spoiler:


Spoiler:

Don't be like me, learn to program the right way!
Go to the top of the page
 
+Quote Post
   
RuGeaR1277
post Jan 22 2010, 05:22 AM
Post #10



Group Icon


Type: Undisclosed




hmm... i like it, but i kinda don't get it... =\
what would i put in each event command for each maps like this?

OOOOOOOOO
OOOOOOOOO
OOOOOOOOO
OOOOOOOOOVVVV
OOOOOOOOOVVVV
>>>>>QQQQVVVV
>>>>>QQQQVVVV
>>>>>QQQQ

something like that... assuming that there are four maps, each letter/sysmbol represent 5 tiles
Map 1 (O) = 45 x 25
Map 2 (>) = 25 x 15
Map 3 (Q) = 20 x 15
Map 4 (V) = 20 x 20

so, what do i put into the auto-run event (plus erase) for each map?
Go to the top of the page
 
+Quote Post
   
Mithran
post Jan 22 2010, 06:33 AM
Post #11


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




@munkis - Yes, you can do just about anything you need to in the mapedge event and the transfer will still go through, just as long as the player is not moved, transferred (in the event), or the scene is changed in that specific event. Putting an map event in a tile along the map's edge also make that event run first, ignoring the map edge transfer for that step if it activates.

@RuGeaR1277 - I haven't added offsets yet, and currently its one map transfer per direction. I'll see if I can do this in a way where the setup is not prohibitably complicated.


--------------------
Go to the top of the page
 
+Quote Post
   
nigromante
post Jan 22 2010, 07:08 AM
Post #12


Evil Regular
Group Icon


Type: Undisclosed
Alignment: Chaotic Neutral




Hmm...Couldn't you just make a parallel process that checks your coordinates and warps if you're in certain X or certain Y position? I'm just guessing though, I mean it could even store your coords to see where you warp in the next map.
Go to the top of the page
 
+Quote Post
   
RuGeaR1277
post Jan 22 2010, 07:56 AM
Post #13



Group Icon


Type: Undisclosed




QUOTE (Mithran @ Jan 22 2010, 02:33 PM) *
@RuGeaR1277 - I haven't added offsets yet, and currently its one map transfer per direction. I'll see if I can do this in a way where the setup is not prohibitably complicated.


okay.. thanks, mithran! most of my maps are like that..

QUOTE (nigromante @ Jan 22 2010, 03:08 PM) *
Hmm...Couldn't you just make a parallel process that checks your coordinates and warps if you're in certain X or certain Y position? I'm just guessing though, I mean it could even store your coords to see where you warp in the next map.


sounds good, but with long parallel processes, won't it lag much? =\ just wondering...

-rain46
Go to the top of the page
 
+Quote Post
   
Mithran
post Jan 22 2010, 09:18 AM
Post #14


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




@nigromante - Yep, you can do that with a parallel process. Most of this can be evented, in fact. You cannot, however, check the passability of a tile (especially a tile on the next map) through pure eventing, and values such as the map's width and height would need to be set manually for each map or retrieved throught a script command. This system also gives a clear precedence to map events, allowing them to exeucte if they are present instead of transferring. The main point, though, is that this is easy to set up.


--------------------
Go to the top of the page
 
+Quote Post
   
Mithran
post Jan 26 2010, 06:28 AM
Post #15


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Update

v 1.2b
  • Added support for coordinate offsets. The logical destination coordinate of an autosetup transfer will be offset by this much, making it possible to put together adjacent maps of varying sizes.
  • Added support for multiple transfer per edge. Set up a range of tiles along the edge where each transfer can take place (default is the whole edge, so no extra setup is necessary if you dont use this feature)
  • Added an easy command to clear the entire transfer from an edge.
  • v.b Added a more compact syntax for using range/offset.

Previous Changes:
Spoiler:

v 1.1b
  • Added destination tile passability test. If the destination tile is not passable, you cannot transfer.
  • v.b Added passability test tolerance option for autosetup. This will test adjacent tiles in either direction before deeming the transfer not possible.


--------------------
Go to the top of the page
 
+Quote Post
   
RuGeaR1277
post Jan 26 2010, 09:36 AM
Post #16



Group Icon


Type: Undisclosed




copy and paste what i'm gonna ask...

QUOTE (RuGeaR1277 @ Jan 22 2010, 01:22 PM) *
hmm... i like it, but i kinda don't get it... =\
what would i put in each event command for each maps like this?

OOOOOOOOO
OOOOOOOOO
OOOOOOOOO
OOOOOOOOOVVVV
OOOOOOOOOVVVV
>>>>>QQQQVVVV
>>>>>QQQQVVVV
>>>>>QQQQ

something like that... assuming that there are four maps, each letter/sysmbol represent 5 tiles
Map 1 (O) = 45 x 25
Map 2 (>) = 25 x 15
Map 3 (Q) = 20 x 15
Map 4 (V) = 20 x 20

so, what do i put into the auto-run event (plus erase) for each map?


additional note:
i LOVE it, but i still dont get it... =\
maybe answering this example, i can figure it out better... =D
thanks in advanced!

-rain46
Go to the top of the page
 
+Quote Post
   
Mithran
post Jan 26 2010, 11:13 AM
Post #17


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




EDIT:
Spoiler:
I've updated the script, again, but the below is an explantion of how to do it in v 1.2. Everything will still work in v 1.2b, the syntax for 1.2b just looks a bit better and is quicker to write.

If you add a q in front of whatever edge you are changing, you don't need the three -1s anymore, they are implied:

eg.,
CODE
mapedge_w(1, -1, -1, -1, 15, 0..9)


Can be written as:
CODE
mapedge_qw(1, 15, 0..9)


The old syntax is left in place so you dont have to change anything you have already set up, but you have the option available for future events.


If you are confused about coordinates, its the same coordinates displayed at the bottom of the editor when you mouse over a certain tile. They start at 0, 0 (x, y) for the uppermost left-hand corner tile, and count up 1 for x every tile to the right, and 1 for right every tile down from there. For example, a map of size 20 x 20 would have a lower-right coordinate of 19, 19. You should get into this frame of mind.

For map 1:

CODE
mapedge_e(4, -1, -1, -1, -15, 15..24)
mapedge_s(2, -1, -1, -1, 0, 0..24)
mapedge_s(3, -1, -1, -1, -25, 25..44)


West and north edges have no adjoining maps, so nothing is set up here.

Following the parenthesis, we put the map id to transfer to. Since everything is autosetup, we use -1 for x, y, and direction, hence the three -1s in each section.

East edge is connected to map 4 at y coordiantes 15 through 24, so the range we put is 24. We want the coordinate transfer in the next map to be 15 lower than what we transferred from, so the offset is -15.

The first part of the south edge is connected to map 2. The tile range for the x coordinates here would be 0..24, so that is our range. Offset here is zero because the x coordiante of the tile you transfer to on the next map cooresponds exactly with this one.

The second part of the south edge is connected to map 3. The tile range for the x coordinates here would be 25..44, so that is our range. Offset here is -25 because we want the x coordiante of the tile you transfer to on the next map will be 25 lower than the one on the map you are leaving (eg., if you are leaving at x coordiante 25, you'd transfer into the upper left hand corner of map 3 as expected)

For the rest of the maps, the following should work:

Map 2:
CODE
mapedge_n(1)
mapedge_e(3)


Since the adjacent maps are lined up at the left and top, respectively, no ranges or offsets are needed.

Map 3:

CODE
mapedge_w(2)
mapedge_n(3, -1, -1, -1, 25)
mapedge_e(4, -1, -1, -1, 10, 0..9)


Again, no extra setup needed to go from 3 to 2 because their heights are they same, and they line up at the top. The north edge must be offset 25 to land on the correct tile (eg., transferring from x coordiante 5 on map 3 would land you at x coordinate 30 in map 1), but we need no range because the entire edge has the same destination. For the east edge, we are transferring to map 4, coordinate offset will be 10, because we want to be 10 tiles further south on map 4 after we transfer.

Map 4:

CODE
mapedge_w(1, -1, -1, -1, 15, 0..9)
mapedge_w(3, -1, -1, -1, -10, 10..19)


You should be getting the hang of it by now. For the west edge, transfer to map 1 is done at y coordiantes 0..9, and will be offset by 15. Also for west edge, transfer to map 3 is done at y coordiantes 10 through 19, and will be offset by -10.

I'm thinking of adding a secondary command specifically for autosetups (what 99% of this script is likely to be used for) so that you dont have to type the three -1s every time. Edit: See above.


--------------------
Go to the top of the page
 
+Quote Post
   
RuGeaR1277
post Jan 26 2010, 11:34 PM
Post #18



Group Icon


Type: Undisclosed




i think i kinda get it... =D
thanks a lot, Mithran!
Go to the top of the page
 
+Quote Post
   
Memochido
post Feb 15 2010, 03:55 AM
Post #19


Darkness surround us...the best thing to do, let it absorb you..
Group Icon


Type: Designer




Hi Mithran, (I hope I'm not necroposting, if I am, sorry! My bad)

I have a small doubt about this script of yours. Is it possible to disable the "mirror" effect (if you are going left, you will be placed on the rightmost edge of the next map) so instead the player, if going left, appears on the rightmost left side. I hope I made myself clear and hope you can help me, thanks in advance.
Go to the top of the page
 
+Quote Post
   
Mithran
post Feb 15 2010, 04:02 AM
Post #20


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (Memochido @ Feb 14 2010, 07:55 PM) *
Hi Mithran, (I hope I'm not necroposting, if I am, sorry! My bad)

I have a small doubt about this script of yours. Is it possible to disable the "mirror" effect (if you are going left, you will be placed on the rightmost edge of the next map) so instead the player, if going left, appears on the rightmost left side. I hope I made myself clear and hope you can help me, thanks in advance.


I'm not sure what you mean. You want the player to transfer to the exact coordinates on the map he is transferring to as the map he is trasnferring from?


--------------------
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 30th September 2014 - 10:57 AM

RPGMakerVX.net is an Privacy Policy, Legal.