Increase one variable while decreasing another?

So, I've been trying to make a game with mechanics similar to what happens in the Mystery Dungeon games. Right now I'm trying to make it so when you taken 500 steps total in one of the floors in a dungeon, it kicks you out and you need to start over from the first floor.

I got two variables: One for the steps and the other is for how many you have left.

The main problem I am having is that I can't seem to figure out the scripting part of this. Every time I think I figured it out, the second variable just continues to decrease despite the player not moving. Here is my code so far. I don't know what I am doing wrong.
Capture.PNG
why not just use 1 variable, Steps, where it counts up from 0, and when it reaches 500, you get kicked out?
why not just use 1 variable, Steps, where it counts up from 0, and when it reaches 500, you get kicked out?
Problem with that is that you can't reset the internal step counter. Meaning that you could get lost on one floor for a bit, then go to the next one and instantly get kicked out because you reach the limit. And once you go back in, the event won't even trigger at all because you are past the step limit.
you could restructure the common event to restart the step variable.
or you could use http://www.yanfly.moe/wiki/Region_Events_(YEP)
make the whole map the same region, and then have that region trigger a common event that increases Step variable by 1, and then when that variable reaches 500, kick, then reset variable value to 0.
Just make one variable. If it's equal to 500 you get kicked out (transferred to another map) AND have this variable set to 0. Set the variable before transfer though, otherwise it won't get set. By doing this the counter will reset and you can enter the map again while still having 500 steps left.
or you could use http://www.yanfly.moe/wiki/Region_Events_(YEP)
make the whole map the same region, and then have that region trigger a common event that increases Step variable by 1, and then when that variable reaches 500, kick, then reset variable value to 0.

Look at me, making things twenty times harder for myself! I'm not surprised.
Thank you!
Look at me, making things twenty times harder for myself! I'm not surprised.
Thank you!
yeah I couldn't figure out why you were doing something so complicated
Hi there!
That's is very simple to do. Make an event to activate every time the player enters in a new map and register the max number of steps he can get before get kicked out:
steps.PNG


In the common event, you can check it like this:

steps common.PNG

Original thread: https://forums.rpgmakerweb.com/threads/increase-one-variable-while-decreasing-another.132128/