Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Money Multiplication Skill

I'm having trouble with this snippet of code that shouldn't be so frustrating.
I created a skill that does damage to the player in exchange for more money after the battle. I linked it to a common event turning switch #1 on, and added this snippet of code:
Code:
if $game_switches[1]=1
gold *=1.4
gold.round
end
just above $game_party.gain_gold(gold) in Scene_Battle 2 (line 179). It multiplies the amount of gold you get, but it doesn't round, so I get 252.4 gold, or whatever, after the battle. Even if I don't use the skill, it gives me 100.0 gold. I also tried gold.truncate instead of gold.round, which doesn't help. What am I doing wrong?
 
I myself have the opposite problem, I want decimals, but it seems to be coming from the fact that I use variables.
So as a weaker solution you could say
$game_variables[xxxx] = gold
if $game_switches[1] == 1
$game_variables[xxxx] *= 1.4
end
then make gold = to $game_variables[xxxx] however you're already doing it.

PS
If you put " = " and not " == " for your 'if' statement. (one equal sign instead of two) you're not gonna be getting problems.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top