So there's kind of a lot wrong there, to my reading.
Well, of course. You're not giving variable 163 any value until the common event that happens after the skill. So the first time you try to use it, 163 is undefined and causes all math involving it to automatically fail.
So what if I run the common event in the troop events on a turn-by-turn basis... so the variable is always loaded with the most up-to-date info? I'll experiment... Thanks.
Aside from that, here are things that are weird to me:
How much gold does your party have? And therefore what value is actually getting stored in variable 163? If it's a high number, you could essentially end up overloading your skill trying to queue up a ton of targets.
The script actually takes the amount of gold the party currently has [Variable 164] and multiplies it by 5% which is essentially dividing by 20, as you said, and then storing that information in variable 163. I then take that info from Variable 163 and ADD it to Variable 166 Since My monster's GOLD reward Value is controlled by that Variable.
Also, depending on the amount of GOLD the party has I want the monster to be a little on the harder side. The enemy is like a special boss, someone you don't have to fight. I'll have him appear in special areas throughout my game and the trick will always be... The enemy is easier if you broke.
And he's made of GOLD so he gives huge Gold Rewards...
Also, there's a very good chance 163 is a decimal value (which won't affect the code I gave you, as i increments in integers, but it could be an undesired result).
In my tests, the value always came back as an integer and never a decimal so I'm not too worried about that. If it does start giving decimals, I add Math.floor to the Script call... which usually fixes the problem.
Why are you using two variables for this at all?
Why are you using a script call for this?
This can easily be done using one variable and two event commands.
Control Variable -> 164 = Gold
Control Variable -> 164 Div 20
This is a good point... But really I have two skills that use the Party's GOLD Value. I have the other skill pull from Variable 165 while this skill pulls from Variable 163. They have different values because they have different formulas for each.
.Why I used a script call is because the Control Variable command can get cumbersome. I could use the Script option in the Control Variable Command, but that's basically the same as what I did here... I don't know, it's just how I've always done it.
Why bother setting your variables to 0 at the end of everything?
I'm just not really following your logic.
I set certain Variables to 0 at the end in order to start fresh when it's used again. I just don't want any leftovers messing with my numbers and such. The only variable changed to 0 is the Party's Gold Variable, so when the variable tries to find the value again it's not adding it to a value unless that value is 0... It's a paranoia thing... I guess. I just remember in earlier maker programs that I had issues with that and so I have kind of gotten into the habit of clearing the values like that.
Thank you so much for the help... I'll try something out and let you know how they work.
EDIT: With a little adjusting it works great.... for the most part. just got to fix a few hang-ups
EDIT2: Tweaks done.... it works exactly as I want. Thank you so much for the help.