Health not going down

I am currently setting up the mechanics of my game and I made a cube that I named “lava” to test the health mechanic. It was working just fine but then it all of a sudden stopped. I made a print string blueprint to test if the damage was actually dealing and there was just something wrong with the health bar but when I printed the health variable it kept showing up 9 (the default value was 10) no matter how many times I stepped on the “lava.” Do you know what happened?

In the top right you can see the health bar is not going down and the print string keeps printing 9

The Damage dealt is at 1 so the health should be going down. I do not have any way to regain health yet.

Perhaps the problem is in the receiving end of the damage. Can you show us how the player is getting the damage and calculating the health.

Here are the blueprints for the character receiving the damage.

Try connecting a “Print String” directly to the Damage pin to see if it receives 1.0f or 0.0f.

Also, does the lava work? I mean, is the lava logic (branches, cast, …) working?

I tested your script and everything works ok. The only logical possibility is that somewhere, your the Health variable is constantly being set to 10.

Check your character and the health widget, to be sure, health is not being changed.

Oh, thanks. I found that on event tick it would set health to the max health variable which was supposed to make it so you could expand your health. It kept setting health to 10 every tick.
It was supposed to be on event begin play but once I added a main menu I changed the create widget to event tick but I accidentally also moved over the set health to max health. Thank you!

Health is going down!

It keeps printing 1.0

With both print strings it shows it is dealing 1 damage but the health is staying at 9

I added a print string to the lava part to see if the damage was being dealt and if the branches were working as you asked, and it kept printing 1.0.

I also added a print string to the cast failed that said cast failed and there is no string popping up that says cast failed.

Perhaps it might be helpful if you first decouple your testing and create a simple function (maybe just directly inside your player BP) which degrades your health by a given amount.

And then see if that works. If that works, recheck the code that triggers health-degradation in your context (l assume your lava object degrades the health variable)

Also one thing… nothing changes suddenly without you changing something. Perhaps you saved an asset in-between your test-runs and made a slight change there.

So yeah, basically take your problem out of your world and object context, seperate your tests and then put the components you now know work in isolation back together and check if your “glue” between those components work as intended. This way you can quickly remove any outside noise that could be created by any kinds of things.

Let us know what the problem was and if this approached helped you. Cheers