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,353
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,321
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


Swag collecting in the new randomly generated area. Now the mini map also shows the randomly generated features... And even illustrates the whole "bubble" system" that I made to manage memory... Though that part's inadvertent. We'll just call that "the fog of war"... Yes, that's what we'll do. Nobody will be the wiser! :kaopride:
not me being not lazy for 5 seconds and drawing another char portrait (her name is hazel)
its_hazel.png
Been a while since the last time I made a song remix. Had a blast making this
One thing those jp developer still get wrong about boob physic is that... men's muscly hard pecs can jiggle too.
Definitely glad I haven't released a few of my plugins that are technically done. As I learn more, I find ways to make my code more efficient, and in one case so far, discovered an existing function that did EXACTLY what I created my own function to do.

Forum statistics

Threads
110,453
Messages
1,053,426
Members
143,541
Latest member
Neikoku
Top