Health+Shield issues when taking damage

So I have this current setup when I taken damage it first deals damage to my Barrier/EnergyShield (second lifebar) - Then after all of this it’s going for my Health, and it all works correctly and takes away my Barrier before Health. But once it breaks the Barrier is deals the same amount to my Health, it doesn’t “transition”

For example if I have 300Barrier left, and 1000HP. And a hit deals 500damage, it will chip away that 300Barrier, and still deal 500damage to my Health leaving me at 500, when it should be 700

To the right of this Image is simply when my HP variables comes into play, it’s essentially the same as here. Just for “Current Health” instead. But how do I make the variables understand to transition like I want it to?

“Note that this current setup is most likely really bad, I am extremely new to this so I apologize if your eyes hurt from this”

Thanks!

You are not updating the RemainingDamage variable. There are many ways around this but what I would do is something like:

int DamageToInflict = Min(RemainingDamage, Barrier).

Barrier = Barrier - DamageToInflict.

RemainingDamage = RemainingDamage - DamageToInflict.

Then do your Barrier <= 0 check stuff.

This approach is also a lot simpler than the approach you did. No need to do so much branching.

Edit: I was just really not thinking, it’s all fixed now. Thanks a lot for your help!

‘Barrier =‘ would be ‘Set Barrier’ in Blueprint in case you didn’t figure it out.