Cutom event not always firing

hi i’m just new to UE4 and i’m kinda confused why the player hit event(custom event) is rarely firing, sometimes it fires most of the time it does not, the game so far just spawns enemies, chase player then, damage the player every 0.5sec as long as they are in contact. nothing too fancy,
the problem is that, when i spawn like 5~20+ enemies the player_hit event does not fire all the time upon contact with the enemies

this is the enemy bp, i have tried adding a print string to all lines(exept the red one) just to check if somthing was not working upon collision, and everything works fine.

this is the player_hit(custom event) event on the ThirdPersonCharacter event graph

i tried just putting one enemy, and it worked just fine
but when i tried spawning multiple enemies(same type) that is when the player_hit(custom event) stops working

i tried using ‘Event Hit’ but it only triggered once, and if i keep in close contact with the enemy it does not trigger anymore

also this error shows up multiple times after:

Blueprint Runtime Error: “Accessed None trying to read property K2Node_DynamicCast_AsThird_Person_Character”. Blueprint: enemy Function: Execute Ubergraph Enemy Graph: EventGraph Node: Player Hit

what does this error mean?

The above is not set up right, and it’s quite unsafe - hence the errors.

what does this error mean?

It means that the reference of the actor you’re trying to access (and call its Player Hit) is invalid. What happens is that another actor, different than the player, triggers the overlap. Probably a chasing enemy; the cast then fails and the Timer attempts to access a stale / invalid pin.


Try it like this:

If you’re unsure how to create references of the correct type, right click pins → Promote To Variable and give those variables meaningful names.


Also, the engine already has a robust damage dealing system built-in. So perhaps you could take advantage of this. Above, the enemy is Applying Damage to an actor. Then any actor can receive is like so:

345080-screenshot-2.png