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.
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"
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!
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.
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!