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.

[Resolved] percentage of exp

bukai

Member

l'm trying to display the reached amount of experience for the next level in %
above a gauge in menustatus.
Code:
 s1 = actor.exp_s
s2 = actor.next_rest_exp_s
percent = (s1 / s2) * 100
and then draw_text percent..
it always says 0%.

please help.
 
I remember having similiar problem once. I haven't done RGSS scripting in a long time, so I can't say anything about your syntax, etc. But I guess the main problem is that s1 and s2 are integers and when you divide them, they are rounded to zero before multiplied by 100 and thus the result is always 0. I think you need to convert them to floating point values before dividing them.

My explanation kinda sucked, but I hope you get the general idea...
 

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