mexikoedi/ttt2_role_med

Request to add ability to win + disable kill/popup handling

Closed this issue · 3 comments

I'd like a convar to enable the medic to win with the last team standing (if they are still alive).

It would give the medic some concrete reward/purpose to staying alive, rather than simply existing for the sake of existing with no real purpose or gains. Right now, the only way a medic could end up winning is if they kill someone and become an innocent.

Adding this convar would also create an interesting dynamic where you could threaten the medic and say that they should heal you or they die (and lose).

Here is the complete idea which I will try to implement:

Medic needs to heal an amount of health which is defined by a multiplier convar per person in the round and he needs to be alive at the end of the round. (2x Convars)

A popup will be shown if this winstate is active and the text explains what the Medic should do. (Lang files) (2x Convars)

A popup will be shown if he healed enough. (Lang files) (2x Convars)

At the end he wins with the other last team and he gets some points.


1x Convars to disable the kill/popop handling (Medic kills someone -> Innocent/Popup | Medic kills Medic -> Traitor/Popup).

This is code that is used to make the Elderly role join the winning team at the end of the round (if they are still alive).

`if SERVER then
hook.Add("TTT2ModifyWinningAlives", "CheckElderlyTeamSwitch", function(alives)
local winningTeam = ""

if alives == nil then return end

-- Check alive teams
for i in pairs(alives) do
  local t = alives[i]
  if winningTeam != "" and winningTeam != t then return end
  winningTeam = t
end

if winningTeam == "" then return end

-- Find and change Elderlys' team to winning team
for _, ply in ipairs(player.GetAll()) do
  if not IsValid(ply) or not ply:Alive() then continue end
		if SpecDM and (ply.IsGhost and ply:IsGhost() or (vics.IsGhost and vics:IsGhost())) then continue end

  if ply:GetSubRole() == ROLE_ELDERLY then
    ply:UpdateTeam(winningTeam, false)
  end
end

end)
end`

This was added with the PR #6 .