Gw Temp

Menu

Tutorial - 'Special Movement' by Axel

An item about RPGMaker 2000 posted on

Blurb

A system that creates a unique random movement system that is very useful.

Body

I just finished another tutorial, but now I’m going to write this tutorial about a special movement system.
In RPGMaker 95, you could easily make an event would walk to a specific square. That function doesn’t exist in RPGMaker 2000 and 2003 anymore (and neither in XP by the way). Normally, choosing “walk up” and “walk right” et cetera satisfies. But when you have someone, walking randomly, and you want him or her to walk to a specific square without walking against trees, people, houses or whatever… How do you make that? With a special movement system!
The tutorial is written with the event command names like in Advocate’s version 1.08.
If you use another version, I think you’ll understand them as well; just one note: A conditional branch is sometimes called a fork conditioning.

You need:
• rm2k or rm2k3
• at least 2 variables for every person you want to use this for per map; if you want to make it even more better, you may have to use some more
• … perfect knowledge of coordinates, variables, labels and conditional branches
Note: This tutorial is made so that you don’t have to use more things for every single person you use this for in your whole game. You need extra things for every person per map. So if you have used this 47 times in your whole game, and at highest 8 times at one map, then you have to create 8 times new things, instead of 47.

Index
• Step 1 How does it work
• Step 2 How do you have to make it
• Step 3 Difficult example explained
• Step 4 Event commands of the example
• End of tutorial
Note: In all other tutorial I write, I work out everything step for step. The problem with this tutorial is, that it’s always different. So I can teach you how to do it, give a difficult example, but I can’t type general event commands. This means you can only use this tutorial if you have perfect knowledge of coordinates. If you have not, you can try, but I don’t think you are able to complete the tutorial.

Step 1 How does it work
How does this special movement work?
We put the coordinates of the person you use this for in 2 variables. That person is, for example, in a village. In the village, he has to walk to a specific square, but he may not get stuck by trees, houses, people or whatever. So he has to move via the path and avoid all obstacles.
By checking his coordinates, we know where he is. Then he has to walk past the houses, bridges, trees and at the path it’d be nice if he would avoid people and not have to wait until they move so he can pass.
Usually, this ain’t a big problem, because the event isn’t walking randomly, or there aren’t any obstacles. But if there are, this system allows you to make it.

Step 2 How do you have to make it
So, how do you have to make it?
First you put the coordinates of the person you want to move in variables. For example, you put the coordinates in
V[0001: OId man X coordinate] and V[0002: Old man Y coordinate]
By checking the variables with conditional branches (sometimes called “fork conditionings”), you can know at which square the person is at that very moment. If you know where the person is, you can make him move via the path. By putting the coordinates of extra obstacles, like people, in other variables, and combine them with the person’s coordinates, you can avoid the people as well.
But, if you make it that way… don’t you how long do you have to wait before the person has arrived at the square. That’s why you should not plan the whole route for every square. But you can still avoid this problem. If you know the person’s place, you can move him 1 square in the right direction and then again check coordinates and make him move 1 square and again and again. This may sound like the event command will be as long as from Canada to France. Luckily it is not! In step 3, a difficult example is made. The event command’s still quite long, but before I began I expected there’d be more commands needed.

So, how do you have to make it, told shortly: Put the coordinates of the person in variables. Check them and make him move one square. Check again and make him move 1 square again. This can be easily made with labels. By putting the coordinates of people who might stand in the way in other variables, you can make him avoid them as well.
Note: If you don’t put in coordinates of other people, that doesn’t really matter, provided that that person he hasn’t avoid walks away soon. It doesn’t look that good, but the person will still arrive at the right square. So you can make him avoid other people, but it isn’t really necessary. Although it looks much better.

Step 3 Difficult example explained
Here’s a difficult example.
When reading this in Word, the image is placed at the next page.
When reading this on a site, the image will be shown directly beneath this text I suppose.


The randomly walking old man on square (17,34) should walk to square (22,38). He may not
• get stuck by the sign
• get stuck by the barrels above him
• get stuck by the trees
• get stuck by the bridge (when X positioning is above 29)
• get stuck by the house (when Y positioning is less than 26)
• get stuck by any person in the city who might stand in the way
I guess you’ll think that the 4th point, the bridge, is painfully conscientious. Although the chance is quite little that he’ll get stuck there, if he gets stuck there, he will never arrive, the event will never end, the whole game will stop playing.
The old man can’t get beneath the 10 events at squares with Y positioning 38 and 39, because I disallowed event overlap.

Do you know now how to make that? If you don’t, you can take a look at my solution explained beneath this. If you do, check if you understand the tutorial by taking a look at my solution explained beneath this.

This is how I made this work. Use the map above and you’ll see why it’s made this way.
I put in the coordinates of the old man in 2 variables.
If X is 23, he should move left.
If X is 24 or more and Y is 30 or 31, he should move left.
If X is 29 or 30 and Y is 35 or more, he should move right.
If X is 24 or more and Y is 32 or more, he should move up.
If X is 24 or more and Y is 22 or less, he should move left.
If X is 24 or more and Y isn’t one of the three, he should move down.
If X is less than 21 and Y is 37 he should move up.
If X is 22 and Y is not 38, he should move down.
If X is not 22 and Y is 31, he should move down.
If X is 19 and Y is less than 24, he should move right.
If X is 19 and Y is between 24 and 29, he should walk up.
If X is not 22 and Y is not 31, he should move right.
If X is the same as the X of another person and X is 21 and Y is one less than the Y of that other person, he should move right.
If X is the same as the X of another person and X is not 21 and Y is one less than the Y of that other person, he should move left.
If X is 22 and Y is 38, he arrived at the right square.

Step 4 Event commands of the example
Although you can’t just copy the event commands, they can come in handy if you don’t know how to make something. So, are you ready for the event commands? For the ease of survey, labels are bold when reading this in Word (at sites it won’t always be bold).
It’s very quite amazingly much:

<>Label: 3
<>Variable Oper: V[0001: Old man X coordinate] Set, Old man X coord
<>Variable Oper: V[0002: Old man Y coordinate] Set, Old man Y coord
<>Branch if Var [0001: Old man X coordinate] is 23
<>Move Event: Old man, Move Left
<>Wait: 0.1 sec
<>Jump to label: 3
<>
: Else Handler
<>Branch if Var [0001: Old man X coordinate] is 24 or more
<>Branch if Var [0002: Old man Y coordinate] is 30
<>Label: 2
<>Move Event: Old man, Move Left
<>Wait: 0.1 sec
<>Jump to Label: 3
<>
: Else Handler
<>Branch if Var [0002: Old man Y coordinate] is 31
<>Jump to Label: 2
<>
: Else Handler
<>Branch if Var [0002: Old man Y coordinate] is 32 or more
<>Move Event: Old man, Move Up
<>Wait: 0.1 sec
<>Jump to Label: 3
<>
: Else Handler
<>Branch if Var [0002: Old man Y coordinate] is 23 Less/Equal
<>Move Event: Old man, Move Left
<>Wait: 0.1 sec
<>Jump to Label: 3
<>
: Else Handler
<>Move Event: Old man, Move Down
<>Wait: 0.1 sec
<>Jump to Label: 3
<>
: End
<>
: End
<>
: End
<>
: End
<>
: Else Handler
<>Label: 1
<>Variable Oper: [0001: Old man X coordinate] Set, Old man X coord
<>Variable Oper: [0002: Old man Y coordinate] Set, Old man Y coord
<>Branch if Var [0002: Old man Y coordinate] is 37
<>Branch if Var[0001: Old man X coordinate] is 21 Less/Equal
<>Move Event: Old man, Move Up
<>Wait: 0.1 sec
<>Jump to Label: 1
<>
: End
<>
: End
<>Branch if Var[0001: Old man X coordinate] is 22
<>Branch if Var[0002: Old man Y coordinate] is 38
<>The event has arrived at the right square.
: Else Handler
<>Move Event: Old man, Move Down
<>Wait: 0.1 sec
<>Jump to Label: 1
<>
: End
<>
: Else Handler
<>Branch if Var[0002: Old man Y coordinate] is 31
<>Move Event: Old man, Move Down
<>Wait: 0.1 sec
<>Jump to Label: 1
<>
: Else Handler
<>Branch if Var[0001: Old man X coordinate] is 19
<>Branch if Var[0002: Old man Y coordinate] is 24 Less
<>Move Event: Old man, Move Right
<>Wait: 0.1 sec
<>Jump to Label: 1
<>
: Else Handler
<>Branch if Var[0002: Old man Y coordinate] is 28 Less
<>Move Event: Old man, Move Up
<>Wait: 0.1 sec
<>Jump to Label: 1
<>
: Else Handler
<>Jump to Label: 4
<>
: End
<>
: End
<>
: Else Handler
<>Label: 4
<>Move Event: Old man, Move Right
<>Wait: 0.1 sec
<>Jump to Label: 1
End of branches till the end of the event commands

And that were the event commands for the example. The chance that your needed code is exactly the same is little, but when you don’t know how to make something, it could come in handy.

Ending the tutorial
And that’s it! You are now able to create a special movement system yourself! Randomly walking events can walk to a specific square, while avoiding all objects!
Remember: You need extra things for every person per map. So if you have used this 47 times in your whole game, and at highest 8 times at one map, then you have to create 8 times new things, instead of 47.

I hope this tutorial has helped you. Other tutorials I wrote:
• Arrow system You can shoot arrows anywhere (like in Lufia II as well),
except at places you don’t want. You can hit switches and if you’re handy with coordinates, hit monsters too.
• Code system Create closed doors which only open with a code, or
create instruments like the ocarina in Zelda, The Ocarina of time!
• Ice system You shouldn’t stand too long on ice or you will break
through. Slippery ice guaranteed!
• Lufia Fight system Monsters only move when you move and you can adjust
speed. Battles start when you’re 1 square near the mon-
ster. You can create random battles as well.
• Multiplayer system 3 Play with up to 4 players at the same time. Every player can walk in every direction, and has an action button to start events. The players can’t walk out of the screen, and player 1 can’t walk in a direction if that means another player would get out of the screen.
• Rock paper scissors Play the game rock paper scissors.
• 4 small tutorials – Create puzzles with stones and switches
– Make the hero jump in 2 versions
– Allow the hero to play piano
– Let the hero check how long he’s played the game
• Spot system Create guards, which can walk randomly if you want.
The hero had better not come too close or he’ll get in
jail, because the guards spotted him.
• Time and weather Count seconds, minutes, hours, days or even more.
Make the weather change randomly after a random
while, or choose yourself what weather it’ll be.
• Touch system Check whether the hero’s 1 square above, beneath, at
the right or at the left from a monster, and allow him to
fight in custom battles.

All tutorials are downloadable at my site, www.rpgdomain.tk, some are downloadable at THE site for games: www.gamingw.net.

This special movement system has been written by Axel. If you have any critic, suggestions or found any bugs, let me know somehow (for example by mailing me at my address Axeltjuh_101@hotmail.com or Axeltjuh.101@gmail.com).
I hope this tutorial has helped you!

Axel