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
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.
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.
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.
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.
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?
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.)
Quite funny that I posted the same script a little while ago, just in the screenshot 😀
😀 I would have provided the actual example if you waited a little bit longer 😛 But well, nevermind 🙂 Probkem solved, that's important 😀
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 🙂
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! 🙂
Sure thing, I'm not rushing you anywhere. It's not my school though, just my lesson for community school 😛
Good luck with the jam 🙂