player.try_get_death_damage_mod
a.k.a. player.get_death_damage_modWhen called on a player on the exact frame that that player died, 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 called on any other frame, even while the player is dead, this function does not return a value:
-
If you call
get_death_damage_mod
, ReachVariantTool will silently compile in an assignment to 0 before the call. (Bungie and 343i do the same thing by hand.) This ensures that if you call the function at the wrong time, the variable you assign its return value to will be set to 0. -
If you call
try_get_death_damage_mod
, then ReachVariantTool does not compile in this failsafe. If you calltry_get_death_damage_mod
at the wrong time, then the function will not return a value: the variable that you attempt to assign it to will remain unchanged.
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