Logging a Player's Killer

Discussions about Coding and Scripting
User avatar
OjitroC
Godlike
Posts: 3746
Joined: Sat Sep 12, 2015 8:46 pm

Logging a Player's Killer

Post by OjitroC »

I have a mutator with this code

Code: Select all

function ScoreKill(Pawn Killer, Pawn Other) {

	if (Killer == None) return;

	if (Killer != Other) {
	
		if (Killer.IsA('ScriptedPawn')) {
			BroadcastMessage(Killer.GetHumanName() @ "killed" @ Other.GetHumanName());
		}
		log(Killer.GetHumanName() $ " killed " $ Other.MenuName);

	}

	Super.ScoreKill(Killer, Other);
}
At present, it logs
a) when I, as the Player, kill a ScriptedPawn; and
b) when a ScriptedPawn kills another ScriptedPawn.
It doesn't broadcast a message in either case, which is not a big issue.

What I want to do is log when I, as the Player, am killed by a ScriptedPawn. What code do I need to do that?
User avatar
Barbie
Godlike
Posts: 2923
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Logging a Player's Killer

Post by Barbie »

What about mutator's function PreventDeath()? It is called by Pawn.Died().
"If Origin not in center it be not in center." --Buggie