DamageEvent and TakeDamage

Hello,

I’m having a little trouble understanding why I need to specify the damage amount in the DamageEvent and then a second time when calling TakeDamage. Shouldn’t ‘TakeDamage’ be able to get the damage amount from the DamageEvent?

AActor* HitActor = Hit.GetActor();

    if (HitActor != nullptr)
    {
        FPointDamageEvent DamageEvent(Damage, Hit, ShotDirection, nullptr);
        Hit.GetActor()->TakeDamage(Damage, DamageEvent, OwnerController, this);
    }

To be honest, I’m not sure. Seems to be unused

	if (DamageEvent.IsOfType(FPointDamageEvent::ClassID))
	{
		// point damage event, pass off to helper function
		FPointDamageEvent* const PointDamageEvent = (FPointDamageEvent*) &DamageEvent;
		ActualDamage = InternalTakePointDamage(ActualDamage, *PointDamageEvent, EventInstigator, DamageCauser);

Where InternalTakePointDamage is

float AActor::InternalTakePointDamage(float Damage, FPointDamageEvent const& PointDamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
	return Damage;
}

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms