Small Damage Error

Hi!

Here are a few errors I stumbled across, I want players to be able to damage eachother. I have set it all up, just a few problems left. This script makes my characters die, but they don’t dissapear: Screenshot - 9a79c11c166818a14d7f410252ab575e - Gyazo

This makes my Client to dissapear, but after one single shot, they should be able to handle 3 shots before dying, bullets do 30DMG. 3Shots=90DMG. Screenshot - 2f6d603ab06592cb6f130f93c518d8de - Gyazo

Does anyone have a soloution for this? Im really stuck and need help!
Btw, the print strings let me see if they are dead or not.

For the first one you are calling the cast to after the execution of the destroy actor so it doesn’t technically know what actor to destroy when the destroy actor is called and the cast requires an object to cast from as well as to. Instead of using cast to just leave it as destroy actor with self as the target like this:

82880-destroyactor.png

For the second one you need to swap the location of the destroy actor because as you have it the destroy actor will fire if health is greater than the blank Compare With value you have entered…you may also want to replace the compare float with something like this for both of the checks you have setup:

82878-healthcheck.png

Here if health is less than or equal to 0 it will return true otherwise it will return false.

Thanks! This fixed some of the issues but not all, both client and server can die now. But the blueprint is in the bullet, thats the catch. So if I target destory actor as “self” it only destroys the bullet, any idea on that?

Here is the full blueprint Screenshot - 7645f75e8ff743741aeca2f102592aa4 - Gyazo

Drag the pin from Other Actor and connect it to the destroy actor

unfortunately this doesn’t really work, now you still die from 1 single hit, the mathc isn’t applied for some reason :confused: Screenshot - 331db006cf62a5a3e5a4ac6ab52e3ba2 - Gyazo

They still die after one shot :confused: Screenshot - e50fda914998b6fec54bf4f44d14eabf - Gyazo

Nevermind! I found the problem! But thank you so god darn much for helping me, couldn’t have done it myself! Thanks for taking your time <3

You changed the way I showed you to do the check:

Like you have it here the return will always be less than or equal to itself…
Do the check like this:

82878-healthcheck.png

Also make sure you have a default value set for Health to your 90 value that you mentioned earlier. This is how it should be in your BP I skipped the add to viewport stuff but that can still be done if you are needing that:

What is the default value of Health in the character’s BP?

It should be set like this:

82914-healthdefault.png

Yeah some of mine got “canned” too apparently…anyway check and make sure you are using the same setup for both

These may also help you:

If you have time, there is 1 more small issue, only the client dies, not the server :confused:

Everything works! Some of my replies dissapeared for some reason, the problem right now is that the client/Player 1 dies, but the server says “Dead” but the actor doesn’t get destroyed. Player 2 get destroyed though

The setup should be the same, a weird thing is that when I run a dedicated server none of the actors get destroyed. When I play on a non-dedicated server, Player 2 can die. I am quite weirded out by this :confused:

That’s why I gave you the reference links