What methods do i use to kill a player?

So I have overridden the AActor::TakeDamage and implemented my own FDamageEvent derived from FPointDamageEvent.
And in TakeDamage(…) am calling a RPC call that changes the health of my player class derived from ACharacter::

I have a OnRep_Health(float Health) function being called when the value changes.
That updates my health bar on the on screen HUD.

So the next logical step is now to kill the player when the Health member hits 0.f.
And am wondering what is supposed to happen when a pawn dies?

KillZVolume:: makes the player fall thrue the world.
And AController:: have a method called “NotifyKilled” what is this for?
The shooter example is just confusing me, can someone please help me understand this key thing?

I got two qustions
1 What is the correct way of “killing” the pawn and making him ready to re-spawn.
2 When is UDamageType suposed to be used as its not getting passed with TakeDamage(…), should the Actor have it as a member?

is my ::TakeDamage overriden method.


float AMyProjectPlayerClass::TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser)
{
	Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);

	DecresePlayerHealth(Damage);

	if (Health > 0)
	{
		// Damage efects so on	
	}
	else if (Health <= 0)
	{
		EventInstigator->NotifyKilled(NULL, EventInstigator, EventInstigator->GetPawn(), NULL);
	}

	return Damage;
}

You can call World->DestroyActor. For me, calling Actor->Destroy didn’t work: https://forums.unrealengine.com/showthread.php?9613-How-to-remove-an-Actor.

Thank you for the reply seems that when you want to do somthing like this on a pawn.
You have to stop all animations and much, much more the OnDeath(…) method in the shooter example.
Gave me some hints but its all very fussy.

I think its vierd that no Epic staff has not replyed to one of my qustions at it seems like somthing best answerd by them.
How are we suposed to know what to do, to “kilL” a Pawn/ Character or Actor for that matter when its not mentioned in the documentation. ?
I could probeboly sit for weeks trying to figuer this out my self.

Its not mentioned in the documentation becouse the concept of “Death” can differ a lot between games

The usual implementation of “Death” is just Play a death animation,disable all the movement/input and prepare to respawn if its a player

It all depends on what you want to happen, naturally, but just destroying the pawn is ok. If you want do something like play a death animation and leave the dead body lying around, you can simply unpossess the pawn (APlayerController::Unpossess). Respawning can then be done by spawning a new pawn and possessing it.

The DamageType is inside the DamageEvent parameter.

Hope that helps!

Yes it do, so much actually a light bulb just light up in my head. :slight_smile:
And i can`t believe i never noticed the DamageTypeClass member in the DamageEvent its always the small things.

Thank you very much keep up the great work.
Cheers!