How to us the function ReceiveRadialDamage in C++?


There are no examples in the Internet how to use:

void ReceiveRadialDamage(float DamageReceived, const class UDamageType * DamageType, FVector Origin, const struct FHitResult & HitInfo, class AController * InstigatedBy, AActor * DamageCauser);

I use

UGameplayStatics::ApplyRadialDamage(World, BaseDamage, ExplosionOrigin, DamageRadius, DamageTypeClass, IgnoreActors, this, InstigatedByController, bDoFullDamage, ECollisionChannel::ECC_Visibility);

in the grenade class. It works with ReceiveRadialDamage in blueprints, but I can’t implement it in C++.

I know TakeDamage() and programmers use it in their code, but what with ReceiveRadialDamage?

You can only implement ReceiveRadialDamage in Blueprints but not in C++ since it’s a BlueprintImplementableEvent. There are multicast delegates for Point and “Any” damage but not for Radial damage.

I’ve customized this in my own branch of UE4 built from source but the quickest way for you would probably be to override TakeDamage in C++ and do something like

virtual float TakeDamage(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, AActor* DamageCauser) override
	if (DamageEvent.IsOfType(FRadialDamageEvent::ClassID))
		//process radial damage
		//return something?

	return Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);

I understand. I was informed that I should have used TakeDamage instead. Thank you for making it clear.