Subtracting Gold via Step Counter

Hi there!

I am a Game Development student who is currently making a game for an assignment. I was wondering if anyone knew how to subtract gold when a character takes a step?
There is a script function that can get the steps. You can put this value into a variable and when it goes up by one subtract 1 gold then set the variable to 0 and set the steps to 0 and repeat? Not sure if that's a good way or not.
Go to >Control Variable >Game Data >Other >Steps

Let's say you chose variable 1.

Var 1 = Step Count
If Var 1 > 0, (u can replace this with Var 1 >= 1)
change gold: -1
Var 1 = 0
end

If you want it to happen throughout the whole game, just make it a parallel process common event. You set a switch to trigger it and you have it trigger from an parallel proccess event on the map the player starts in. Event page should look something like..

control switch [switch ID of trigger]
erase event

Hope this helps, and good luck on your assignment. Sorry if I was too late on answering, had to update my PC.
You missed the 1 in this statement.
But wouldn't this always make the gold go down since if you take one step, the step count will always be higher than 0.
If you used two variables then you could do a calculation without affecting the step count.
if Var 1 < Step Count
var 1 = var 1 += 1
end
if var 2 < var 1
change gold: -1
Var 2 = var 2 += 1
end
Then you have one variable that has the step count and a second that will take away as much gold as the steps taken are counted.
You missed the 1 in this statement.
But wouldn't this always make the gold go down since if you take one step, the step count will always be higher than 0.
If you used two variables then you could do a calculation without affecting the step count.
if Var 1 < Step Count
var 1 = var 1 += 1
end
if var 2 < var 1
change gold: -1
Var 2 = var 2 += 1
end
Then you have one variable that has the step count and a second that will take away as much gold as the steps taken are counted.

No because if you take one step, it adds 1 to variable 1 and then subtracts 1 gold. Then it makes variable 1 = 0. So if u take only one step, variable 1 will equal 0 again so no gold will be taken unless u keep walking.
right, but when is this check going to be done?

I take a step, var 1 = step count.
Var 1 is now whatever the step count is.
Var 1 is greater than 0 so take a gold away and set var 1 to zero.

rinse repeat

Var 1 = step count
blah blah

So this can't be done in a parallel process because it will continue to run the gold down.
This is how I interpreted the request from the OP.
Thank you so much for your help guys 😤

Spoiler
Problem_Solved!.jpg

Spoiler
Problem_Solved_Event!.jpg

Managed to get it to work!
right, but when is this check going to be done?

I take a step, var 1 = step count.
Var 1 is now whatever the step count is.
Var 1 is greater than 0 so take a gold away and set var 1 to zero.

rinse repeat

Var 1 = step count
blah blah

So this can't be done in a parallel process because it will continue to run the gold down.
This is how I interpreted the request from the OP.

Ahhh, I see what you mean, my mistake.

Var 1 = step count
if Var 2 < Var 1
Change gold: -1
Var 2 = Var 1
end

That should work, then.

EDIT: Oops. Didn't realize the solution was in the OP's message lol

Original thread: https://forums.rpgmakerweb.com/threads/subtracting-gold-via-step-counter.96397/