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.

Rounding up atack power

Currently, for critical hits, I use the default (2x). However, for some reason or another, certain times the critical hit will result in a decimal (For example, 4416.6). Is there any way to get it to "round up" the number or something?
 
I've never had this happen with the default battle system, but this should fix it:

Code:
if self.damage.is_a?(Numeric)
     self.damage = self.damage.round
end

Go to the Game_Battler 3 script page, and place this above the "return true" in attack_effect and the "return effective" in skill_effect and item_effect.

This will round the damage to the nearest integer. If you would rather it round up replace "round" with "ceil". "floor" will round the number down.

Hope this fixes it :)
 

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