Counting down damage taken(resolved)

Get help using Construct 2

Post » Wed Dec 23, 2015 9:18 pm

Could be an obvious answer but I need some assistance with this counter. I have a player in an RPG taking damage, but rather than have the damage be simply taken off it counts down the damage to a new value.

So i've set it up like this, where CurrentHP is the current HP of the character and NewHP is a new value set by CurrentHP-Damage :

Every tick
While
Char1.CurrentHP > Char1.NewHP ------------ Set Char1.CurrentHP to Char1.CurrentHP-1


When set up like this it just takes off the damage amount and updates to show newHP, so it's half working but it hasn't counted down by 1 every tick. If i remove the While and the variable comparison then the HP does just count down by 1 every tick as I expect but then of course there are no limits, it just keeps counting down. This is why I put the newHP in place, to set a limit. Am i missing something obvious here as to why it won't count down by 1 every tick while the HP is greater than the new HP?
Last edited by plinkie on Thu Dec 24, 2015 12:22 am, edited 1 time in total.
B
45
S
14
G
70
Posts: 1,939
Reputation: 41,708

Post » Wed Dec 23, 2015 9:33 pm

Nevermind I fixed it by adding a different kind of variable comparison.

OnDamage ----------- SetNewHP to CurrentHP-Damage

Every tick
If StopDamage = 0 ------------- SetChar1.CurrentHP to Char1.CurrentHP - 1

If Char1.CurrentHP = Char1.NewHP ------------- StopDamage = 1
B
45
S
14
G
70
Posts: 1,939
Reputation: 41,708


Return to How do I....?

Who is online

Users browsing this forum: joliemoc, VulcanSpawnWolf, zenox98 and 2 guests