Sorry Guys for the frequent code related questions I'm learning!
I was wondering if there was a way to do something when a variable increases;
e.g;
if $game_variables[1] Increases then # something happensendIs this possible?
If variable increases
● ARCHIVED · READ-ONLY
-
-
You COULD add a new line at the start of the Game_Variable class's []= method, to say if variable_id == 1 and value > @data[variable_id] then do something.
But that's messy.
A better way would be to store the value in a variable belonging to your class, then in the update method, see if the value of the variable is greater than the value you have stored away. If it is, do something. Then whether it's greater or not, store the value away again (assuming your variable can also decrease, you want to store the lower value too, so when it goes up you'll notice it straight away). -
I see... I'll play with this. Thanks
-
Personally, since the variable increase is controlled by you anyways, I'd just do the things that needs to be done right after I increased the variable.
-
See, I KNEW there was a simple answer for this. Today is just not my day ;)
-
I'm still trying to think of a situation where that is not possible to do... well, maybe only if a player modifies the values via a hacking tool...