Help - Search - Members - Calendar
Full Version: Player transfer to other map when he reach the map limit
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
LiOn~HeaRt
How to make the player transfer auto when he get out of the mao ratio
like the map limits
when he touch the map limits he just get out and go to other map
help
Redd
Just make a "Player/Hero Touch" event, so that when the hero touches the event that is out of the map boundaries, he is transferred elsewhere!
amerk
When you say "map limit" I'm assuming you mean the map boundaries, right? If so, then handle it like any other transfer event, as Redd suggested, except you would need to add the transfer events for every place the hero can transfer.

But if you are referring to map limits, as in the amount of maps you can have in a game, and you are trying to figure out how to create a new map beyond those limits to transfer to, you'll need a script to break that limit.
LiOn~HeaRt
I want to make 1 event only
the map is too large i cant make alot of events it makes the game kinda lagy which is the worst thing for the game designers
1 event only
amerk
If you've got multiple exits, you're going to need more than 1 event. If you're planning on any sort of interaction (NPC's, exploration, monster battles, treasures) you're going to need multiple events. If lagging is an issue, you'll need to get an anti-lag script, but a game without events is sort of like a twinkie without the filling.
Zeriab
You can create a parallel process which stores the player's x or y in a variable. You then use a conditional branch to check if the x or y value corresponds to the edge of the map. If so, do transfer.
You can also use terrain tags where you have a parallel process recording the player's terrain tag. This way supports up to 7 exits. (Assuming you are not using the terrain tags for anything else)

*hugs*
stripe103
I think I saw a script somewhere that allows you to only create one event and the whole side was made into a transfer spot. I don't remember if it was for VX though. I'll check.

EDIT: I found it. Maplinks by Wachunga
It's was included in the Project Zelda Engine so I guess that was where I saw it.
CODE
#==============================================================================
# ■ Maplinks
#------------------------------------------------------------------------------
# This is the script for Maplinks.
#==============================================================================
=begin
============
Maplinks - version 0.95 (2005-11-10)
============
by Wachunga

This script simplifies linking maps together: a single event sets up an
entire edge of the map as a teleport to another map. Players trying to
leave that edge of the current map are automatically teleported.

(This can also be achieved with many copies of teleport events along the edges
of a map or with a parallel-process event that sets variables and uses them to
teleport, but these methods are not optimal -- causing lag and/or inconvenience
for the mapper.)

To link a map with another on a specific edge (north, east, south or west),
create an event with <maplink> included in its name on the appropriate edge of
the map. (To avoid confusion, maplink events on corners of the map are
not valid.) Then, add a teleport ("Transfer Player") command to the event
to specify the destination map and other details (e.g. player direction,
fading on/off). If the destination is an east or west edge, then the Y
coordinate is calculated based on the player's Y coordinate when
teleporting; likewise, the X coordinate is calculated automatically when
the destination is a north or south edge.

Note: unlike normal teleport events, maplinks are activated when the player
tries to leave the screen instead of when stepping on the last tile. This
behaviour could be changed, but I feel that it's more natural this way:
it leaves the whole map open for actual exploration, instead of "wasting"
the outer tiles of a map.

=end

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

class Game_Event < Game_Character
alias ml_ge_init initialize
def initialize(map_id, event)
ml_ge_init(map_id, event)
if @event.name.upcase.include?('<MAPLINK>')
dir = nil
if @event.y == $game_map.height-1
dir = 2 unless @event.x == 0 or @event.x == $game_map.width-1
elsif @event.x == 0
dir = 4 unless @event.y == 0 or @event.y == $game_map.height-1
elsif @event.x == $game_map.width-1
dir = 6 unless @event.y == 0 or @event.y == $game_map.height-1
elsif @event.y == 0
dir = 8 unless @event.x == 0 or @event.x == $game_map.width-1
end
if dir != nil
@list.each { |command|
if command.code == 201
# make sure new location isn't be specified by variables
if command.parameters[0] == 0
$game_map.maplinks[dir] = Maplink.new(command.parameters)
break
end
end
}
end
end
end
end

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

class Game_Map
attr_accessor :maplinks

alias ml_gm_setup setup
def setup(map_id)
@maplinks = {}
ml_gm_setup(map_id)
end

def width(map_id = @map_id)
if map_id == @map_id
return @map.width
else
return load_data(sprintf("Data/Map%03d.rxdata", map_id)).width
end
end

def height(map_id = @map_id)
if map_id == @map_id
return @map.height
else
return load_data(sprintf("Data/Map%03d.rxdata", map_id)).height
end
end

end

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

class Maplink

def initialize(parameters)
@param = parameters
end

def activate
width = $game_map.width(@param[1])
height = $game_map.height(@param[1])
# modify x (p[2]) or y (p[3]) coordinates appropriately
if @param[2] == 0 or @param[2] == width-1
@param[3] = $game_player.y
elsif @param[3] == 0 or @param[3] == height-1
@param[2] = $game_player.x
end
# set up a dummy interpreter just for teleport
interpreter = Interpreter.new
interpreter.parameters = @param
interpreter.index = 0
interpreter.command_201
end

end

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

class Game_Player

alias ml_cett check_event_trigger_touch
def check_event_trigger_touch(x, y)
check_maplinks(x,y)
ml_cett(x,y)
end

def check_maplinks(x,y)
if $game_map.valid?(x, y) then return end
dir = nil
if y == $game_map.height then dir = 2
elsif x == -1 then dir = 4
elsif x == $game_map.width then dir = 6
elsif y == -1 then dir = 8
end
if dir != nil
if $game_map.maplinks[dir] != nil
$game_map.maplinks[dir].activate
end
end
end

end

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

class Interpreter
attr_accessor :parameters
attr_accessor :index
end
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.