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
590dcc3d678f5b895432c4930f5df03ffe130681.png

Health UMG
176e6c8a55fb13a2b5efdd5ceba5f27d1a3428c3.png

Enemy BP
6f1e67a9c5ce7bcc2ffe01813aa29f0ed698693e.jpeg

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)