Question regarding Gold Rate script

Is there a way to save the party's total gold rate into a variable? I'm using this script from Hime, which modifies the gold acquired from battles, but I want to use it to affect the acquired gold from chests too, and for that, I need the gold rate in a variable.

Gold Rate script
Use Control Variables, and in the Script box, type $game_party.gold_rate

Note that with control variables, only integers are allowed, so if your gold rate is 1.5, it will be rounded down to 1.
Note that with control variables, only integers are allowed, so if your gold rate is 1.5, it will be rounded down to 1.
It won't, the variable value will not be modified by any code lines, and it can be anything (quite literally).

However, multiplying any number with a float value will result in a float value, so unless you want the party's gold amount to be displayed as 12549.6977, for example, call a to_i or round on the final gold value you want to add to the party.
So, in the control variable command, you should enter something like this:
Code:
(200 * $game_party.gold_rate).to_i
The 200 is the base value added, change that to whatever you want.
After this, you can use a regular change gold event command and use your variable there.
It won't, the variable value will not be modified by any code lines,

Ah, I'm thinking of MV, not Ace.
Thank you both for the help.

I want to use ''($game_variables[37] * $game_party.gold_rate).to_i'' in the control variable command, however, this won't fit there. Is there a way to make this shorter, so it will fit in that line?
If you want to keep the value in variable 37, use another variable as a temporary working variable - I'll use 38. It's a 3-step process.

Control Variables: var 38 = var 37
Control Variables: var 38 *= Script: $game_party.gold_rate
Control Variables: var 38 = Script: $game_variables[38].to_i

If you are setting variable 37 immediately before this, and don't need to keep the same value, just use the last 2 lines and use 37 instead of 38.
Thank you to both of you again, it worked like a charm 🙂

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/question-regarding-gold-rate-script.89871/