Subtracting Gold via Step Counter

Sampai

Magical Girl
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?

Roninator2

Gamer
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.

Lord Vectra

Master Eventer
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.

Last edited:

Roninator2

Gamer
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.

Lord Vectra

Master Eventer
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.

Roninator2

Gamer
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.

Sampai

Magical Girl
Thank you so much for your help guys

Managed to get it to work!

Lord Vectra

Master Eventer
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

Latest Profile Posts

Nevermind...
Hey everyone! No Studio Blue RPG Maker Critiques Stream today! But you can always check the playlist for old streams you've missed!

I ran out of paper sheets to draw, so I guess I'm forced to do digital for a while now...

Still haven0t found a colouring style that I like

Mapping is becoming so much easier!