Help: Damage system.

Hi

Just getting in to damage. I have tried YouTube for a simple to follow, how to apply damage to player if it is hit by a projectile. Not much luck without following a 1 hour TUT :slight_smile:

I can work out, that upon projectile hitting player, you remove X from health. Just not sure how to do it effectively.

Does anyone know where one is. I would not mind knowing radial damage as well, but that is optional.

help appreciated

I created a attribute called damage on my Projectile and then when I apply damage to the player I subtract the amount of the damage attribute for the projectile from the health attribute of the players.

Not in front of my Dev PC or I could show you my blueprints.

HI

Cheers, just pretend I am running the gauntlet and things are shooting from either side.

Just want to get damaged and die at the end.

Cheers

2 hours of looking at videos. Not one explains easily how to kill me or a bot.

Have you been able to detect when the projectile hits the player? For applying damage the following nodes will in handy: ApplyDamage and Event Any Damage.

In your project class, after hit something and detected that it was a character, call the function ApplyDamage (or ApplyPointDamage, ApplyRadialDamage) on the character.

Give the character a health variable and initial value > 0. In your character class, in your main event graph add an Event Any Damage node. This event is triggered on any damage including when ApplyDamage is called on this character. Use the incoming damage value to decrease the health variable like qdelpeche said.

Note that what should happen when a character dies (i.e. what dying means) is up to you to implement.
Should it be destroyed? Call DestroyActor.
Should it go ragdoll mode? Call SetSimulatePhysics on your character Mesh.
Should it respawn? Spawn a new character and let your controller Possess the new one.

I hope this helps.

Hi

Thanks for reply

This is where I get in to issues, how to detect hit. pulling that hit damage and applying it. + more

I need baby steps with damage, that s why I was hoping for a video.

As far as I can tell, in the projectile, use node apply damage and reference character. then in char, call event of damage node, remove X from health.

Still no idea how to do it. any pics?

Here is my blueprint.

Character Blueprint - Event Any Damage
Event Any Damage.png

Character Blueprint - On Damage (Custom Function)

In my last one I am just resetting the player health back to 100 … typically you would not do this. I hope this helps. 8-}

HI

At work, so not in front of machine.

But I added radial damage to My Projectile, and did what you have above.

Does not seem to work.

I know hard without screen shots, but would there be a reason for it?

I only saw your response now … I will need to check my blueprint from my projectile … but it was based on the normal FPS Template projectile … so you might need to look there first. If you don’t come right, I will send you the stuff when I get home from work.

Hi

Ok, to start with. I am just for now using First Person Projectile.

How do I detect when it hits the Player Character?

When I want to apply damage, it asks for a location, how do I pull that?

“Base Damage” if that is 1, then it would take 1 from health for example?

Damaged Actor input, do I need to use this?

Here are my relevant Blueprints … note that these are set up for Network Replication.

The is the Event Hit inside the projectile … the only thing on the right is where I spawn and emitter and do some other checks for objects hit.

That is I did … now when the projectile calls Apply Damage … it calls the Event Any Damage on the player and we go from there.

Hi

Shockingly enough, I worked it out just as I saw your post appear.

Thank you for your help.

https

Cool … glad you came right. 8-}

if I were you I would try to grasp how casting works, blueprint communication, look it up on YouTube.
Once you’ve mastered that I can assure you that you will be able to solve many of these little problems easily.