player.try_get_death_damage_mod
a.k.a. player.get_death_damage_modWhen called on a player who is dead, this function returns a number representing a modifier for their cause of death. This number complements the "damage reporting types" that can be listed in a Post-Game Carnage Report. The potential values are listed and named in the damage reporting modifier enum.
When Bungie and 343i use this function, they often manually clear
the number variable they are assigning to before calling the function.
That functionality is automated in this Megalo dialect: calling the
function with the name get_death_damage_mod
will compile in an
assignment to 0 before the call, while calling
the function with the name try_get_death_damage_mod
will not.
This function returns number. Calling this function without storing its return value in a variable is an error.
Example
-- -- Award points for killing any other player (including allies) with a splatter. -- for each player do if current_player.killer_type_is(guardians | suicide | kill | betrayal | quit) then -- -- The player is dead. -- global.number[0] = current_player.get_death_damage_mod() if global.number[0] == enums.damage_reporting_mod.splatter then global.player[0] = current_player.get_killer() global.player[0].score += 1 end end end