Character receive damage when his component is attacked

Hi all,

I got a problem with components and TakeDamage.

In my project, my character has a SphereComponent and when another character deal damage in my SphereComponent, my character take damage while it should not.

Any idea to resolve it please ?

Thanks :slight_smile:

Are you using a for loop on overlap objects? If so then you can do a check to if the current component is owned by self and if so then dont process any damage events. You can also do a check if the sphere component is owned by an enemy(Referenced in the game class or player itself) so as to not take damage away from your team players or team objects.

I think you don’t understand my problem. I have a HumanCharacter and a MonsterCharacter. My HumanCharacter has a SphereComponent around him and when my Monstercharacter attack and hit my SphereComponent, my HumanCharacter receive damage, while it should not.

Yeah I think I understand a little more. You’re monster attacks your character and causes damage, and that seems normal. What I imagine your issue would be is that the player is receiving continuous damage instead of a single hit? Is this correct? If this is case you would set a “canAttackEnemy” boolean to true when the enemy initializes an attack and then to false after the collision has been made. If this isn’t what you’re talking about, can you record a video of the issue?

Ok I solved my problem : I saw the SphereComponent collision settings in my Character blueprint, and I do it : http://zupimages.net/viewer.php?id=15/13/3d67.png

My problem was when my monsterCharacter is in my spherecomponent (which is not the collision box of my character), he dealt damage to my humanCharacter, while it should not because it was too far away to hit.

Thanks anyway :slight_smile:

Ok great glad it’s working! Yeah I didn’t understand sorry about that.