My main character has a collision box in front of it and I want it to damage the enemy AI when the AI is in the boxes volume and the player presses the attack button (Melee, not a projectile)

My main character has a collision box in front of it (box moves with character),
I want it to damage the enemy AI,
when the AI is in the boxes volume and the playable character presses a delegated button,
(Melee attack, not a projectile)
I have the apply damage node completed too

Anyone know how to set damage to an AI, when (in the collision box and button is pressed)

Thank you

This is my blueprint so far if you care to elaborate on it, (Ignore the print string, thats for testing)

AI is the AIs health and destruction when health is lower than 1,

Player is where Im having the collision problem,

I only want the player to attack the AI when both; AI is in the collision box and the player pressed the button

Hi, I suppose you could create a boolean variable in your character, something like “bIsAttacking” that you would set to true on key pressed and false on key released.
Then on overlap, check if the boolean is true, if it is, apply damage, if not, do nothing.

to create the setup you describe you just need to think out the steps logically. you want the attack to be initiated from a attack input so you make that the event. then you want to get the actors that are overlapping your collision volume, so we get the collision volume then use the get overlapping actors node which returns all actors overlapping or you can set it to look for a specific class if you like. then we need to apply damage to each enemy so we use a for each loop which basically says for every enemy thats overlapping do the thing, in this case we want to apply damage so we use the node for that.

thats really it. pretty simple. this is of course for a aoe attack as it will hit every enemy in the volume.