Sampai

Magical Girl
Member
Joined
Jun 9, 2018
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
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
Veteran
Joined
May 22, 2016
Messages
3,063
Reaction score
686
First Language
English
Primarily Uses
RMVXA
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
Veteran
Joined
Dec 6, 2015
Messages
212
Reaction score
336
First Language
English
Primarily Uses
RMVXA
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
Veteran
Joined
May 22, 2016
Messages
3,063
Reaction score
686
First Language
English
Primarily Uses
RMVXA
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
Veteran
Joined
Dec 6, 2015
Messages
212
Reaction score
336
First Language
English
Primarily Uses
RMVXA
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
Veteran
Joined
May 22, 2016
Messages
3,063
Reaction score
686
First Language
English
Primarily Uses
RMVXA
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
Member
Joined
Jun 9, 2018
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Thank you so much for your help guys :kaopride:

Problem_Solved!.jpg

Problem_Solved_Event!.jpg

Managed to get it to work!
 

Lord Vectra

Master Eventer
Veteran
Joined
Dec 6, 2015
Messages
212
Reaction score
336
First Language
English
Primarily Uses
RMVXA
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 Threads

Latest Posts

Latest Profile Posts

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...
x778xt8.jpg

Still haven0t found a colouring style that I like :kaoswt:
woods.pngshop.jpgboss.jpgRoom.png

Mapping is becoming so much easier!
FirestormNeos wrote on Neikoku's profile.
the cat in your profile picture is adorable

Forum statistics

Threads
111,434
Messages
1,061,105
Members
144,803
Latest member
NoWareCo
Top