Why enemy health only works with first shoot?

Hi guys, i am new with UE4 but i can did a nice level with characters, zombies and many objets, now i have any problems with something, i set the health of zombies and i need 4 shoots for kill him, but it only work with the firs one, after that i kill them just with one shoot. I created others actors and it is the same (only work one time) Help pls

This is just a guess but it looks like you are setting the zombies health on your “SailorBP” instead of on each zombie. So every time you shoot you are always setting that zombies health to the current ZombieHealth on the SailorBP which keeps getting decremented. Once it reaches zero then hitting any zombie will triiger destroy.

You would need to move the damage handling into your Zombie BP so that the SailorBP would just tell it to take damage and it would handle its own health.

Take a look at this page

I think there’s no problem using the “character” as the parent, but remember to create an AIController to posses it.

Yes!! From any days ago i was thinking abt that, u right!! Rimmy…i will create the zombie blueprint again, wich would be the parent class of enemies? Actor, character o pawn? before i used “character” as the parent class of my enemy and i guess this was the mistake

I see…Thank u!! I will try right now!!

I agree with Samuelhely, Character is a good base parent but you may want to make your own base class that extends Character (ex: EnemyBase) and then extend EnemyBase for each of your actual Enemy characters. This way you can share functionality across all enemies if you want.

Guys thank u for yours comments i made my enemy blueprint again, i used character as parent class, now my problem is how edit the blueprint of the enemy for still using the line trace for kill them, i tried copy and paste the building of my character blueprint but this no work, anyone can show me how do the building of the enemy blueprint for the line trace kill them? I can not find anything on Google, only for kill with projectiles :frowning:

On a high level this is how i would go about it:

  1. Player Character commits a trace from his weapon to a spot in front of his weapon based on required range
  2. Still in the character BP if the trace connects with a zombie it calls ApplyPointDamage to the zombie
  3. In the Zombie BP, have an event for PointDamage. It’s here that you will react to any point damage applied to the Zombie.

The ability to hit and cause damage to something is in the Player BP

The reaction to any damage is handled in the zombie BP.

this way the player can say “Hey, i hit you! for this much damage!” and the zombie can then choose how it treats that damage. The zombie could decide it only takes half damage from that damage type or double damage from fire, but the Player doesn’t care about that, all he knows is he hit a zombie and he wants to deal X amount of damage.

Note that you can use the AnyDamage event if you want, PointDamage just has some specific information about taking damage based on a point in space. Good for causing impulse of detecting hit locations.

Great!! U explain me very clear…I got it now!! I will work hard now!! :wink:

2 First steps ready working perfect only less make the last step

I can not :frowning: I put a collision box on the zombie called “DañoZombie” then i add event “OnComponentBeginOverlap” to this, i set overlapall, block all, everything…but i can not get collision on the box. I put print string saying hello for check and this no appaer on screen

With the event point damage on enemy blueprint i can not do nothing too :confused: help plsss

The incredible is checking the pic u can see the line trace hit the actor, what i need to do on the enemy blueprint?

It looks like you are calling destroy on the damage Causer instead of self (the zombie)

After many days trying find the solution last night i found a tutorial that make easy cause damage and kill the enemy with the race tray…just need a cube ( that is hide in the game) and get the function “Losing health” with the help of the float var “geting damage” . I post the link for if someone having the same problem. Thank u for the help and Samuel

[link text][1]

[1]:

Guys…how make this question appaer “SOLVED” ?

At the top of the answer click the checkbox and the up arrow