Creating a damage aura that can be activated at will

Hello! I’m currently creating a demo of a game in UE5 and I’m running into some problems implementing a damage aura that the player can activate at will.

For context, I have an object (a bell) that I can hold the interact button on to have it run some code (in this case, ring the bell) and an enemy that I want to be capable of interacting with the invisible sphere collision of the object (taking Damage Over Time while in it), but only when I’m holding the interact button down.

Screenshots of the code here.

The intention is that when the enemy enters the damage area while it is active (while the player is interacting with the object), it activates the DoT that deals damage to the enemy, and ends the DoT when the enemy exits the area (or the player stops interacting with the object), or that this DoT is activated when the enemy is already within the damage area (but the player isn’t interacting with the object yet) and the player starts interacting with the object. With my current code the former works - if the player is interacting with the object and the enemy enters the area, it starts taking damage - but the latter doesn’t. So, if the enemy is already in the area and I begin to interact with the object, it doesn’t take damage.

I understand that this issue must be related to the “OnComponentBeginOverlap” node, which only runs once when the enemy enters the collision area of the specified component. I’ve tried using the “Activate” and “Deactivate” nodes with the collision area, but that didn’t seem to do anything, and neither did “SetCollisionEnabled”. If there are any other ways that I could enable/disable the specific sphere collision component of the interactable object so it’s only active when I want it to be, or a different way to tie the damage DoT to the collision component, I would very much appreciate to know how I could do so.

Thank you in advance!

It seems like there are two different things that need to be tracked separately. One is a list of all actors in the damage sphere. The other is whether damage dealer is active or not. When the damage dealer is active, then it has a single timer that is fired at some interval. At each interval it loops through its list of damagable actors and applies the damage. When an actor/actor component leaves the sphere, they are removed from the list. When the damage dealer is deactivated, the timer is destroyed.

One optimization could be that the collision sphere is only activated when the damage dealer is activated. This would require a manual trace against the sphere to get the initial list of actors when the damage dealer is activated.