Simple Player Killed by Actor / Static Mesh Help

I have looked around and found some stuff on setting up an Actor / Static mesh to kill the player but none of it seems to work for me. I was wondering if someone could help me out with this?

I’m working on a 3d Sidescroller, and I just want to get some moveable actors / static mesh to kill the player when they touch/collide. So here is what I set up:

1.) An actor Blueprint with static mesh component added inside for the thing the player would collide with.
2.) Event graph for this object - OnActorBeginOverlap_Event - plugged into - Cast To SideScrollerCharacter - and that’s plugged into Apply Damage with a Base Damage of 500
3.) Static Mesh Collision is set to OverlapAll - Simulation Generates Hit Event Checked - Generate overlap events checked
4.) SideScrollerCharacter - Health set to 50 ( so I’m assuming the 500 in apply damage would take care of all the player hitpoints)

Is this all I should have to do? or am I missing something? When I run the level, I’m not getting any pulsing line inside the blueprint window, so I’m assuming something a miss.

I tried placing a Event Destroyed - plugged into a Destroy Actor in the SideScrollerCharacter blueprint, but that didn’t work.

I am new to Unreal 4 and Blueprint.

Any help would be appreciated.

thanks!

Event Destroyed is called after Destroy Actor to give you the chance to do something befor hes being destroyed.
Show us your blueprints, its easier to see what you did :slight_smile:
Edit : Best way to find out yourself, use “Print String” to see what is happening, when is it happening and is it happening at all? (You should know what to compare!)

You have quite a few “moving” parts already, and it might be good idea to check each individual piece of the puzzle with e.g. Print String nodes…

Let’s take your point 1 as an example. If you have a blueprint in your level, and it has a static mesh component with some sort of collision (either on the static mesh, or a separate collision shape), you could check whether overlapping events are triggered / registered by plugging “Event ActorBeginOverlap” into a Print String node, and see whether the default “Hello” is printed to the screen when your player starts overlapping the blueprint (actor).

If that works, you could start debugging the subsequent points on your list.

I kind of figured that about the “Event Destroyed” but the post I found talking about it, It was using a Destroy component, but I couldn’t find it when searching for one.

So here is what I have set up.

I know the static mesh has collision, because the player will step up on it if I set it to BlockAll in the collision dropdown. The player is a Pawn, and collides with the world so I’m assuming that is all set up to handle overlap.

I added a Variable called Health and gave it a number of 50, but maybe I don’t have set up right? But in general, I don’t think the player is knowing when its colliding with something. That would be my guess, so I think I don’t have this set up right?

Anyway, thanks for your replies. Appreciated.

I haven’t tried the print screen module yet, Ill look into it right now, I just don’t know how to set it up yet.

Update: I changed the “Destroyed” to a custom “Destroy” event in the player character blueprint. I just now figured out that this example I found was using a Custom Event module, so now its setup like that example, but it still doesn’t work.

Just showing that its been updated… thanks

b2fbc2d61534bebe9f3216e7c0f6b76f4f10aee2.jpeg

I dont use “Apply Damage” since i write my own functions for damage but i think you need to override the event “AnyDamage” and subtract the dmg from your HP and check if its <= 0 or clamp it between max and 0.
If so you call your Destroy event.

well its based off this post

I think there is a disjoint where I am telling it to “damage” where in this example the Actor is set up with a “Destroy” function but I could not find that module anywhere. Does this Destroy/Target still exist and I just don’t know how to set it up?

I see what you are saying, but unfortunately I’m just barely wrapping my head around the blueprint system. Could you explain to me how this would be set up?

My apologies for asking more of your time. I’m just learning the system.

thanks!

OK Got it!!!

On the Actor, I was using a “OnActorBeginOverlapEvent_0” instead of hooking it up to the “Event ActorBeginOverlap” that came with the Actor BluePrint when it was created. I changed the “Apply Damage” Module with “DestroyActor” and the end of the chain and it worked, killing the player dead.

So in the end, this is what I ended up with:

Actor doing the damage blueprint

Player Character blueprint

And I think this completely bypasses the player health and just kills the player with the destroy function. I just wanted to post what the final result was with BP images in case someone else wanted to know the same thing. The post I got this from works, I just had to change the Destroy function that I couldn’t find to DestroyActor.

Thanks for responding and helping me out with this!!! Appreciated. :slight_smile:

Thats what you created yourself.
You can call it in your CharacterBP or with a reference of an object of this class.
Right click in your Character BP OR drag out the object pin (the blue) after CastToSideScrollerCharacter and search for “Destroy” OR press on the arrow of EventGraph (on the left) to see all the Events.
But please disconnect the node DestroyActor from Event Destroyed.

Edit: Im toooo slow :frowning: but im glad you made it! Looks like a solid start.

Thanks for your help Urm, you helped me walk through the process…big help. :slight_smile: