Charles2020

Veteran
Veteran
Joined
Feb 24, 2020
Messages
116
Reaction score
4
First Language
English
Primarily Uses
RMMV
Hi guys

I am trying to make a system that gold increase over time. I use Moghunter time system

So basically I assigned hour to variable id 1. I used this equation but did not work

If $gameVariables.value(1) == $gameVariables.value(1)+1;
do increase gold

For example, if 8am, variable ID 1 should be 8
When 9am, variable ID 1 should be 9 (which I hope go meet if condition), but I think my logic is incorrect

Any idea/suggests are welcome
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,350
Reaction score
8,080
First Language
German
Primarily Uses
RMMV
why are you trying to do things with javascript that are easier to do with event commands?
This is not the first time you asked something similar....

if you are trying to learn javascript, it is much easier if you forget about making a game like that while learning how to program - which would help you because your example shows that you don't know how computer logic works, that line can never be true.

and if you're just trying to make a game, then you should learn to use event commands first, and only switch to javascript if there are no event commands that can do that. Because the event system is designed to handle most of the simpler mechanics in any game...

that said, you need two different variables to handle that, because otherwise you'll always have it like "If 1 == 2" which will never be true.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,135
Reaction score
7,319
First Language
Indonesian
Primarily Uses
RMVXA
I used this equation but did not work
What you seek is not an equation, rather a system to track that the variable is changed.

The easiest way is to use the second variable.
For example,
Code:
If ($gameVariables.value(1) != $gameVariables.value(2)) {
  $gameVariables.setValue(2, $gameVariables.value(1))
  increase gold
}
 

Latest Threads

Latest Posts

Latest Profile Posts

When you spend hours working on an optional segment that players will only be in for 2 minutes in a single playthrough. That's the life right there.
I had a kernel panic crash on my current computer for the first time after trying out the latest update on a videogame. I think I'm going to wait until the next update before trying it again. This brought back memories of my old computer and laptop in their final days.
My mind is now broken. I just spent over an hour on this stupid issue.
Trying to get a skill to show text depending on enemy ID to show passives.
Well. I tried to call one passive 'Spirit's Way'. See a problem? No? Neither did I until now!
The apostrophe in "Spirit's" ended the text eval... no wonder I kept getting unexpected input errors...I think I'm gonna cry.
Anterograde Fantasy now has a demo build available!

You know you've been working on RPGMaker for a while when you go to move your projects to a 16 GB USB drive and get told not enough space to do this operation.

Forum statistics

Threads
110,443
Messages
1,053,342
Members
143,514
Latest member
92stars
Top