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!