Damage with gold

I simply want to create a skill that can deal damage with the all of the gold the party has. Unfortunately, I can't figure out how to make the party's gold drop to 0(or the amount dropped by the previous enemy) after using the skill.

So far, the formula I have been using for the skill is as follows:

v[22] += -99999; $game_party.gold

Where variable 22 is set to equal the party's gold.

So any help would be greatly appreciated. Thank you
g = $game_party.gold; $game_party.gold = 0; g
Hmm, now it deals 0 damage 🤔 . Here's a screenshot of what I have at this moment:

[IMG]http://i.imgur.com/rkdnuST.png[/IMG]
You have g at the end of your damage formula?


Do you HAVE any gold prior to using the skill?


okay - found the problem. Small change required.

g = $game_party.gold; $game_party.lose_gold(g); g
$game_party.gold = 0 wasn't working as gold is an attr_reader and there's no gold= method. But there's a fail test around the damage formula calculation so it doesn't actually crash and tell you that $game_party.gold = isn't a valid command.
Yes and yes.

I have an event that gives the Player Gold from the start. I've set this event to delete itself afterwards, so I don't think that's the issue.
see my edit above.
Awesome! That did the trick. Thanks Shaz for helping me  🙂  

Original thread: https://forums.rpgmakerweb.com/threads/damage-with-gold.43940/