How do i get % out of a number for HP

0 favourites
  • 7 posts
From the Asset Store
Jump on numbers in the proper order and reach the sun!
  • hi guys im triying to get the % out of a variable "hp" to variable "max hp" and set it to a variable "% of hp"

    im doing this

    set variable "%_of hp" to

    HP / MAX_HP * 100

    but it does not seems to work...

    can you please helps me???

    see the image below...

  • Everything seems ok, unless Hp and MaxHP aren't number variables, there's no reason it wouldn't work.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Everything seems ok, unless Hp and MaxHP aren't number variables, there's no reason it wouldn't work.

    they are numbers....

  • What type of variable is Percent_of_HP? Is it a number variable? You may also want to try rounding or doing abs to see if that helps get you a result as well.

  • sorry. i figure it out...i had a separate event screwing up the event about the % and my textbox was showing fake info thanks a lot to both of you guys...

    i feel silly now.

  • sorry. i figure it out...i had a separate event screwing up the event about the % and my textbox was showing fake info thanks a lot to both of you guys...

    i feel silly now.

    Mistake happens to everyone^^

    For the future you might want to try to use the debugger to check the true value of the variable, to see if it is correct

  • > sorry. i figure it out...i had a separate event screwing up the event about the % and my textbox was showing fake info thanks a lot to both of you guys...

    >

    > i feel silly now.

    >

    Mistake happens to everyone^^

    For the future you might want to try to use the debugger to check the true value of the variable, to see if it is correct

    =) thanks...thats a good tip

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)