How to modify a variable using an equation in script editor

So I want to make a Thievery roll to decide how many items the player is going to potentially steal based off of their thief level.

I would like to make a variable store the result of an equation, any suggestions / tutorials?

example using code that isnt real:

variable Thievery Roll = thief level divided by (my set number)

note in the above example thief level is a variable and my set number is a variable i can adjust for balancing the item gain and scaling into late game. the result of the equation would be stored in the roll and it would have to be able to reset every time i called the code.

also explaining why the code works would be nice as Im trying to learn to script in RGSS3 but this isnt required.

leave the name you want to be credited as for the script. thanks in advanced.

I hope this made sense lol....
You can do this just by using the control variables command a bunch of times.


So thief level is a variable, your set number is a variable, and the roll is a variable. Divide thief level by the set number variable, and then set the roll variable to the thief level variable.
yeah i know i could do it that way, I just wanted to see what it looked like in code 🙁 . Thanks for replying though I always appreciate people helping!
$game_variables[1] = 5 would set the value of variable 1 to 5.
ah i see, I would have to inherit the Game_Variables class right? also thanks for replying 🙂

also cool scripts, mind if i look through them and see if i cant pick them apart. Im a complete noob trying to learn RGSS3.
No you can access $game_variables directly.
Alright, thanks a lot! Im going to have this thread closed seeing as it was very well answered by you.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-modify-a-variable-using-an-equation-in-script-editor.16272/