# How to apply radial damage to all actors in the area?

**URL:** <https://forums.unrealengine.com/t/how-to-apply-radial-damage-to-all-actors-in-the-area/317795>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [May 7, 2015, 5:33pm UTC](https://forums.unrealengine.com/t/how-to-apply-radial-damage-to-all-actors-in-the-area/317795 "2015-05-07T17:33:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anonymous\_user\_8e2766aa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8e2766aa](https://forums.unrealengine.com/u/anonymous_user_8e2766aa)\
**Post date:** [May 8, 2015, 9:20am UTC](https://forums.unrealengine.com/t/how-to-apply-radial-damage-to-all-actors-in-the-area/317795/2 "2015-05-08T09:20:32Z")

</div>

Hello, Davixe

In this situation, you can do the following:

1. Iterate amongst all actors of particular class.

2. 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:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

Hope this helped!  
Good luck!

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-apply-radial-damage-to-all-actors-in-the-area/317795)._
