Variable in a formula from a plugin?

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
Hi ;0


I'm not sure how I would ask this, but here goes.


I'm using a formula for my encounter steps, but I cannot seem to know how I can set a number based on a variable.


Example: ((Math.randomInt(encounterStep) + Math.randomInt(encounterStep)) / 2) * (($gameVariables.53 / 10) + 1) + $gameVariables.52


What would I need to change?


Thanks and please post anything that could help me solve this problem!
 
Last edited by a moderator:

standardplayer

Keeper of Kitties
Veteran
Joined
Apr 6, 2016
Messages
698
Reaction score
3,451
First Language
English
Primarily Uses
N/A
use $gameVariables.value(x) where x is the variable


to set one, use $gameVariables.setValue(x, y) where x is the variable and y is the value
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
So with this, it should replace the variable #53 by it's current number, right?
 

standardplayer

Keeper of Kitties
Veteran
Joined
Apr 6, 2016
Messages
698
Reaction score
3,451
First Language
English
Primarily Uses
N/A
if you use $gameVariables.value(53)  in a call, like in the one up above for example, then it's using the value in that variable as the number for the calculation. 


so if I did $gameVariables.setValue(1, $gameVariables.value(2) + 1)


if variable 1 started as 0, and variable 2 was '5' before the calculation, then variable 1 would wind up being 6. 


.setValue asks for 2 arguments, the first being the variable, the second being the assignment. As you can see, you can do the math right inside of the argument like I did in the example above. 


.value is just passing value of the variable in the argument in place of the call. So if variable 2 has a value of 6, $gameVariables.value(2) is like saying '6'. 


I really hope this clears it up
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top