I got it to work in c++ for takedamage. Looked through the api and seen you need to add a super::takedamage to calculate actual damage. This wasn’t mentioned in the damage overview.
Header:
//Damage taken override.
virtual float TakeDamage
(
float DamageAmount,
struct FDamageEvent const& DamageEvent,
class AController* EventInstigator,
class AActor* DamageCauser
) override;
cpp:
//Take damage overide function.
float ACH_3PSCharacter::TakeDamage(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser)
{
if (Role == ROLE_Authority) //Server calculate Only
{
const float ActualDamage = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
CurHealth -= ActualDamage;
if (CurHealth <= 0.f)
{
if (DebuggerLog)
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Dead!");
CurHealth = 0.f;
isDead = true;
}
}
if (isDead)
ACH_3PSCharacter::SimulateRagdoll();
return 0;
}