Player Health and Damage system being multiple blueprints

I’ve been searching on these few systems for the past 14 days and I have utterly confused myself beyond repair. I’m not even sure what I should ask here.

I know there are ten thousand threads about the Player Health and an additional ten thousand on causing damage to the player. Everyone I’ve tried to follow has failed with one error or another while compiling. I probably should have saved a couple to ask but got frustrated and deleted it and restarted.

I will have no UI for a health bar, only thing that I’m hoping to do is have a material popup on the UI covering the screen. The player is either alive or they are dead. There is no in between. Which, I think, is throwing me off on understanding the other threads about health systems. Could someone link me a thread, blog or video with a basic health system.

Damage System:

I have 2 meshes, each one I’ve created a BP for. Both of these meshes will cause instant death to the player, again there is no in between for alive and dead.

I have 9 levels created and I would like to do as little BP’ing as possible with these meshes. So I created a BP for the meshes and would like to have the damage system in the BP for the mesh… Does this make sense to do this?

The meshes will be used numerous times in each level.

Again, with the amount of searching, reading and watching I’ve done, I’ve confused myself with damaging the player.Again, Could someone link me a thread, blog or video with a basic damage system.

I really do hate having to bring up another thread, but out of the two dozen or more things I’ve tried I haven’t gotten anything to work correctly. Maybe it’s just a bad month for me to try to learn something new, who knows.

Anyway, any help would be highly appreciated for my confused brain.

If you need to know something, I’ll do my best at getting that info for you, I’m still learning the layout and what everything does in UE4. :slight_smile:

Edit:
slight typo and:
I forgot to mention, this is a 3D Side Scroller with Starter Content.

make a blueprint out of the spike, add a collision shaped, e.g. a box and then click the green + box in the bottom of details called OnBeginOverlap, make that one call the player function killme after casting.

How is your damage dealing implemented? Is it when, player punches your enemy? or shoots at the enemy? how?

There is technically no other enemies other than saw blades and spikes. It will be onActorOverlap I think. As stated I am looking for a damage BP as well as the health BP.

If needed, I can take screenshots of what little I have, which is to say it’s not much, as I’ve gotten frustrated and deleted most of it when it didn’t work after multiple tries.

So if i understand this right, you have traps and it will damage your player, right?

yes, Instant death. Nothing more, nothing less. Health is either 100% or it’s 0%

Try this:

Player BP

  1. Create a function that will cover the damage, for example: “KillMe”
  2. Then, just add a Print in this function to test if we are able to call it

TrapBP

  1. add a collision component then try the BP below:
  2. OnActorBeginOverlap → Cast to PlayerBP → Call function: KillMe

I’m not sure I understand what you mean by “add a collision component” is that the normal collision that I made through UE4?

you need to create an actor, a BP for your trap as well.

consider this like your player BP but you used the spike mesh instead

I don’t think I’m doing this right…

I didn’t see “OnActorBeginOverlap” in the collision box Details.

Heres the PlayerBP KillMe variable

On testing, nothing happened.

I’ve been at this all day. I’m going to go to bed, its past 4am. I’ll continue this in the morning. Thank you, both, for the help so far :slight_smile:

You missed the part were KillMe is a function. :slight_smile:

Here is documentation for creating functions. It goes into detail explaining all settings for functions. You should be able to use the default settings and create a basic function without input or output variables.

Hi man , i know its quite confusing , keep it up.
Here a simple one.!
Actor trap- nothing but a collision box.
Actor rock- sphere with physics enabled.

Trap check for the actor who enter in his collision , overlapping. and if is the rock , it will do some damage…
rockz , just fall and when touch the trap get his life damaged. if is 0 , the rock destroy herself.

Hope this help you understand the basics.
Once you get it , you can add custom mesh at the traps !
alt text

okay, went back through it and this is what I have. Still nothing seems to happen? :expressionless:
Kill Me Function: https://i.imgur.com/FHojXEX.png
Spikes BP: https://i.imgur.com/aIbA7cx.png

I’m sorry, it just takes me a lot of effort to learn something. I’m a visual learner, so the documentation does help a bit but video/images/real-time viewing is much easier. I’ll get it sooner or later.

Hello DSoS,

As you wish to have a system where life and death are binary, either one or the other, having a health/damage system is entirely unneeded. Here is a quick setup of how to do what you’re looking to do.

First, this is based off the Third Person Character template in 4.10.1

With this setup, we’ll keep it as simple as possible so when the character is “Dead” it’ll be immediately destroyed and disappear. First you’ll need to create a new blueprint of the Actor type. Once you do that, add a “Static Mesh” component and apply whatever mesh you wish. After that, navigate to the “Collision” section of the details panel while still selected on the Mesh and set the “Collision Presets” to “OverlapAll”. This allows us to pass through the mesh and use overlap events.

After that, all you need to do is add these nodes. You can add the event by selecting the Static Mesh in the Components tab and then right-clicking in the graph. It’ll be located under “Add Event for Static Mesh > Collision”.

Compile the blueprint, place the blueprint in your level and you’re good to go. As soon as you touch the mesh, the character should be destroyed. If you wish to do anything else to your character after it is “killed”, just replace the Destroy Actor node with whatever you wish to do.

Hope this helps!

ooh, that worked. :smiley:

Thank You everyone!

The Destroy Actor completely removes the player, correct?

How can I make the actor be impaled on those spikes, preferably at the location where it was hit, and have the body go limp and just hang until the level resets?

Yes, Destroy Actor gets rid of the entire actor. The impaling would be much more complicated than this particular set up but you could do a slightly different version fairly easily. It would involve setting “Simulate Physics” on your Skeletal Mesh and setting it to only collide with the floor but not the spikes. That would cause it seem like the character is impaled on them. To do this however, the skeletal mesh will need a Physics Asset assigned and you’ll need to learn how to use Collision Channels. You can find more information about those here: