Steal Gold from players (Enemy Skill or DMG formula)

Dhaundre

Villager
Member
Joined
Jul 4, 2015
Messages
18
Reaction score
0
First Language
Spanish
Primarily Uses
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!  :)
 

Dhaundre

Villager
Member
Joined
Jul 4, 2015
Messages
18
Reaction score
0
First Language
Spanish
Primarily Uses

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Dhaundre

Villager
Member
Joined
Jul 4, 2015
Messages
18
Reaction score
0
First Language
Spanish
Primarily Uses
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 :)

 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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)
 
Last edited by a moderator:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Dhaundre

Villager
Member
Joined
Jul 4, 2015
Messages
18
Reaction score
0
First Language
Spanish
Primarily Uses
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!  :D   :rock-left:  

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  :D  

Thanks a lot guys, you're awesome!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
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.
 

Dhaundre

Villager
Member
Joined
Jul 4, 2015
Messages
18
Reaction score
0
First Language
Spanish
Primarily Uses
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 ;)
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
This is working fine! Thanks a lot!  :D   :rock-left:  

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  :D  

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.
 

Dhaundre

Villager
Member
Joined
Jul 4, 2015
Messages
18
Reaction score
0
First Language
Spanish
Primarily Uses
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 :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top