Hello, Davixe
In this situation, you can do the following:
-
Iterate amongst all actors of particular class.
-
Check each actor for distance and apply damage for the ones that are close enough.
Your code will look something like this:
for ( TActorIterator<ACustomCharacter> it(GetWorld()); it; ++it )
{
float Distance = GetDistanceTo(*it);
if (Distance <= DamageRadius)
{
UGameplayStatics::ApplyDamage(*it, DamageAmount,
GetInstigatorController(), this, UDamageType::StaticClass());
}
}
This should do it.
If you like to learn more about iterators in Unreal Engine 4, please go here:
Hope this helped!
Good luck!