Random Damage Money attack

ookami_lord

Best Lemon in the world
Veteran
Joined
Dec 5, 2013
Messages
88
Reaction score
15
First Language
portuguese
Primarily Uses
N/A
Hello Community! Yet another question!

I need some help making a certain skill.

So, my character has a skill wich does from 0-9999 damage to all enemies and spends that much money, subtracting it from your pocket.

I also wanted it to say something like "You don't have enough money!", when it's higher than what you have, rendering the skill useless.

I know this must be made with variables but I really suck working with those. :(

Any help aprecciated, and please tell me if this isn't enough info.
 

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
This is a little different from what you asked, hope it helps anyway, you could put this in the skill damage formula 

if $game_party.gold > 10000; rand(10000); else; rand($game_party.gold); end;and then call a common event to remove a random quantity of money, maybe based on a percentage (I don't know how to set it to the exact damage you dealt with the skill  >_>  , hope someone can help you with this)

In the common event put this script(substitute variable_id with a free variable index):

$game_variables[variable_id] = rand($game_party.gold/10) + $game_party.gold/100$game_party.gain_gold(-$game_variables[variable_id])if $game_variables[variable_id] > 0$game_message.add("You lost \\V[variable_id] gold")endThis would remove a random value between 1% and 10% of your total gold, if someone knows what is the script call for the exact damage inflicted write it instead of "rand($game_party.gold/10) + $game_party.gold/100"
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I think I'd use something like this as the damage formula:

m = rand(10000).to_i; if $game_party.gold >= m; $game_party.gold -= m; else; m = 0; end; mYou could also push a message to the battle log that the player doesn't have enough money but it requires scripting outside of the formula (and inside the Script Editor).

I rather like Eat's idea of simply not letting it pick a damage number that's bigger than your current gold; here's a formula that would implement it:

m = [rand(10000).to_i, $game_party.gold].min; $game_party.gold -= m; mAs a cute little sidenote, in one of my games ("How Badly") there is a merchant enemy that uses a similar attack, damaging you for a highly variable amount.  When they use this skill, your characters gain a skill called "Pick Up The Money" that lets you use your turn to collect the money they threw at you, gaining an amount of Gold proportional to the damage their attack did!
 
Last edited by a moderator:

ookami_lord

Best Lemon in the world
Veteran
Joined
Dec 5, 2013
Messages
88
Reaction score
15
First Language
portuguese
Primarily Uses
N/A
The common event works and the formula for the variable.

If I use Wavelenghts formula, It says the value of gold lost but doesn't do actual damage and if I have o gold they say a float number like 0.493848374, etc.

But thanks anyway :)

EDIT:

If I use EatYourBeetS formula, it will do damage but the message will say another value.
 
Last edited by a moderator:

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
Ok I got it, put this in the damage formula (choose a free variable id)

if $game_party.gold > 10000; v[id]=rand(10000); else; v[id]=rand($game_party.gold); end; v[id];and this in the common event:

$game_party.gain_gold(-$game_variables[id])if $game_variables[id] > 0$game_message.add("You lost \\V[id] gold")endTell me if it works!
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I think I'd use something like this as the damage formula:

m = rand(10000).to_i; if $game_party.gold >= m; $game_party.gold -= m; else; m = 0; end; mYou could also push a message to the battle log that the player doesn't have enough money but it requires scripting outside of the formula (and inside the Script Editor).

I rather like Eat's idea of simply not letting it pick a damage number that's bigger than your current gold; here's a formula that would implement it:

m = [rand(10000).to_i, $game_party.gold].min; $game_party.gold -= m; m
If I use Wavelenghts formula, It says the value of gold lost but doesn't do actual damage and if I have o gold they say a float number like 0.493848374, etc.
But thanks anyway :)
Are you sure you put the last m in there?  That would be my best guess for why you're getting gold loss but zero damage.

And I think the float is because you had created a float value for gold with one of your other tries to make this work.  It shouldn't happen on a clean file.
 
Last edited by a moderator:

ookami_lord

Best Lemon in the world
Veteran
Joined
Dec 5, 2013
Messages
88
Reaction score
15
First Language
portuguese
Primarily Uses
N/A
Are you sure you put the last m in there?  That would be my best guess for why you're getting gold loss but zero damage.

And I think the float is because you had created a float value for gold with one of your other tries to make this work.  It shouldn't happen on a clean file.
Yes, I've put it in order but it still says no damage, even on a clean project. Maybe I'm doing it wrong?

Ok I got it, put this in the damage formula (choose a free variable id)

if $game_party.gold > 10000; v[id]=rand(10000); else; v[id]=rand($game_party.gold); end; v[id];and this in the common event:

$game_party.gain_gold(-$game_variables[id])if $game_variables[id] > 0$game_message.add("You lost \\V[id] gold")endTell me if it works!
It works altought the float number is still zero, but the player will never have 0 gold(I think...-_-')

I think this can be closed now!

Thanks for the help!
 

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,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top