Shouldn't we be returning the Damage Actually Applied?

When you look at the documentation for TakeDamage it specifies that it returns “The amount of damage actually applied.” which isn’t what you have returned when overriding TakeDamage.

Not sure it really matters here but here is what I did…

float AShooterCharacter::TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
	float DamageToApply = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);

	float DamageActuallyApplied = (DamageToApply > Health) ? Health : DamageToApply;
	Health -= DamageActuallyApplied;

	UE_LOG(LogTemp, Warning, TEXT("%s \tHealth: %f \tDamageActuallyApplied: %f"), *(GetName()), Health, DamageActuallyApplied);

	return DamageActuallyApplied;
}

I take it back, Sam did return the DamageActuallyApplied thanks to the min function.

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

Privacy & Terms