# GetKiller

Objects
Status
5.1 OC
int
Returns the player who has lastly caused energy loss to an object.
Because of the complexity of Clonk, it may not always be possible to determine the actual killer of a Clonk in chain reactions. In order to determine energy losses, every object stores a controller (see GetController for details). The controller is used to determine the player responsible for energy loss on a Clonk:

- For object hits: The controlling player of the thrown object. The controller will automatically be set upon collection.
- For fire: The controller of the original fire causing player, i.e. the calling object of the original call to Incinerate(). The causing player is kept independently of owners and controllers of the burning object in incineration chains. If, for example, player A incinerates a Clonk of player B and player B uses his burning Clonk to incinerate a Clonk of player C, both incinerations are marked as caused by player A.

The energy loss causing player is automatically reset to NO_OWNER (no player), whenever the Clonk executes an action that does not have ObjectDisabled=1 set (e.g. "Walk").
Energy loss caused by the controller of the Clonk itself only sets the field if it was NO_OWNER before. This prevents players from committing suicide in order to deny scores from other players. Consequently, if a Clonk is hit by a rock and falls out of the bottom of the map, the killer is the player who threw the rock.
protected func Death() { var killer = GetKiller(); if (killer == GetController()) Message("%s killed himself, hah!", GetName()); else if (killer != NO_OWNER) Message("%s was killed by %s!", GetName(), GetPlayerName(killer)); else DeathAnnounce(); return true; }
Script for the death of a Clonk: Customized death messages which show the murderer are shown.
SetKiller
GetController
GetOwner
SetController
DoEnergy
Sven2
2007-04