player.try_get_killer

a.k.a. player.get_killer

When called on a player who is dead, this function returns the player that killed them, if any.

When Bungie and 343i use this function, they often manually clear the player variable they are assigning to before calling the function. That functionality is automated in this Megalo dialect: calling the function with the name get_killer will compile in an assignment to no_player before the call, while calling the function with the name try_get_killer will not.

This function returns player. Calling this function without storing its return value in a variable is an error.

Example

for each player do
   if current_player.killer_type_is(guardians | suicide | kill | betrayal | quit) then
      --
      -- The player is dead.
      --
      global.player[0] = current_player.get_killer()
      global.player[0].score += 1
   end
end

See also