game.sudden_death_timer
Type: TimerThis timer is used for Sudden Death; it is displayed on the HUD when appropriate. Its initial value is the sudden_death_time.
Typically, Sudden Death will activate if, at the end of the round, a player is in a position where they can attempt to complete the objective. For example, during CTF, Sudden Death will activate if a player is standing very close to a flag that they can pick up and capture.
Typically, the Grace Period is used to complement Sudden Death. Sudden Death activates when a player is able to further an objective match; for example, it will enable if any player is standing close to a flag that they can pick up and score. In that scenario, if Sudden Death begins and then the conditions for it are no longer met (the player stops being near the flag), then the match will end after the Grace Period ends. Sudden Death never resets (if a player comes near the flag again, the timer will continue from where it left off), but the Grace Period does.
Example
alias sudden_death_enabled = global.number[0] alias announced_sudden_death = global.number[1] -- only announce the start of Sudden Death once if not game.round_timer.is_zero() then game.grace_period_timer = 0 end if game.round_time_limit > 0 then if not game.round_timer.is_zero() then announced_sudden_death = 0 end if game.round_timer.is_zero() then if sudden_death_enabled == 1 then game.sudden_death_timer.set_rate(-100%) game.grace_period_timer.reset() if announced_sudden_death == 0 then send_incident(sudden_death, all_players, all_players) announced_sudden_death = 1 end if game.sudden_death_time > 0 and game.grace_period_timer > game.sudden_death_timer then game.grace_period_timer = game.sudden_death_timer end end if sudden_death_enabled == 0 then game.grace_period_timer.set_rate(-100%) if game.grace_period_timer.is_zero() then game.end_round() end end if game.sudden_death_timer.is_zero() then game.end_round() end end end
Notes
If you want to implement Sudden Death, you should use the
sudden_death_timer
and thegrace_period_timer
in conjunction with theround_timer
.