Enemy Gold Rewards to Variable?

Okay, last question for awhile, I promise.
Is there any way to get the gold reward value from enemy index numbers?


Basically, I'm wanting to, in battle, set/add/sub/etc. a gold reward to a variable.

Like for example:
Enemy in Index Position 0 has a Gold Reward of 100
So I want to add the enemy gold output of that Index to Variable X
$gameVariables.setValue(v, $gameTroop.members()[n].enemy().gold);


v is the Variable you want to set


n is the zero-based index of the enemy you want to get the "gold" property of (so for a 6-member enemy troop, the first member is 0 and the last member is 5)


From now on, ask questions like this in "learning JS", not "JS plugin support".
$gameTroop.members()[0].gold()
$gameVariables.setValue(v, $gameTroop.members()[n].enemy().gold);


v is the Variable you want to set


n is the zero-based index of the enemy you want to get the "gold" property of (so for a 6-member enemy troop, the first member is 0 and the last member is 5)


From now on, ask questions like this in "learning JS", not "JS plugin support".

Right, I was just a bit confused where to put it, so I put it here, but thanks.   😀

Original thread: https://forums.rpgmakerweb.com/threads/enemy-gold-rewards-to-variable.65420/