Enemy Skill advice

Greetings!

I'm looking for a little help with a skill for an enemy I'm tinkering around with. This encounter is going to be a greed demon/spirit, and I am trying to intially get the enemy to steal x amount of gold from the player, eventually I would like to have this be a percentage range. Being a demon/spirit of that vice genre, the enemy would gain attack power by the amount of gold stolen, this would also be a percentage based on the amount of gold stolen.

Loose example, 10% of gold is stolen, +10% attack power. 100% of gold stolen, +100% attack power.

I'm slowly learning Java, but yeah I'm no good at it to be able to figure things out. The best I could come up with for a random percentage is: Math.random();
Per my screenshot, I was attempting to define how much gold would be in inventory, multiply that by the percentage modifier then change gold by that amount. Text would show what that integer would be.
The attack modifier would have to be 1+Math.random();

At first I was getting a syntax error, but now it seems as though the flow works but gold doesn't change.

Anyways, thanks for any help you'd be able to provide
Screenshot-2017-05-19_18.37.13.jpg
Just to make sure, you're learning JavaScript, not Java right?
JavaScript, yes.
In your third line, you are multiplying Variable 3 (ostensibly 0) by Variable 2's value, then working with Variable 3 to do other stuff (like remove Gold from the party). Since 0 times any value is 0, Gold won't change. You'll need to set Variable 3 to Variable 1's value and THEN multiply it by Variable 2's value. (This also might not work because Math.rand() returns a float between 0 and 1 - I forget whether this will store as a float in Var 2, or instead store as the integer 0. If it doesn't work, just change your Variable 2 setting to (Math.rand(100) + 1) and then divide the final result of Variable 3 by 100 after calculating it (but before working with it).)
Here are two fixes. Fix 1 is with no javascript and the other is with some javascript.
No Java Script:
Screenshot (34).png


Some Java Script:
Screenshot (33).png
Thank you so much for your help! 🙏

Original thread: https://forums.rpgmakerweb.com/threads/enemy-skill-advice.78844/