# How it works - void ReceiveAnyDamage (UE4-27)

**URL:** <https://forums.unrealengine.com/t/how-it-works-void-receiveanydamage-ue4-27/548388>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [May 4, 2022, 8:10am UTC](https://forums.unrealengine.com/t/how-it-works-void-receiveanydamage-ue4-27/548388 "2022-05-04T08:10:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soapman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soapman](https://forums.unrealengine.com/u/Soapman)\
**Post date:** [May 4, 2022, 8:10am UTC](https://forums.unrealengine.com/t/how-it-works-void-receiveanydamage-ue4-27/548388/1 "2022-05-04T08:10:26Z")

</div>

void ReceiveAnyDamage() UE4.27

Hello.  
I use ApplyDamage func for give damage. And i want to use ReceiveAnyDamage func for take damage. But ReceiveAnyDamage() not working. I implemented it - virtual void ReceiveAnyDamage(arguments). Maybe need to add Super, i dont know. Please help.

---

<div class="post-metadata">

**Author:** ![real.dude](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@real.dude](https://forums.unrealengine.com/u/real.dude)\
**Post date:** [May 4, 2022, 11:02am UTC](https://forums.unrealengine.com/t/how-it-works-void-receiveanydamage-ue4-27/548388/2 "2022-05-04T11:02:34Z")

</div>

Hi! You should use `TakeDamage()` instead  
And yeah, don’t forget to use `Super::TakeDamage()` to call parent function 😉

> **[AActor::TakeDamage](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/GameFramework/AActor/TakeDamage/)**
>
> Apply damage to this actor.

---

<div class="post-metadata">

**Author:** ![Soapman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soapman](https://forums.unrealengine.com/u/Soapman)\
**Post date:** [May 4, 2022, 6:23pm UTC](https://forums.unrealengine.com/t/how-it-works-void-receiveanydamage-ue4-27/548388/3 "2022-05-04T18:23:32Z")

</div>

I find solution but it not used ReceivedAnyDamage()

Add ActorComponent named “Health Component” → in header implemented func TakeDamage(arguments) → in CPP call delegate OnTakeAnyDamage() with func TakeDamage.

it works with ApplyDamage.

**If i put this logic in Char file, its not working, only in component files**

> UFUNCTION()  
> void TakeDamage(AActor\* DamagedActor, float Damage, const UDamageType\* DamageType, AController\* InstigateBy, AActor\* DamageCauser);

> void UCharHealthComponent::BeginPlay()  
> {  
> Super::BeginPlay();
> 
> GetOwner()-\>OnTakeAnyDamage.AddDynamic(this, &UCharHealthComponent::TakeDamage);  
> }

> void UCharHealthComponent::TakeDamage(AActor\* DamagedActor, float Damage, const UDamageType\* DamageType, AController\* InstigateBy, AActor\* DamageCauser)  
> {  
> CharHealth -= Damage;  
> }
