How do i get % out of a number for HP

Get help using Construct 2

Post » Mon May 12, 2014 5:46 pm

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...
You do not have the required permissions to view the files attached to this post.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon May 12, 2014 5:58 pm

Everything seems ok, unless Hp and MaxHP aren't number variables, there's no reason it wouldn't work.
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Mon May 12, 2014 6:04 pm

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



they are numbers....
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon May 12, 2014 6:14 pm

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.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,603

Post » Mon May 12, 2014 6:16 pm

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

i feel silly now.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon May 12, 2014 6:18 pm

Lunatrap wrote:sorry. i figure it out...i had a separate event screwing up the event about the % and my textbox was showing fake info :D 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
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Tue May 13, 2014 7:44 pm

Aphrodite wrote:
Lunatrap wrote:sorry. i figure it out...i had a separate event screwing up the event about the % and my textbox was showing fake info :D 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 :)
B
23
S
6
G
3
Posts: 316
Reputation: 3,461


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests

cron