RealDocs

UGameplayStatics::ApplyDamage

function Engine Blueprint Since unknown
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: static

Description

Applies point damage to an actor by calling its TakeDamage event. Returns the actual damage applied after any modifications by the receiving actor.

Signature

static ENGINE_API float ApplyDamage(AActor* DamagedActor, float BaseDamage, AController* EventInstigator, AActor* DamageCauser, TSubclassOf<UDamageType> DamageTypeClass)

Parameters

Name Type Description Default
DamagedActor AActor* The actor to receive damage.
BaseDamage float Amount of damage to apply.
EventInstigator AController* The controller responsible for the damage (used for kill credit).
DamageCauser AActor* The actor that physically caused the damage (e.g. a projectile).
DamageTypeClass TSubclassOf<UDamageType> The type of damage — used by the receiving actor to apply resistances.

Return Type

float

Caveats & Gotchas

  • This fires AActor::TakeDamage and the OnTakeAnyDamage/OnTakePointDamage delegates. The actor must implement damage handling — by default AActor::TakeDamage returns BaseDamage unchanged and does nothing else.
  • EventInstigator should be the player or AI controller that initiated the damage chain, not the projectile actor. Correct attribution matters for kill feeds, AI perception, and team-damage checks.
  • Returns the actual damage dealt (may be modified by the actor). A return of 0 does not mean the call failed — the actor may have absorbed it.

Example

Apply damage from a projectile hit C++
void AMyProjectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor,
	UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
	if (IsValid(OtherActor) && OtherActor != GetOwner())
	{
		UGameplayStatics::ApplyDamage(
			OtherActor,
			DamageAmount,
			InstigatorController,
			this,
			UDamageType::StaticClass()
		);
	}
	Destroy();
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.