Download

Lose health when colliding with enemies

I’ve been trying to set this up but haven’t had much luck. Does anyone know how to make the player lose health (shown using UMG) when they collide with an enemy?

You need to create a variable in your character blueprint. ie called Health and make it a float.
and then create a custom event in the same blueprint connect that your amount to reduce your health by…
then in umg set up your text function to read from your characters health variable by casting to your player character.
And then for it for to be effected by the enemy. set the enemy to fire the custom event you already created in your character(cast again) and pass on the amount you want to minus from your health…

if you need more help, and screenshot. post what you have done so far, so i can suggest what steps you need to do.

Here’s some screenshots of what I’ve got so far.

Character health BP

Health UMG

Enemy BP

Hello,
Use a “Event hit”. From the “other” output drag a wire “cast to” the blueprint you want to do damage". Set “health” = “health” minus “damage”. (collision need to be block)