Reinitialize step count

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
I am using this event to get a step count.

◆Control Variables:#steps1 = Steps
◆Loop
◆Control Variables:#steps2 = Steps
◆Wait: 6
◆If:#0007 > #0006
◆Break Loop

:End

:Repeat Above

When the steps reach, say 1000, how do I reset them back to zero?

I tried changing the variable steps1 and steps2 to to =0, but it does nothing.
steps2 = 0
I also tried subtracting the steps variable by itself, still nada.
Steps2 -= steps2
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Too little information. But I would suspect the reason why this is happening is because you don't reset steps and since steps1 and 2 take value of steps, doesn't matter how many times you return them to 0, once the event gets called again, they will come back as long as steps remains unchanged.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,669
First Language
German
Primarily Uses
RMMV
You can't reset the internal step count, you can only reset your variables.

However, there is an alternative for what you want:
Make a modulo operation with 1000 after you read the step number, that will remove the part above 1000 from the number in the variable.
 

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
@Andar I know I can't reset the internal step count, but I thought storing steps into a variable meant you could reset the variable. Am I storing them wrong, or should I make another variable based on steps1 and steps 2?

I thought about using modulo but I want one event t o play at 1000 steps and another event to play at 2000 steps, that seems to exclude the modulo solution, unless I'm missing something.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
You can't reset the internal step count,
You can't? That's some news for me. However, it is not true. You can.
Steps are located inside $gameParty as _steps and they are completely flexible. You can, absolutely fearlessly, overwrite these steps in any way you like. Even set them to 0 or negative values if you want :D
Screenshot_336.png

EDIT: The Modulo solution doesn't need to be excluded. You just need to increase another variable as you go. For example: if modulo steps2 == 1000, then variable stepThousands increases by 1. And then in the common event have
if stepThousands == x, then...
 
Last edited:

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
EDIT: The Modulo solution doesn't need to be excluded. You just need to increase another variable as you go. For example: if modulo steps2 == 1000, then variable stepThousands increases by 1. And then in the common event have
if stepThousands == x, then...
@Poryg
Also, modulo works to trigger the events(the events already work without it though) but it doesn't reset the counter, which is what I REALLY need. How do you reset the counter and get it to work? I'll need you to spell it out for me, lol.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Set to 0 whatever you are using to write down the actual number of steps. Whether it is internal one or variable. I will provide an example once I can.
 

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
Set to 0 whatever you are using to write down the actual number of steps. Whether it is internal one or variable. I will provide an example once I can.
If you check out my first post, it's being stored in var steps2 and I've tried to set it to zero, but it doesn't respond at all.


blockley.png
blockley.png
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Because you reset steps 2, but not steps, meaning next time the parallel event gets called, steps2 gets back to value of steps. You need to set steps to 0.
 

Llareian

Jack of All Trades, Master of None
Veteran
Joined
Jan 26, 2017
Messages
604
Reaction score
1,421
First Language
English
Primarily Uses
RMMV
As Poryg stated above, you have TWO events both trying to set the value of Steps2. It doesn't matter how many times "Mushroom treat" is called to reset Steps2 to 0, IMMEDIATELY following that, your parallel process event "Dogs hunger" sets it BACK to the internal game step count. (Which is presumably over 1000.)

You can either:

1) Change the internal game step count to 0 within "Mushroom treat", which will effectively change Steps2 to 0 the second "Dogs hunger" runs (the following tick). In this case, you will never get higher than whatever step count is used to trigger "Mushroom treat". You would do this by replacing the Control Variables line in "Mushroom treat" with a script call:
$gameParty._steps = 0;
Again, with this method, you will FOREVER lose track of any steps taken before "Mushroom treat" was called.

2) OR find some other way to do it, that would probably be better. I'm not entirely clear on the full context of what you're trying to do. Where are you using Steps1? How is "Mushroom treat" being triggered? Is your ultimate goal just to know how many thousands of steps the player has taken, and also only allow "Mushroom treat" to trigger once for every thousand steps?
 

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
I feel like we aren't on the same page :(

I already reset the steps variable, steps2 is the name of the variable = to steps.

I tried making another one, a basic no name variable, with gamedata = steps, and setting it to zero just for the heck of it. It doesn't work. (It is no different than what I'm already using though, just un-named.)
 

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
@Llareian YES! Thank you, that script call was exactly what I needed. I don't think I will need a step count for anything else, so it will work perfect! Thank you!!!!!

And @Poryg and @Andar Thank you so much for your help too! :D
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Quite funny that I posted the same script a little while ago, just in the screenshot :D
 

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
@Poryg I haven't done anything with the dev console yet so, it was too obscure for me too pick out. I thought that's what you were trying to do, that's why I said you would need you to spell it out for me. :p
 
Last edited:

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
:D I would have provided the actual example if you waited a little bit longer :p But well, nevermind :) Probkem solved, that's important :D
Dev console is not important here though, the commands usable in the console are usable even outside of the console, since it is the same javascript. I only use console as a real-time debug tool, because it allows me to manually influence variables and all sorts of stuff. If you want, you can check my school lesson and have some fun with the console :)
 

Tea's Jams

I'm human
Global Mod
Joined
Mar 28, 2017
Messages
1,039
Reaction score
2,578
First Language
English
Primarily Uses
RMMZ
I'll take you up on that, after the jam that is. I've been away from rpg maker for 4 months to learn javascript, so I understand script calls better, but have done absolutely nothing with what I learned about JS with the engine yet. Your school sounds like a wonderful way to get started with that! :)
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Sure thing, I'm not rushing you anywhere. It's not my school though, just my lesson for community school :p

Good luck with the jam :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top