Charles2020

Veteran
Veteran
Joined
Feb 24, 2020
Messages
112
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,162
Reaction score
8,017
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,064
Reaction score
7,168
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 Profile Posts

SF_People1_3 added!
index.php

I haven't been on here in forever wow(missed my forum birthday T-T). Anyways, I'm dabbling in BGMs, here's something I'm actually willing to share.

Binge-watched 6 episodes of the Erased anime... And that means I've watched half of it?! Sigh...
I'm bad at base-building games (looking at other players created an aesthetically beautiful base compared to me), but IDK why I keep playing the game and seek more of it.

Forum statistics

Threads
109,201
Messages
1,042,993
Members
141,705
Latest member
Station
Top