Steal Gold from players (Enemy Skill or DMG formula)

Hi there!  BD

I'm trying to find a way to make certain enemies able to steal gold from players. (They don't need to keep it, I only need the player to lose 10 or 20 % of his/her money)

This would create a "stealing paranoia" that would push players to use the bank.

I've been doing well with other people scripts but this one, I cannot find. 

Any help?

Thanks in advance!  🙂
This would help in the future.
http://forums.rpgmakerweb.com/index.php?/topic/25759-script-call-collection-for-vxace/#entry247427

 

$game_party.lose_gold(amount)Where 'amount' is the amount of gold lost. Just add it to your damage formula.
 

This would help in the future.
http://forums.rpgmakerweb.com/index.php?/topic/25759-script-call-collection-for-vxace/#entry247427

 

$game_party.lose_gold(amount)
Where 'amount' is the amount of gold lost. Just add it to your damage formula.


 
Thanks a lot for the quick reply!

I saw something similar, but is amount based and I need to steal, for example, 20% of the player's current gold, not a fixed amount.

Is there any way to do that?

Thanks again 🙂  
If I had to guess, it'd be something like: x = $game_party.gold ; x *= 0.2 ; $game_party.lose_gold(x), but I can't really test it right now.
Ok It works but only if It does damage to HP or MP or absorbs or recovers HP or MP.

If "type" is "none", the skill won't work.

The thing is that it does very high damage or absorption compared to a normal attack (Like 2000% more) and that is not convenient at all. I suppose that damage dealt is based on the amount of gold stolen but it doesn't look that way.

I'd like this skill to only steal gold, not to do any damage unless that damage is a fixed amount like 1 HP that wouldn't be any problem. 

Hope this is understandable (I'm from Spain x) )

Thanks again for the effort 🙂

[IMG]http://s10.postimg.org/nhfogzel5/2015_07_04_12_53_15.png[/IMG]
Does this formula need  .to_i  so that it doesn't take gold to decimal points?

Just a thought about the amount of damage.

Would it help to add a state instead of doing damage?  You could make a blank state called 'Robbed' for example.  Then the formula might look like this (not tested as I don't have access to Ace at the moment).  I've given that state the fictitious id of 67

x = $game_party.gold; x *=0.2; $game_party.lose_gold(x); b.add_state(67)

Not sure if it should be this (I never know about 'end' until I've tested).

x = $game_party.gold; x *=0.2; $game_party.lose_gold(x); end; b.add_state(67)
I didn't expect it to deal damage. Interesting. There's an easy fix though. Just add 1 or 0 to the end of the formula to deal 1 or no damage respectively.
 

x = $game_party.gold ; x *= 0.2 ; $game_party.lose_gold(x); 0

Edit: ksjp17's suggestion of adding a state would probably work as well.
I didn't expect it to deal damage. Interesting. There's an easy fix though. Just add 1 or 0 to the end of the formula to deal 1 or no damage respectively.

x = $game_party.gold ; x *= 0.2 ; $game_party.lose_gold(x); 0

Edit: ksjp17's suggestion of adding a state would probably work as well.
This is working fine! Thanks a lot!  😀   🤘  

On the other hand, I find the suggestion from ksjp17 very interesting and I'll use the state advice in other situations, it'll be useful ^^

How would the formula x = $game_party.gold ; x *= 0.2 ; $game_party.lose_gold(x); 0 be if i don't want player's gold to have decimals? That would fulfill my request completely  😀  

Thanks a lot guys, you're awesome!
The damage dealt is ALWAYS the last number processed in the damage formula - that's why it's called damage formula after all...

If you want to add other effects, you have to make sure to end the formula with the damage you want to be dealt to the target - that's what the

; 0is about - the semicolon to tell the processing that a new command follows, and the zero for the intended damage - if you replace the zero with other formulae it'll deal that damage in addition to whatever the first commands did.
The damage dealt is ALWAYS the last number processed in the damage formula - that's why it's called damage formula after all...

If you want to add other effects, you have to make sure to end the formula with the damage you want to be dealt to the target - that's what the

; 0is about - the semicolon to tell the processing that a new command follows, and the zero for the intended damage - if you replace the zero with other formulae it'll deal that damage in addition to whatever the first commands did.
Thanks for the minitutorial ^^ Now things are clearer 😉
This is working fine! Thanks a lot!  😀   🤘  

On the other hand, I find the suggestion from ksjp17 very interesting and I'll use the state advice in other situations, it'll be useful ^^

How would the formula x = $game_party.gold ; x *= 0.2 ; $game_party.lose_gold(x); 0 be if i don't want player's gold to have decimals? That would fulfill my request completely  😀  

Thanks a lot guys, you're awesome!
add .to_i to "x", so that the formula reads: x = $game_party.gold ; x *= 0.2 ; $game_party.lose_gold(x.to_i); 0 or maybe, (x.round.to_i).

It means 'to integer' which is basically a number without decimals.

If you wanted to convert something to a 'float', you'd use '.to_f', to get a number with decimals.
Converting to string works the same way '.to_s', for letters that are not variables.
 

That's the basic idea anyway.
add .to_i to "x", so that the formula reads: x = $game_party.gold ; x *= 0.2 ; $game_party.lose_gold(x.to_i); 0 or maybe, (x.round.to_i).

It means 'to integer' which is basically a number without decimals.

If you wanted to convert something to a 'float', you'd use '.to_f', to get a number with decimals.

Converting to string works the same way '.to_s', for letters that are not variables.

That's the basic idea anyway.
Working perfect 🙂

Thanks for the explanation and solution, that's just what I wanted. 

Have a nice day 😀

Original thread: https://forums.rpgmakerweb.com/threads/steal-gold-from-players-enemy-skill-or-dmg-formula.41880/