I am creating a game where an AI runs towards the player and damages them on collision.
I am handling the collision in my enemy BP using the OnComponentBeginOverlap event. Whenever a player is detected on the damaging component, a damage interface message is sent to the player. However, sometimes this event is triggered many times in a few tenths of a second (probably due to movement interactions).
I would like to limit the interval between calls to this damage interface message. I am currently doing the following but I think there is a better way:
As you can see, I am creating a timer for a dummy event that does nothing, which makes me think there is certainly a better way to do this. The behavior I’m looking for is something like a retriggerable delay, but I need the damage to occur before it and not after.
I may also want to tick damage to the player while they remain in the damaging collision component belonging to the enemy, but I don’t see any event for that, only on begin and end overlap.
Any help would be greatly appreciated!