Submit Your Article Guild Wars 2 Forum RPG Maker VX.com
 
RPG Maker
 

 Username:
 Password:
   Not a member? Register!



Home > Tutorials > RPG Maker 2003 > Better Teleport

Better Teleport


This is a neat little trick I discovered to make teleporting events that I think are better than
RM2K3's default teleports. Instead of teleporting your character to a new map as soon as he steps
on the event, this modified event will wait until the player actively walks the character into the
side of the screen. What this means is that the character can walk back and forth freely upon the
edge of the map, but he will not teleport until, as an example, the hero stands on the right side of
the screen and then presses the Right key. Another advantage is that if your character walks
upwards onto a teleport that goes right, he will not teleport. It’s a small addition to a game, but a
nice one nonetheless, and fairly simple to make.

So to start, imagine this scenario: You have an opening in the right side of your map, 5 tiles wide.
If the character steps on any of these tiles, it should teleport him to the next map.
picture
The problem with RPG Maker’s default teleports is that if you teleported onto one of those
tiles from a different map and walked upwards, it would still teleport you back to the other map.
That would look strange to the player and detract from the experience of playing your game.

What we want to do is make it so that the player can walk along the right edge of your map, but if
he tries to walk past where the map ends he will teleport.
picture
Create a new event on the right edge of the screen, just like if it were a normal teleport. Set the
trigger to Collision with Hero (On Touch in some versions) and the layer to Below Hero.
Now, the first thing we need to do in the event is make sure that if the hero presses the Right key
while standing on that event, he teleports.
Declare a key input variable (page 3 of event commands, 1st column, 7th down) to check for the
Down Key, Left Key, Right Key, and Up Key. Check the Wait Until Pressed option. Now, when
standing on the event, it will wait until one of the arrow keys is pressed before doing anything
else.
picture

Next, we have to make conditional statements to check to see which of the arrow keys is being
pressed. Make a conditional branch (3rd page, 2nd column, 5th down) that checks to see if the
variable you stored the key in is equal to 1 (the down key). Check the Else Case option.
picture
So now, it will recognize if the hero stands on that event space and presses the down key. So
what should happen? The hero should walk down. Make a command that makes the hero walk
down (page 2, 2nd column, 4th from bottom) inside the conditional branch. So far, your code
should look something like this:

Code:

<>Key Input Proc: [0392:temp Teleport Key]
<>Branch if Var [0392:temp Teleport Key] is 1
<>Move Event: Hero, Move Down
<>
:Else Handler
<>
:End


That only checks to see if the player presses the down key, so make three more conditional
branches, each inside the Else case of the previous one, that check to see if the key variable equals
2 (left key), 3 (right key), or 4 (up key). Inside the left and up key branches, do the same thing
you did for the first one: make the character move left and up.

Now your code should look like this:
Code:

<>Key Input Proc: [0392:temp Teleport Key]
<>Branch if Var [0392:temp Teleport Key] is 1
<>Move Event: Hero, Move Down
<>
:Else Handler
<>Branch if Var [0392:temp Teleport Key] is 2
<>Move Event: Hero, Move Left
<>
:Else Handler
<>Branch if Var [0392:temp Teleport Key] is 3
<>
Else Handler
<>Branch if Var [0392:temp Teleport Key] is 4
<>Move Event: Hero, Move Up
<>
:End
<>
:End
<>
:End
<>
:End
<>


We still need to fill in what happens when the hero presses the right key. First, put a command to
make the hero face right. (Not walk right.) Then put a Proceed with Movement command (right
below Move Event) That makes sure he still faces right before he teleports, even if he was facing
up or down before.
Add a 0.1 second Wait command (2nd page, 2nd column, last option). It just makes it look better.
Finally, add the Teleport command (2nd page, 1st column, 5th down) to make it teleport the
character to the place of your choice.

There’s only one thing left to do before the teleport is finished. Currently if you walk right onto
the event, it will teleport you immediately because it thinks you are both standing on the event and
still pressing the Right key. To fix this, all you have to do is make another conditional branch at
the very top of the event that checks to see if the hero is facing right. If he is, add a Wait of 0.1
seconds. That allows the hero to actually get onto the teleport event without teleporting him
immediately.

That’s it, all there is! You can very easily copy and paste this teleport event to wherever you want
a teleport - just make sure that you change the conditional statements to match where the edge of
the map is. This is the final event coding for an event on the right side of the screen:

Code:

<>Key Input Proc: [0392:temp Teleport Key]
<>Branch if Var [0392:temp Teleport Key] is 1
<>Move Event: Hero, Move Down
<>
:Else Handler
<>Branch if Var [0392:temp Teleport Key] is 2
<>Move Event: Hero, Move Left
<>
:Else Handler
<>Branch if Var [0392:temp Teleport Key] is 3
<>Move Event: Hero, Face Right
<>Proceed with Movement
<>Wait: 0.1 Sec
<>Teleport: 0052: Tasty Shrimp Dungeon (000,027), Retain Facing
<>
Else Handler
<>Branch if Var [0392:temp Teleport Key] is 4
<>Move Event: Hero, Move Up
<>
:End
<>
:End
<>
:End
<>
:End
<>

Details
Tutorial: Better Teleport
Date Listed: Thu, 19 Jun 2008 13:52:38 -0700
Author: GoldenGriffon
Total Hits: 2598


Embed
Short URL:

HTML:

BB Code:



RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

RPG RPG Revolution is an Privacy Policy and Legal