Gw Temp

Menu

Tutorial - 'Tracking Variables' by Guest

An item about RPGMaker 2000 posted on

Blurb

Using the X and Y tracking variables to their full potential!

Body

Hello. Here I am to give all you rm2k people some more knowledge about tracking variables, or "X and Y" variables. I will run through the tutorial in sections, as I usually do. I will show you first what they are, then how to do it, and finally I will show you how you can use the knowledge I've given you. And please, I would appreciate if you refrained from "Good tut for n00bs!" comments. Thanks. Now on to the tutorial.

1. WHAT ARE TRACKING VARIABLES?
Tracking Variables are also called "X and Y" variables, as I said before. They can "track" an event's position on the screen. Have you ever tried to make an event where a monster/enemy is chasing the hero and you have to lead him into a death trap? I bet most of you have, I mean, I have in the past. Usually it won't work unless you have knowledge of tracking variables. In the case of the monster running into a death trap, you must track the monster's "X and Y" position as he moves across the screen. You must also track the Death Trap's "X and Y" position, so that when the enemy is in the same square as the trap, he will die. You see, if you open up the event editing page on your map, you will see it is divided into squares. These squares are like sections of a gigantic graph. You have your "Y" axis, which is running down the page, and your "X" axis which is running across the page from the left. So in effect your maps are like graphs. You can place events on these graphs. This sounds extremely confusing to some of you, I know! Please bear with me and I will make it simpler!

2. HOW DO I MAKE TRACKING VARIABLES?
Okay, for this next section, you must at least know what variables are and how they work. Or else don't bother mate. I will show you how to code "X and Y" Variables then go into detail about what it all means.
(I will use the enemy hitting a trap as my example)

A) THE ENEMY!!!
Make a new event with any graphic of an enemy you like. In the first page of the event, make the "Event Start Condition" set to "On Touch (Event, Hero)". Make sure the enemy is walking towards the hero. In the main "Event Commands" section of the event editor, make this code...

<>Play SE: Hurt (This is playing a sound effect)
<>Take Damage HeroAttack 10 Damage (This is making the hero take damage upon contact with the enemy. You can change the amount of damage taken if you like!)
<>Move Event... : Hero, Turn 180o, Start Jump, Forward, Forward, End Jump (This makes the hero jump away from the enemy after contact. Make sure you select "Ignored if can't be Moved"!)

Create another event page. Make it activated by a Switch called "Enemy Die" or something like that. Make the graphic clear. Make it so that the hero can walk over it (Select in the "Position" box the "Below Hero" option). And that is the enemy, simple and done!

B) THE TRAP EVENT'S CODING!!!
Make an new Event anywhere on the map that the enemy event could step on. Make it look like a trap. Set the "Event Start Condition" to "Parralel Process". Then enter this code into the main event thingo.

<>Variable Ch:[0001:Trap X] Set, this Event X pos
<>Variable Ch:[0002:Trap Y] Set, this Event Y pos
<>Variable Ch:[0003:Enemy X] Set, Enemy X pos
<>Variable Ch:[0004:Enemy Y] Set, Enemy Y pos

That coding has just tracked the X and Y positions of the Enemy and the Trap. Finally, we're getting to the end!

C) TO KILL A MOCKING BIRD... IF YOU SELECTED A MOCKING BIRD AS YOU ENEMY... OR... SOMETHING...
Make a new Event that is isolated from the other events, ie situated in the wall where it cannot be touched, so you will remeber where it is. Make its "Event Start Condition" set to "Parralel Process" and enter this coding into it...

<>FORKOptn: Switch[0001:Enemy Die] - Off
<>ForkOptn: Varb[0001:Trap X]-V[0003]Equivl
<>ForkOptn: Varb[0002:Trap Y]-V[0004]Equivl
<>Show Battle Anim: Enemy Die, Enemy(W)
<>Change Switch: [0001:Enemy Die]-ON Set
<>
:END Case
<>
:END Case
<>
:END Case
<>

And you've done it! Go ahead, play your game! Lead the enemy into your trap and watch him die. Fun for the whole family! I would like to take the time to say that this indeed does work, because as I wrote this tutorial I made the events following my instructions, so it does work. I understand some of you may not get this to work, but no worries! Email me at rpgenius_89@hotmail.com and I will send you an example of this tutorial in action! Well, I hope you learned something!

3. THIS CAN ALSO APPLY TO...
a)Block moving puzzles. You can track the block's position and the platform's position that it needs to touch. You can use "Move Event" options to push the block when you touch it, and make an event that checks to see if the X and Y positions are equal, and if they are, it could activate a switch that opens a door or something!

b)Laying bombs. Usually used in an ABS, bombs are very fun things to place in your rm2k games. To see a good example of bombs in an ABS, download blue_moogle's adveture system from the main site and look at his coding. Be warned though, it IS complex for newer people!

c)More complex Adventure Systems. You can track the Hero, then the Enemy. Then, when you press the confirm key, you can change the hero's X or Y position to become greater or smaller, dependant on where you are facing. This is rather time consuming, much like the bomb. To see a simple and easy ABS, look at my other tutorial entitled appropriately "Easy ABS". If you got this one easy you should have NO trouble with my other tutorial.

4. CONCLUSION
Well I sincerely hope you learned something today people. I do expect to get "this don't werk" comments from some people. As I said before, email me at rpgenius_89@hotmail.com and I will gladly send you an example of this tutorial. Well, to the people who do get it, have fun with it. And no, you do not need to include my name in the credits of your game. Because really, I only figured this out; I didn't make the machine! So feel free to claim it as your own. Hell, I couldn't care! It's your game anyway!

So long!