How Do I Set Up A Basic Blueprint Health System For A Player?

I am currently trying to set up a very basic health system for my player, so that every 0.5 secs (delay) the player’s “Health” Int Variable will decrease by 20, (Default Int Value Of The Variable “Health” = 100). When the var “Health” is smaller or equal to (<=) 0, I want the player’s bool called “IsDead” to become True and to then print the string “Died.”

Please help me!

This is what I have at the moment, and it doesn’t work:

What exacly doesn’t work?

Also insted of using Tick use use Begin play and make looped circuit, here you got example, thru more complex then you need it. As you may know you can’t branch action outputs, you need to use sequence to branch it.

In your Branch node, I thought you have to have a condition. It looks like you dont. Does your blueprint not compile or something?

Wouldnt you just wanna get rid of.that first branch node??

Condition is dead varable, if its true it will show message

really if you are working with health and damage you shouldnt be checking it in tick as is saying. most of the time you use tick for something that needs to be kept tabs of constantly.

Now I know you might be thinking well health needs to be kept tabs of all the time and youre right and wrong in time sense. You only need to know what your health is when something HAPPENS to make it change.

So on this line of thinking you should use the ONTAKEANYDAMAGE to provide you with a check to when your health changes. Also if you are giving health its kinda the same thing.

Heres and example of a simple setup for health

so here you have a simple setup with one variable representing the health AIHEALTH which can be a float or int and whenever damage is detected it checks to see if the health is still above zero otherwise it destroys the actor.
Also it applys the damage to the actor by how much damage was received during that event.

1 Like

Thanks for the suggestions and feedback guys, I’ll set up your example DJMidKnight and tell you how things go, thanks again!

This is what I have set up, and When I apply damage, the player doesn’t die(destroy actor).

Well that’s easy you are trying to damage the SPAWNPOINT - PLAYERSTART and not the player. If this is a single player game you need to add in a GETPLAYER and then plug that into the damage actor on ApplyDamage

GOD BLESS YOU DJMID! <3

glad to help :slight_smile:

What do you mean when you say add a GETPLAYER?

1 Like

It means you need your character’s reference. If you have set a variable for this I think you could use it. Otherwise I guess the mesh component would work. I’m not sure though, cause Im still pretty new to unreal.