CREATING A STEP COUNTER

Posts

Pages: 1
This deals with RPGMaker 2003.

I tried using Digital Koifish's tutorial, but for some reason it did not work. Basically what I need this time, is a simple way to see how many steps the player has taken so that after a certain number, an event fires. Essentially, I'm creating an area of the game that is very reminiscent to Breath of Fire 3's infamous desert of death, where you have to conserve your supplies to make it through.

So for a resource such as say.. Water, I'd like it to deplete every 20 or so steps, but not deplete if the player stands still. The problem is, everything I've tried doesn't seem to correctly count the steps when I do a X Coordinate = to Stored X coord, with a branch of +1 when it does not.

If anyone knows a way to create a simple step counter that I can turn on and off as needed (don't want the player informed they need water if they are in the ocean after all. xD), I would really appreciate it. Preference for the simplest and least obtrusive means to achieve this. as I have all sorts of other variable saves in this particular area, and I'd like to keep things as de-cluttered as I possibly can.

Thank you in advance folks. Have a great one!
pianotm
The TM is for Totally Magical.
32347
Here's how I did it for Magic Quest. I did this in RPG Maker 2000. The process is identical to 2003.
Two common events: Player Tracker and Step Counter.
Six variables: Map ID, Plyr X, Plyr Y, Map X, Map Y, Step Counter

Player Tracker:


Set your Plyr X variable to track your player's X coordinate and set your Plyr Y variable to track your player's Y coordinate. Emphasis on "set".



Set your Player Tracker to parallel process. You don't need to turn on a condition switch. I only did it because I needed to be able to turn it off for certain processes.

That is your Player Tracker done. You will need it for the Step Counter.



On the second page of your event window, you can find "Get Player Location". Go ahead and click on that. It will give you a window to store three variables. In Map ID, place a variable that you will permanently designate your Map ID variable, in X Coordinate, do not you use your plyr X. Instead designate your Map X, and the same for Y Coordinate; designate a Map Y variable.



Now, do a wait command for 0.1 or 0.2 seconds. This will make sure your variables aren't counting multiple times for each step.

Now, you need three conditional branches.
The first one is set to Variable Plyr X "is equal" to Variable Map X. If it is, do nothing. If it's not, Variable Step Counter is set to add 1. Emphasis on add. Do the same thing for your second conditional branch except checking if Plyr Y is equal to Map Y. The X conditional branch is clearly checking your movement up and down while the Y branch is clearly checking your movement left to right.

The third conditional branch is a necessary redundancy. If your step counter has exceeded a certain number you don't want it to go past, make it go back. The wait command does a lot of heavy lifting in keeping your variables from flying past numbers, but it needs help. This redundancy makes sure the variable doesn't miss.

If Step Counter is greater than specified number you're trying hit, set Step Counter to equal that number.

Again, set this to a parallel process. In this case, DO require a condition switch because that will enable you to turn this Step Counter on and off as you please.
PianoTM, I wanted to take a moment and thank you for the really in-depth and easy to understand explanation on how to achieve this step-counter. Thanks to you I've been able to recreate a scenario I was honestly not sure if RPGMaker 2003 could handle.

The desert (and it's annoying as hell water dependency) are now up and functional now thanks to your code / response. I was even able to add a graphic to the game to show players exactly how much water they actually have because of what your steps taught me about how Variables and Conditional Branches work.

Thank you again!
pianotm
The TM is for Totally Magical.
32347
It's no problem! Glad I could help!

Also, this doesn't really matter, but I got X and Y confused and feel a little silly for it. X is left and right and Y is up and down. Sorry about that!
This could be used for a bunch of cool stuff! Idk why I did it with the arrow keys instead of XY.

Also if you warp the actor to a different position on the map it will count as an extra step too.
Pages: 1