Dealing damage with box collusion

Hi everyone. I have a question. I want deal damage with box collusion but I don’t know how to do it. Here is my idea, if my character gets to close to the AI character, then the damage will begin. Can you help me? Thank you.

Here is a basic example to get you started.

Start by opening your AI character blueprint, and add a Box Collision component to the scene :

312300-aaaaa.jpg

Select the box component, and scroll the details panel until you find events. Add events for Begin Overlap and End Overlap :

312311-bbbbb.jpg

These events are triggered whenever any actor (with overlapping collision enabled) start overlapping (or stop overlapping) with the box component.

For this basic example we will simply check if the overlapping actor is of type Character. If yes, then we store the character in a variable, and launch a looping timer. Every time the timer triggers, it will damage the character stored in variable. When character stops overlapping, the second event is triggered and we stop the timer.

This is very basic and will not work correctly with multiple players or multiple characters, but it should get you started.

1 Like

Thank you very much for your help.