convar.SetValue("tf_resolve_stuck_players", 0) redscore = 0 bluescore = 0 announcercooldown = 0 announcerscoldedyou = false local TF_TEAM_RED = 2 local TF_TEAM_BLUE = 3 local ROUNDSTATE_RUNNING = 4 local ROUNDSTATE_WIN = 5 local ROUNDSTATE_SETUP = 10 local SPECTATOR_MODE_BODY = 1 local BOT_ATTRIBUTE_DISABLEDODGE = 16 local MAX_GASCANS = 10 --local DOMINATION_OBJECTIVE_WAVE = 2 local WAVE_SOUNDS = { "Announcer.AttackControlPoints", "Announcer.CaptureControlPoints", "", "", } local TIME_ADD_LINES = { "Announcer.TimeAdded", "Announcer.TimeAwarded", "Announcer.TimeAwardedSuccess", } local TIMER_TEXT_TABLE = { channel = 0, x = -1, y = 0.16, r1 = 255, g1 = 250, b1 = 245, a1 = 0, holdTime = 1.2, } local OVERTIME_TEXT_TABLE = { channel = 2, x = -1, y = 0.24, r1 = 255, g1 = 200, b1 = 200, a1 = 0, holdTime = 0.6, fadeoutTime = 1.6, } --[[ local DOM_TEXT_TABLE_RED = { channel = 0, x = 0.45, y = 0.15, r1 = 255, g1 = 50, b1 = 10, a1 = 0, holdTime = 0.8, } local DOM_TEXT_TABLE_BLUE = { channel = 2, x = 0.55, y = 0.15, r1 = 50, g1 = 150, b1 = 200, a1 = 0, holdTime = 0.8, } local DOMINATION_POINT_NAMES = { "cap_point_town", "cap_point_entrance", "cap_point_cliff", } ]] local WAVE_MINUTES = { 4, 0, 0, 0, } local WAVE_SECONDS = { 0, 0, 0, 0, } local WAVE_SPAWNS = { Vector(1215, 9127, 701), Vector(1665, 2058, 740), Vector(1215, 9127, 681), Vector(1215, 9127, 681), Vector(1215, 9127, 681), } local DOMINATION_MAX_POINTS = 125 local Resource = ents.FindByClass("tf_objective_resource") local Manager = ents.FindByClass("tf_player_manager") local Gamerules = ents.FindByClass("tf_gamerules") local Worldspawn = ents.FindByClass("worldspawn") --------------------------------------- local function Delay(delayduration) local globaltime = CurTime() local result = globaltime + delayduration return result end local function AnnouncerFix(linestring) for _, player in pairs(ents.GetAllPlayers()) do player:PlaySoundToSelf(linestring) end end function Deafen() for _, player in pairs(ents.GetAllPlayers()) do ents.FindByName("cmd"):AcceptInput("command", "soundfade 45 5 2 0", player) end end function Deafen2() for _, player in pairs(ents.GetAllPlayers()) do ents.FindByName("cmd"):AcceptInput("command", "soundfade 66 10 0 0", player) end end function OwnSentries(_, activator) for _, build in pairs(ents.FindAllByClass("obj_*")) do if build.m_hBuilder == nil then build.m_hBuilder = activator end end end function Set(list) local set = {} for _, l in ipairs(list) do set[l] = true end return set end function PlayerTeleport(_, activator) activator:Teleport(WAVE_SPAWNS[Resource.m_nMannVsMachineWaveCount]) end function OnWaveSpawnBot(bot, tags, tags) local taglist = Set(tags) if taglist["no_rise"] then return end local botorigin = bot:GetAbsOrigin() util.ParticleEffect("hammer_impact_button_dust", botorigin, nil, bot) bot:AddCond(TF_COND_INVULNERABLE_CARD_EFFECT, 3) bot:PlaySound("BloodMoon.Bot_Emerge") bot:Teleport(botorigin - Vector(0, 0, 100)) timer.Simple(0.015, function() timer.Create(0.015, function() local neworigin = bot:GetAbsOrigin() bot:Teleport(neworigin + Vector(0, 0, 1)) if IsValid(bot.m_hGroundEntity) then return false end end, 190) end) end function OnWaveInit(wave) overtime = false capturables = 0 announcerscoldedyou = false Interface = ents.FindByName("pop_interface") if wave ~= 1 then ents.FindByName("timewarp_effect_relay"):Trigger() end if wave == 1 then timer.Simple(0.1, function() for _, b in pairs(ents.FindAllByClass("obj_sentrygun")) do b.m_bMiniBuilding = 1 b.m_iMaxHealth = 100 b:SetHealth(100) b.m_nSkin = 2 b.m_nBody = 1 b.m_flModelScale = 0.75 b.m_vecMins = Vector(-15, -15, 0) b.m_vecMaxs = Vector(15, 15, 49.5) b.m_vecMinsPreScaled = Vector(-20, -20, 0) b.m_vecMaxsPreScaled = Vector(20, 20, 66) end end) end for _, player in pairs(ents.GetAllPlayers()) do player:ResetFakeSendProp("m_iObserverMode") end timer.Simple(1.5, function() Gamerules:PlayVOBlue(WAVE_SOUNDS[wave]) end) timer.Simple(0.03, function() AnnouncerFix("BloodMoon.Announcer_ShutTheFuckUp") end) -- minutehand = WAVE_MINUTES[wave] secondhand = WAVE_SECONDS[wave] -- redscore = 0 bluescore = 0 end function OnWaveFail(wave) if wave == 1 then ents.FindByName("timewarp_effect_relay"):Trigger() end end function OnGameTick() if Gamerules.m_iRoundState == ROUNDSTATE_WIN and Gamerules.m_iWinningTeam == TF_TEAM_RED then for _, player in pairs(ents.GetAllPlayers()) do if not player:IsAlive() then player:SetFakeSendProp("m_iObserverMode", SPECTATOR_MODE_BODY) end end end if overtime == true and capturables == 0 then ents.FindByName("lose_relay"):Trigger() end --[[ if Resource.m_nMannVsMachineWaveCount == DOMINATION_OBJECTIVE_WAVE and Gamerules.m_iRoundState == ROUNDSTATE_RUNNING then for _, player in pairs(ents.GetAllPlayers()) do player:ShowHudText(DOM_TEXT_TABLE_RED, redscore) player:ShowHudText(DOM_TEXT_TABLE_BLUE, bluescore) end end ]] end function TimerTick() if overtime == true and Gamerules.m_iRoundState == ROUNDSTATE_RUNNING then for _, player in pairs(ents.GetAllPlayers()) do player:ShowHudText(OVERTIME_TEXT_TABLE, "OVERTIME") end end if Gamerules.m_iRoundState ~= ROUNDSTATE_RUNNING or overtime == true then return end -- "mission ends" responses if minutehand == 5 and secondhand == 1 then Gamerules:PlayVOBlue("Announcer.RoundEnds5minutes") elseif minutehand == 1 and secondhand == 1 then Gamerules:PlayVOBlue("Announcer.RoundEnds60seconds") elseif minutehand == 0 and secondhand == 31 then Gamerules:PlayVOBlue("Announcer.RoundEnds30seconds") elseif minutehand == 0 and secondhand == 11 then Gamerules:PlayVOBlue("Announcer.RoundEnds10seconds") elseif minutehand == 0 and secondhand == 6 then Gamerules:PlayVOBlue("Announcer.RoundEnds5seconds") elseif minutehand == 0 and secondhand == 5 then Gamerules:PlayVOBlue("Announcer.RoundEnds4seconds") elseif minutehand == 0 and secondhand == 4 then Gamerules:PlayVOBlue("Announcer.RoundEnds3seconds") elseif minutehand == 0 and secondhand == 3 then Gamerules:PlayVOBlue("Announcer.RoundEnds2seconds") elseif minutehand == 0 and secondhand == 2 then Gamerules:PlayVOBlue("Announcer.RoundEnds1seconds") end -- if minutehand == 0 and secondhand == 0 then if capturables > 0 then overtime = true Gamerules:PlayVOBlue("Game.Overtime") return else ents.FindByName("lose_relay"):Trigger() end end secondhand = secondhand - 1 if secondhand < 0 then secondhand = 59 minutehand = minutehand - 1 end for _, player in pairs(ents.GetAllPlayers()) do if secondhand < 10 then player:ShowHudText(TIMER_TEXT_TABLE, minutehand .. ":0" .. secondhand) else player:ShowHudText(TIMER_TEXT_TABLE, minutehand .. ":" .. secondhand) end end end function CapturableAdd() capturables = capturables + 1 -- util.PrintToChatAll(capturables) end function CapturableRemove() capturables = capturables - 1 -- util.PrintToChatAll(capturables) end function PointCaptured() overtime = false minutehand = minutehand + 3 Gamerules:PlayVOBlue(TIME_ADD_LINES[math.random(1, 3)]) Gamerules:PlayVO("Hud.PointCaptured") timer.Simple(0.05, function() CapturableRemove() end) for _, player in pairs(ents.GetAllPlayers()) do player:ShowHudText({ channel = 3, x = -1, y = 0.28, r1 = 0, g1 = 255, b1 = 0, a1 = 0, holdTime = 1.5, fadeoutTime = 1.5, }, "+3:00") end end ents.AddCreateCallback("tf_weapon_*", function(wep) -- temporary solution if wep == nil then return end timer.Simple(0.1, function() if not wep.m_hOwner then return end local owner = wep.m_hOwner timer.Create(0.05, function() if IsValid(owner) and IsValid(wep) and owner.m_iTeamNum == TF_TEAM_BLUE then wep.m_iTeamNum = TF_TEAM_RED else return false end end, 0) end) end) ents.AddCreateCallback("env_sniperdot", function(laser) laser:SetFakeSendProp("m_CollisionGroup", COLLISION_GROUP_DEBRIS) laser:SetFakeSendProp("m_iTeamNum", TEAM_SPECTATOR) end) --scrapped domination logic --[[ function scoredebug() bluescore = 100 end function AddRedScore() redscore = redscore + 1 if redscore > 50 and bluescore < (redscore * 0.333) then if announcercooldown <= Delay(0) and announcerscoldedyou == false then AnnouncerFix("BloodMoon.Announcer_NeverCatch") announcercooldown = Delay(2.5) announcerscoldedyou = true end end if redscore == (DOMINATION_MAX_POINTS * 0.8) and announcercooldown <= Delay(0) then AnnouncerFix("BloodMoon.Announcer_RedGettingClose") announcercooldown = Delay(2.1) end if redscore == DOMINATION_MAX_POINTS then ents.FindByName("lose_relay"):Trigger() end end function AddBlueScore() bluescore = bluescore + 1 if bluescore == (DOMINATION_MAX_POINTS * 0.8) and announcercooldown <= Delay(0) then AnnouncerFix("BloodMoon.Announcer_BlueGettingClose") announcercooldown = Delay(1.9) end if bluescore == DOMINATION_MAX_POINTS then ents.FindByName("win_relay"):Trigger() end if announcerscoldedyou == true and bluescore > redscore then Gamerules:PlayVOBlue("Announcer.AM_KillStreak01") end if bluescore >= 15 then Interface:KillWavespawn("w2_point1") Interface:PauseWavespawn("w2_support_1") elseif bluescore >= 40 then Interface:KillWavespawn("w2_point2") Interface:PauseWavespawn("w2_support_2") elseif bluescore >= 90 then Interface:KillWavespawn("w2_point3") Interface:PauseWavespawn("w3_support_3") end end function WandererBehaviorLoop(_, activator) activator:BotCommand("interrupt_action -posent " .. DOMINATION_POINT_NAMES[math.random(1,3)] .. " -duration" .. math.random(1,10) .. " -waituntildone -distance " .. math.random(200,600)) activator:RunScriptCode("self.AddBotAttribute(" .. BOT_ATTRIBUTE_DISABLEDODGE .. ")", activator) end ]]