How to know which object my character/enemy is overlaping?

I have a paper character 2d, inside of him there’s 3 colliders, 1 capsule collision for damage and 2 box collisions to his attacks (standing and crouched).

The character taking damage part was made inside of the enemy blueprint like this.

Since I only have 1 Capsule collider inside of my main character, they only do damage to him if overlap with the capsule.

But how I would do the attack?

It’s better to do it from inside the enemy BP or the character?
If I do it from the enemy BP how would I verify which box hitted him?

And If I do from the character BP, how could I call a custom function inside of the enemy BP? There’s more than one type of enemy so I would not be able to cast directly to one specific enemy BP.

You will want to place it in the Character. There is a function called “TakeDamage” (or ApplyDamage?) that you can call on Actors and their Child Classes. It will provide parameters for Damage Amount and other usefull things.

Normally you would only need to cast the Other Actor to an Actor (or directly use the function if possible). If you want to make sure that this is really an enemy and not the character itself, casting the the Enemy BP Class is necessary. And here comes the problem. Even if you have different enemies, they should ALWAYS have ONE base class that they are children of. Because otherwise you run into exactly this problem, where you don’t know which enemy you are facing. With the base class, you would just need to cast to this and you would know that it is an enemy. It is not important which one, just that it is a child of the base enemy class.

Thanks for the help. I’m creating the enemy base class now.
I will look more into the damage function and post the results here soon.

I did it! I created a EnemyBase class, it worked really nice, I created a variable “life” and changed the value of it on the creation of the child. Tthen I did a cast to EnemyBase and called a custom function for the damage, it worked. Thanks for the tip.