Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [RM2K3]Better Teleporting!
GoldenGriffon
post Jun 19 2008, 02:25 PM
Post #1


Current Mood: eternally happy @_@
Group Icon

Group: +Gold Member
Posts: 1,291
Type: Event Designer
RM Skill: Undisclosed




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.

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.

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.


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.

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
<>


__________________________
GoldenGriffon

Coming out of game-making retirement?
Go to the top of the page
 
+Quote Post
   
Calintz16438
post Jun 19 2008, 02:33 PM
Post #2


Level 5
Group Icon

Group: Member
Posts: 74
Type: Artist
RM Skill: Skilled




VERY interesting!!
This system seems as though it would work with RMXP as well.

Have you tested it on RMXP??
Go to the top of the page
 
+Quote Post
   
GoldenGriffon
post Jun 19 2008, 05:58 PM
Post #3


Current Mood: eternally happy @_@
Group Icon

Group: +Gold Member
Posts: 1,291
Type: Event Designer
RM Skill: Undisclosed




Nope, but as you said, I think the same general idea would also apply there. You might have to tweak a few things, I don't know. Do you use XP? Want to try it out for me? biggrin.gif


__________________________
GoldenGriffon

Coming out of game-making retirement?
Go to the top of the page
 
+Quote Post
   
HeroOfHyla
post Jun 19 2008, 06:05 PM
Post #4


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




Good idea! I haven't actually worked much with non-standard teleporting and stuff.
I think that this, while conventional, isn't the most visually appealing system in the world. I'd rather make the screen lock one square away from the border of the map, so the hero actually walks out of the screen before teleporting.


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   
Calintz16438
post Jun 19 2008, 06:16 PM
Post #5


Level 5
Group Icon

Group: Member
Posts: 74
Type: Artist
RM Skill: Skilled




I think I will test this out.
Give me a few minutes here.
I'll let you know how this turns out.

EDIT:
Or not. I can't do this. I can't follow... confused.gif

This post has been edited by Calintz16438: Jun 19 2008, 06:22 PM
Go to the top of the page
 
+Quote Post
   
HeroOfHyla
post Jun 19 2008, 06:29 PM
Post #6


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




It doesn't work well on XP. The key input processing doesn't seem to pick up directions. And if you use the conditional "if key is pressed" it works, but moving other directions is jerky.


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   
Calintz16438
post Jun 19 2008, 06:33 PM
Post #7


Level 5
Group Icon

Group: Member
Posts: 74
Type: Artist
RM Skill: Skilled




I've tried doing this in the past using only the conditional branch option. It didn't work very well. At any rate, good addition to RM2K.
Go to the top of the page
 
+Quote Post
   
YanXie
post Jun 19 2008, 06:48 PM
Post #8


Because Tomorrow Will Surely Come...
Group Icon

Group: Revolutionary
Posts: 1,137
Type: None
RM Skill: Skilled




QUOTE
It doesn't work well on XP. The key input processing doesn't seem to pick up directions. And if you use the conditional "if key is pressed" it works, but moving other directions is jerky.


If it is about conditional branching for direction button(up, down, left, right) it still can be applied.

To do that, choose conditional branch command, and go to script option. Write this there :



You can change "DOWN" to "UP", "RIGHT" or "LEFT".

( `ー´)
cheers, puppeto4. smile.gif


__________________________
how make teleport to graveyard then your character die?

AWAY FOR VACATION.
NOT HERE UNTIL JAN/FEB 2010 -w-/
Go to the top of the page
 
+Quote Post
   

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: 19th June 2013 - 05:13 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker