Tutorial: Simple Step Counter
Difficulty: Intermediate
RPG Maker: 2000/2003
Author: The_Enigma_Lies_Broken

This is how one would go about making a simple step counter. These can be used to count the number of steps a hero takes in order to achieve a higher calculative goal, such as random encounters for a CBS, how many steps it takes for a hero to lose HP in a given "mini game" type situation.

Create an event and label it as a Parallel Process. Then, Create 5 variables named as following
Hero X
Hero Y
Hero X2
Hero Y2
Step Counter

The Hero X, Y, X2, Y2 - variables will act as check points in the process to determine if the hero's position has changed from the last time the event checked itself.

===In the event===
Set the Hero X variable to the Hero's Map X Id.
Set the Hero Y variable to the Hero's Map Y Id.
Wait 0.1 seconds

now comes the part where the fork options are set.
setup a fork condition (with an ELSE option) to compair the Hero X variable and the Hero X2 variable to see if they are they same
If Hero X = Hero X2
inside of this fork condition setup another fork condition to compair the Hero Y variable and the Hero Y2 variable to see if they are they same
If Hero Y = Hero Y2
under this condition, leave it blank, becuase we dont want anything to happen if the variables dont change.

in the ELSE case: this says that the variables did NOT match - under this condition we want to add a count to the step counter variable, and then set the other variables to be equal to eachother so that the counter doesnt infinitely keep adding numbers to the step counter that we dont want added.
ELSE CASE:
Set Var "step counter" + 1
Set Var "hero X" = "hero X2"
Set Var "hero Y" = "hero Y2"
END CASE: (nothing goes here)

Then, you're done - you have a perfectly good working step counter that should look like this when you're done.

stepcounter


Side Notes:
This counter can be used for character "boredom" too.



Click to Return to the Tutorials Page