--made by wacev --weapon trading fucntions are heavily modified bauernhof scripts --if anyone doesn't like the copied code, dm me on discord --please dont copy anything and claim it as your own :) PlayersAlive = 0 WaveStart = false OnBreak = false PlayerList = {} RandomNameIndex = 0 SoloMode = false LowMannMode = false PlayerInWinZone = 0 Players = 0 function HandleWinning() if WaveStart == true then for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then Players = Players + 1 end end if PlayerInWinZone > Players then PlayerInWinZone = Players end if Players == PlayerInWinZone then ents.FindByName("win_true_relay"):AcceptInput("trigger") else ents.FindByName("win_relay"):AcceptInput("trigger") end end print(Players) print(PlayerInWinZone) end function ShuffleInPlace(t) --copied from stack overflow for i = #t, 2, -1 do local j = math.random(i) t[i], t[j] = t[j], t[i] end end function GetRandomName() local index = 1 for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() and player:IsAlive() then PlayerList[index] = { name = player:GetPlayerName(), alive = player.m_iHealth > 0 } index = index + 1 end end if #PlayerList == 0 then ents.FindByName("speech_case"):AcceptInput("disable") end RandomNameIndex = RandomNameIndex + 1 if RandomNameIndex > #PlayerList then ShuffleInPlace(PlayerList) RandomNameIndex = 1 end if PlayerList[RandomNameIndex].alive then ents.FindByName("speech_case"):AcceptInput("Addoutput","case01 " .. PlayerList[RandomNameIndex].name) else GetRandomName() end end function Add() PlayersAlive = PlayersAlive + 1 end function Subtract() PlayersAlive = PlayersAlive - 1 end function OnGameTick() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then if player.m_bUsingActionSlot == 1 and player.InteractCooldown ~= true then player.HoldTime = player.HoldTime + 1 if player.HoldTime > 13 and player.InteractWith ~= "nothing" then Interact(player) player.InteractCooldown = true player.HoldTime = 0 timer.Simple(0.5, function() player.InteractCooldown = false end) end else player.holdTime = 0 end if player:InCond(43) then player:WeaponSwitchSlot(2) end if ( ( not IsValid( player:GetPlayerItemBySlot(1) ) ) or ( ( not IsValid( player:GetPlayerItemBySlot(0) ) ) and ( player.m_iClass ~= TF_CLASS_SPY ) ) ) then --should fix not having any weapons or missing a weapon if WaveStart and ( player.m_iTeamNum == 2 ) and ( player:IsValid() ) then player:ResetInventory() end end if ( player:InCond(70) and ( player:GetPlayerItemBySlot(1):GetItemName() ~= "The Razorback" ) ) then player:RemoveCond(70) end end if player:IsPlayer() and ( player.m_iTeamNum == 2 ) and ( SoloMode == true and ( not player:InCond(16) ) ) then --gives trapped survivor minicrits too, just to help out a bit player:AddCond(16,-1) end if player:IsBot() then if tostring(player:GetPlayerName()) == "Trapped Survivor" and (SoloMode) and (player:GetAttributeValue("dmg taken increased") == nil) then player:SetAttributeValue("dmg taken increased",0.5) player:SetAttributeValue("mult crit dmg",1.6) player:SetAttributeValue("reload time decreased",0.65) player:AddCond(109,-1) end if tostring(player:GetPlayerName()) == "Trapped Survivor" and (LowMannMode) and (player:GetAttributeValue("dmg taken increased") == nil) then player:SetAttributeValue("dmg taken increased",0.75) player:SetAttributeValue("reload time decreased",0.8) end if tostring(player:GetPlayerName()) ~= "Trapped Survivor" and ( player:InCond(109) ) then player:Removecond(109) end if player:InCond(12) then if player.LethalDelay > 0 then --need to do something like this for a non timer based delay player.LethalDelay = player.LethalDelay - 1 else player.LethalDelay = 0.1 * 66 player:TakeDamage({Attacker = player:GetConditionProvider(12), Damage = 100, DamageType = 131072}) end end end end end function Interact(player) if player.InteractWith == "tradeshotgun" then if player.m_iClass == TF_CLASS_SOLDIER or player.m_iClass == TF_CLASS_PYRO or player.m_iClass == TF_CLASS_HEAVYWEAPONS or player.m_iClass == TF_CLASS_ENGINEER then if player:GetPlayerItemBySlot(1):GetItemName() == "Graveyard Caretaker" or (player:GetPlayerItemBySlot(0):GetItemName() == "Graveyard Caretaker") then player:AcceptInput("$StripExtraItem", "Graveyard Caretaker") player:Print(2,"Unequiped Graveyard Caretaker!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") if player.m_iClass == TF_CLASS_SOLDIER or player.m_iClass == TF_CLASS_PYRO or player.m_iClass == TF_CLASS_HEAVYWEAPONS then player:GetPlayerItemBySlot(1).m_iClip1 = 0 else player:GetPlayerItemBySlot(0).m_iClip1 = 0 end else player:AcceptInput("$AwardAndGiveExtraItem", "Graveyard Caretaker") player:Print(2,"Equiped Graveyard Caretaker!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end if player.m_iClass == TF_CLASS_SOLDIER or player.m_iClass == TF_CLASS_PYRO or player.m_iClass == TF_CLASS_HEAVYWEAPONS then player:GetPlayerItemBySlot(1).m_iClip1 = 0 else player:GetPlayerItemBySlot(0).m_iClip1 = 0 end end else player:Print(2,"Graveyard Caretaker is not equippable for this class") end end if player.InteractWith == "tradeglock" then if player.m_iClass == TF_CLASS_SCOUT or player.m_iClass == TF_CLASS_ENGINEER then if player:GetPlayerItemBySlot(1):GetItemName() == "Glock" then player:AcceptInput("$StripExtraItem", "Glock") player:Print(2,"Unequiped Glock!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") player:GetPlayerItemBySlot(1).m_iClip1 = 0 else player:AcceptInput("$AwardAndGiveExtraItem", "Glock") player:Print(2,"Equiped Glock!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end player:GetPlayerItemBySlot(1).m_iClip1 = 0 end else player:Print(2,"Glock is not equippable for this class") end end if player.InteractWith == "trademp40" then if player.m_iClass == TF_CLASS_MEDIC then if player:GetPlayerItemBySlot(0):GetItemName() == "Medical Pratice 40" then player:AcceptInput("$StripExtraItem", "Medical Pratice 40") player:Print(2,"Unequiped Medical Pratice 40!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") player:GetPlayerItemBySlot(0).m_iClip1 = 0 else player:AcceptInput("$AwardAndGiveExtraItem", "Medical Pratice 40") player:Print(2,"Equiped Medical Pratice 40!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end player:GetPlayerItemBySlot(0).m_iClip1 = 0 end else player:Print(2,"Medical Pratice 40 is not equippable for this class") end end if player.InteractWith == "tradebrewery" then if player.m_iClass == TF_CLASS_DEMOMAN then if player:GetPlayerItemBySlot(0):GetItemName() == "Brewery Blaster" then player:AcceptInput("$StripExtraItem", "Brewery Blaster") player:Print(2,"Unequiped Brewery Blaster!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") player:GetPlayerItemBySlot(0).m_iClip1 = 0 else player:AcceptInput("$AwardAndGiveExtraItem", "Brewery Blaster") player:Print(2,"Equiped Brewery Blaster!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end player:GetPlayerItemBySlot(0).m_iClip1 = 0 end else player:Print(2,"Brewery Blaster is not equippable for this class") end end if player.InteractWith == "tradespitfire" then if player.m_iClass == TF_CLASS_SOLDIER then if player:GetPlayerItemBySlot(0):GetItemName() == "Spitfire" then player:AcceptInput("$StripExtraItem", "Spitfire") player:Print(2,"Unequiped Spitfire!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") player:GetPlayerItemBySlot(0).m_iClip1 = 0 else player:AcceptInput("$AwardAndGiveExtraItem", "Spitfire") player:Print(2,"Equiped Spitfire!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end player:GetPlayerItemBySlot(0).m_iClip1 = 0 end else player:Print(2,"Spitfire is not equippable for this class") end end if player.InteractWith == "trademshotgun" then if player.m_iClass == TF_CLASS_SOLDIER or player.m_iClass == TF_CLASS_PYRO or player.m_iClass == TF_CLASS_HEAVYWEAPONS or player.m_iClass == TF_CLASS_ENGINEER then if player:GetPlayerItemBySlot(1):GetItemName() == "Military Shotgun" or (player:GetPlayerItemBySlot(0):GetItemName() == "Military Shotgun") then player:AcceptInput("$StripExtraItem", "Military Shotgun") player:Print(2,"Unequiped Military Shotgun!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") if player.m_iClass == TF_CLASS_SOLDIER or player.m_iClass == TF_CLASS_PYRO or player.m_iClass == TF_CLASS_HEAVYWEAPONS then player:GetPlayerItemBySlot(1).m_iClip1 = 0 else player:GetPlayerItemBySlot(0).m_iClip1 = 0 end else player:AcceptInput("$AwardAndGiveExtraItem", "Military Shotgun") player:Print(2,"Equiped Military Shotgun!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end if player.m_iClass == TF_CLASS_SOLDIER or player.m_iClass == TF_CLASS_PYRO or player.m_iClass == TF_CLASS_HEAVYWEAPONS then player:GetPlayerItemBySlot(1).m_iClip1 = 0 else player:GetPlayerItemBySlot(0).m_iClip1 = 0 end end else player:Print(2,"Military Shotgun is not equippable for this class") end end if player.InteractWith == "tradeflintlock" then if player.m_iClass == TF_CLASS_SPY then if player:GetPlayerItemBySlot(1):GetItemName() == "Flintlock" then player:AcceptInput("$StripExtraItem", "Flintlock") player:Print(2,"Unequiped Flintlock!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") player:GetPlayerItemBySlot(1).m_iClip1 = 0 else player:AcceptInput("$AwardAndGiveExtraItem", "Flintlock") player:Print(2,"Equiped Flintlock!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end player:GetPlayerItemBySlot(1).m_iClip1 = 0 end else player:Print(2,"Flintlock is not equippable for this class") end end if player.InteractWith == "trademsmg" then if player.m_iClass == TF_CLASS_SNIPER then if player:GetPlayerItemBySlot(1):GetItemName() == "Military SMG" then player:AcceptInput("$StripExtraItem", "Military SMG") player:Print(2,"Unequiped Military SMG!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") player:GetPlayerItemBySlot(1).m_iClip1 = 0 else player:AcceptInput("$AwardAndGiveExtraItem", "Military SMG") player:Print(2,"Equiped Military SMG!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end player:GetPlayerItemBySlot(1).m_iClip1 = 0 end else player:Print(2,"Military SMG is not equippable for this class") end end if player.InteractWith == "tradebmg" then if player.m_iClass == TF_CLASS_SNIPER then if player:GetPlayerItemBySlot(0):GetItemName() == "Auto BMG" then player:AcceptInput("$StripExtraItem", "Auto BMG") player:Print(2,"Unequiped Auto BMG!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") else player:AcceptInput("$AwardAndGiveExtraItem", "Auto BMG") player:Print(2,"Equiped Auto BMG!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end end else player:Print(2,"Auto BMG is not equippable for this class") end end if player.InteractWith == "tradeslugger" then if player.m_iClass == TF_CLASS_SCOUT then if player:GetPlayerItemBySlot(0):GetItemName() == "Steel Slugger" then player:AcceptInput("$StripExtraItem", "Steel Slugger") player:Print(2,"Unequiped Steel Slugger!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun2") player:GetPlayerItemBySlot(0).m_iClip1 = 0 else player:AcceptInput("$AwardAndGiveExtraItem", "Steel Slugger") player:Print(2,"Equiped Steel Slugger!") player:PlaySoundToSelf("heavy_taunt_heavy_workout_taunt_equipment_gun1") if player.FirstPickUp == true then timer.Simple(2,function() player.FirstPickUp = false player:Print(3,"Press your inspect weapon key to view custom weapon attributes!") end) end player:GetPlayerItemBySlot(0).m_iClip1 = 0 end else player:Print(2,"Steel Slugger is not equippable for this class") end end end function OverrideSoloMode() -- for testing purposes, sm_ent_fire popscript $OverrideSoloMode if SoloMode == false then SoloMode = true for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AddCond(16,-1) player:SetAttributeValue("dmg taken increased",0.85) player:AcceptInput("$AddCurrency", 750) ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","3") end end else SoloMode = false for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:RemoveCond(16) player:SetAttributeValue("dmg taken increased",nil) player:AcceptInput("$AddCurrency", -750) ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","12") end end end print(SoloMode) end function OverrideLowMannMode() -- for testing purposes, sm_ent_fire popscript $OverrideLowMannMode if LowMannMode == false then LowMannMode = true for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AcceptInput("$AddCurrency", 500) ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","6") end end else LowMannMode = false for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AcceptInput("$AddCurrency", -500) ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","12") end end end print(LowMannMode) end function OnWaveStart() WaveStart = true local index = 0 for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() and ( player.m_iTeamNum == 2 ) then index = index + 1 end end ents.FindByName("bignet"):AcceptInput("runscriptcode","SetSkyboxTexture(`sky_day02_07`)") ents.FindByName("thicc_fog"):AcceptInput("SetStartDistLerpTo","0") ents.FindByName("thicc_fog"):AcceptInput("SetEndDistLerpTo","512") timer.Simple(0.1, function() ents.FindByName("thicc_fog"):AcceptInput("StartFogTransition") end) if index == 1 then SoloMode = true util.PrintToChatAll("Solo Mode: On") util.PrintToChatAll("Buffs: Perma minicrits, bonus starting cash, 15% less damage taken, way smaller initial horde, major survivor buffs") util.PrintToChatAll("Have fun, and good luck :)") for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AddCond(16,-1) player:SetAttributeValue("dmg taken increased",0.85) player:AcceptInput("$AddCurrency", 750) end end ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","3") elseif index == 2 or (index == 3) then LowMannMode = true util.PrintToChatAll("Low Mann Mode: On") util.PrintToChatAll("Buffs: bonus starting cash, slightly smaller initial horde, minor survivor buffs") util.PrintToChatAll("Have fun, and good luck :)") for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AcceptInput("$AddCurrency", 500) end end ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","6") else SoloMode = false LowMannMode = false ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","12") end end function OnWaveInit() WaveStart = false OnBreak = false SoloMode = false LowMannMode = false PlayersAlive = 0 PlayerInWinZone = 0 Players = 0 ents.FindByName("bignet"):AcceptInput("runscriptcode","SetSkyboxTexture(`sky_alpinestorm_01`)") --yes the ` are needed ents.FindByName("thicc_fog"):AcceptInput("SetStartDistLerpTo","1024") ents.FindByName("thicc_fog"):AcceptInput("SetEndDistLerpTo","2048") ents.FindByName("wall_break_counter"):AcceptInput("SetHitMax","12") timer.Simple(0.1, function() ents.FindByName("thicc_fog"):AcceptInput("StartFogTransition") end) for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AcceptInput("RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 0.5, 0, 1)") end end timer.Simple(0.5,function() ents.FindByName("break_start_relay"):AddCallback(ON_OUTPUT, function(ent, output, value, activator) OnBreak = true end) ents.FindByName("break_end_relay"):AddCallback(ON_OUTPUT, function(ent, output, value, activator) OnBreak = false end) ents.FindByName("red_new_spawn"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() and ( OnBreak ) and ( player.TimesInfected > 0 ) then player.TimesInfected = 0 player:Print(3,"Replenished antitoxins") end end) ents.FindByName("tank_win_zone"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then PlayerInWinZone = PlayerInWinZone + 1 end end) ents.FindByName("tank_win_zone"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then PlayerInWinZone = PlayerInWinZone - 1 end end) ents.FindByName("equip_shotgun"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "tradeshotgun" player:Print(2,"Hold action key to pick up or drop Graveyard Caretaker") end end) ents.FindByName("equip_shotgun"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_glock"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "tradeglock" player:Print(2,"Hold action key to pick up or drop Glock") end end) ents.FindByName("equip_glock"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_mp40"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "trademp40" player:Print(2,"Hold action key to pick up or drop Medical Pratice 40") end end) ents.FindByName("equip_mp40"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_brewery"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "tradebrewery" player:Print(2,"Hold action key to pick up or drop Brewery Blaster") end end) ents.FindByName("equip_brewery"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_spitfire"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "tradespitfire" player:Print(2,"Hold action key to pick up or drop Spitfire") end end) ents.FindByName("equip_spitfire"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_mshotgun"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "trademshotgun" player:Print(2,"Hold action key to pick up or drop Military Shotgun") end end) ents.FindByName("equip_mshotgun"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_flintlock"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "tradeflintlock" player:Print(2,"Hold action key to pick up or drop Flintlock") end end) ents.FindByName("equip_flintlock"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_msmg"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "trademsmg" player:Print(2,"Hold action key to pick up or drop Military SMG") end end) ents.FindByName("equip_msmg"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_bmg"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "tradebmg" player:Print(2,"Hold action key to pick up or drop Auto BMG") end end) ents.FindByName("equip_bmg"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("equip_slugger"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "tradeslugger" player:Print(2,"Hold action key to pick up or drop Steel Slugger") end end) ents.FindByName("equip_slugger"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) end) end function OnPlayerConnected(player) if player:IsRealPlayer() then GetRandomName() player.HoldTime = 0 player.InteractWith = "nothing" player.InteractCooldown = false player.FirstPickUp = true player.TimesInfected = 0 player:AddCallback(ON_SPAWN, function(player) player.TimesInfected = 0 if WaveStart == true then player:StunPlayer(1,1,TF_STUNFLAGS_NORMALBONK) end end) player:AddCallback(ON_DEATH, function(player) -- to avoid dead players from speaking GetRandomName() end) end end function OnPlayerDisconnected(player) if player:IsRealPlayer() then GetRandomName() end end function OnWaveSpawnBot(bot, wave, tags) bot.lasthooked = bot --avoids nil value bot.LethalDelay = 10 * 66 --10 is wanted time, multiplying by 66 because the tick rate is 66, and the delay is reduced by 1 every tick until it is less than 1. bot:AddCallback(ON_DEATH, function(ent) if (bot:GetPlayerItemBySlot(0):GetItemName() == "The Huntsman") then timer.Simple(0.1, function() if not bot.lasthooked:InCond(101) and ( bot.lasthooked:IsValid() ) then bot.lasthooked:RemoveCond(25) end end) end end) end function RememberHooked(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if activator:GetPlayerItemBySlot(0):GetItemName() == "The Huntsman" then activator.lasthooked = caller end end function ReviveMe(_,activator) --local rand = math.random(6,12) activator:AddHealth(400,false) activator:RemoveCond(70) if SoloMode then activator:AddCond(77,3) timer.Simple(1, function() activator:PlaySound("Halloween.HeadlessBossAlert") activator:PlaySound("Halloween.HeadlessBossAlert") activator:PlaySound("Halloween.HeadlessBossAlert") end) timer.Simple(2, function() activator:PlaySound("Halloween.HeadlessBossBoo") activator:PlaySound("Halloween.HeadlessBossBoo") end) timer.Simple(3,function() activator:SetAttributeValue("attach particle effect static",nil) for _, others in pairs(ents.FindInSphere(activator:GetAbsOrigin(),147)) do if others:IsPlayer() and (others.m_iTeamNum == 2) then others:StunPlayer(6,0.67,TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON|TF_STUNFLAG_SLOWDOWN,activator) others:PlaySoundToSelf("Halloween.Merasmus_Stun") end end end) elseif LowMannMode then activator:AddCond(77,5) timer.Simple(3, function() activator:PlaySound("Halloween.HeadlessBossAlert") activator:PlaySound("Halloween.HeadlessBossAlert") activator:PlaySound("Halloween.HeadlessBossAlert") end) timer.Simple(4, function() activator:PlaySound("Halloween.HeadlessBossBoo") activator:PlaySound("Halloween.HeadlessBossBoo") end) timer.Simple(5,function() activator:SetAttributeValue("attach particle effect static",nil) for _, others in pairs(ents.FindInSphere(activator:GetAbsOrigin(),147)) do if others:IsPlayer() and (others.m_iTeamNum == 2) then others:StunPlayer(4.5,0.67,TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON|TF_STUNFLAG_SLOWDOWN,activator) others:PlaySoundToSelf("Halloween.Merasmus_Stun") end end end) else activator:AddCond(77,8) timer.Simple(6, function() activator:PlaySound("Halloween.HeadlessBossAlert") activator:PlaySound("Halloween.HeadlessBossAlert") activator:PlaySound("Halloween.HeadlessBossAlert") end) timer.Simple(7, function() activator:PlaySound("Halloween.HeadlessBossBoo") activator:PlaySound("Halloween.HeadlessBossBoo") end) timer.Simple(8,function() activator:PlaySound("Halloween.HeadlessBossBoo") activator:PlaySound("Halloween.HeadlessBossBoo") activator:SetAttributeValue("attach particle effect static",nil) for _, others in pairs(ents.FindInSphere(activator:GetAbsOrigin(),147)) do if others:IsPlayer() and (others.m_iTeamNum == 2) then others:StunPlayer(3,0.67,TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON|TF_STUNFLAG_SLOWDOWN,activator) others:PlaySoundToSelf("Halloween.Merasmus_Stun") end end end) end end function InfectMe(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if caller:IsRealPlayer() then caller.TimesInfected = caller.TimesInfected + 1 if PlayersAlive == 1 then caller:AddCond(43,10) caller:AddCond(39,10) caller:AddCond(42,10) caller:AddCond(41,10) caller:StunPlayer(10,0.4,TF_STUNFLAG_SLOWDOWN,activator) caller:StunPlayer(2.5,1,TF_STUNFLAGS_NORMALBONK,activator) caller:WeaponSwitchSlot(2) caller:SetAttributeValue("hud overlay","effects/gas_overlay") caller:AcceptInput("SetFogController","infected_fog") timer.Simple(2.5,function() caller:Print(3,"Administering antitoxin") end) timer.Simple(10,function() caller:SetAttributeValue("hud overlay","") caller:AcceptInput("SetFogController","thicc_fog") caller:StunPlayer(2,1,TF_STUNFLAGS_NORMALBONK,activator) caller:AddCond(30,30) end) else caller:AddCond(43,30) caller:AddCond(39,30) caller:AddCond(42,30) caller:AddCond(41,30) caller:StunPlayer(30,0.55,TF_STUNFLAG_SLOWDOWN,activator) caller:StunPlayer(5,1,TF_STUNFLAGS_NORMALBONK,activator) caller:WeaponSwitchSlot(2) caller:SetAttributeValue("hud overlay","effects/gas_overlay") caller:AcceptInput("SetFogController","infected_fog") timer.Simple(2.5,function() caller:Print(3,"Administering antitoxin") end) timer.Simple(30,function() caller:SetAttributeValue("hud overlay","") caller:AcceptInput("SetFogController","thicc_fog") caller:StunPlayer(3,1,TF_STUNFLAGS_NORMALBONK,activator) caller:AddCond(30,30) end) end if caller.TimesInfected > 3 then timer.Simple(3,function() caller:AcceptInput("SetFogController","fadeout_fog") caller:Print(3,"Out of antitoxin, injecting lethal dose") caller:StunPlayer(30,0.9,TF_STUNFLAG_SLOWDOWN,activator) timer.Simple(6,function() caller:AcceptInput("$Suicide") end) end) end end end function SlowMe(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit activator:SetAttributeValue("major move speed bonus",0.5) timer.Simple(0.5,function() activator:SetAttributeValue("major move speed bonus",nil) end) end function brewblast(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if caller:IsPlayer() and (caller.m_iTeamNum ~= activator.m_iTeamNum) then local rand = math.random(1,5) if rand == 1 then caller:AddCond(24,5) elseif rand == 2 then caller:AddCond(27,5) elseif rand == 3 then caller:AddCond(123,5) end end end