-- Note: I barely made any of this -- I copied most of this from Washy and Sntr to learn how this works -- kudos to them for figuring out how any of this works local CurrectWave = 1 local EventType = nil local BonusCashTime = 0 local BonusCash = 1 local ImmuneToCure = false function OnWaveStart() --stuff I made on my own PowerupTable = {[1] = "Restore", [2] = "GoldenZombies", [3] = "WeakerZombies", [4] = "TeamResistance", [5] = "LifeSteal", [6] = "SafeGuard", [7] = "StrongArms"} PowerupTableIndex = 1 ShuffleInPlace(PowerupTable) PowerupTableRedemp = { [1] = "Retribution", [2] = "Knockout"} PowerupTableIndexRedemp = 1 ShuffleInPlace(PowerupTableRedemp) EventTable = { [1] = "Ghouls", [2] = "Blackout", [3] = "Armored Zombies", [4] = "Blood Moon", [5] = "Ammopack Shortage", [6] = "Reduced Funds", -- IRS hour [7] = "Medical Shortage", [8] = "Golden Rain", [9] = "Sold Out" } EventTableIndex = 1 ShuffleInPlace(EventTable) ImmuneToCure = false EventType = nil ents.FindByName("fog_controller"):AcceptInput("SetColor","148 145 155 400") ents.FindByName("fog_controller"):AcceptInput("SetColorSecondary","168 174 176 250") ents.FindByName("fog_controller"):AcceptInput("SetStartDist","1000") ents.FindByName("fog_controller"):AcceptInput("SetEndDist","12000") ents.FindByName("fog_controller"):AcceptInput("SetMaxDensity","1") ents.FindByName("cc_effect"):AcceptInput("Disable") end function OnWaveReset(wave) --stuff I made on my own EventType = nil ents.FindByName("fog_controller"):AcceptInput("SetColor","148 145 155 400") ents.FindByName("fog_controller"):AcceptInput("SetColorSecondary","168 174 176 250") ents.FindByName("fog_controller"):AcceptInput("SetStartDist","1000") ents.FindByName("fog_controller"):AcceptInput("SetEndDist","12000") ents.FindByName("fog_controller"):AcceptInput("SetMaxDensity","1") ents.FindByName("cc_effect"):AcceptInput("Disable") end function Event() --stuff I made on my own EventType = nil ents.FindByName("fog_controller"):AcceptInput("SetColor","148 145 155 400") ents.FindByName("fog_controller"):AcceptInput("SetColorSecondary","168 174 176 250") ents.FindByName("fog_controller"):AcceptInput("SetStartDist","1000") ents.FindByName("fog_controller"):AcceptInput("SetEndDist","12000") ents.FindByName("fog_controller"):AcceptInput("SetMaxDensity","1") ents.FindByName("cc_effect"):AcceptInput("Disable") for _, station in pairs(ents.FindAllByClass("func_upgradestation")) do station:AcceptInput("Enable") end BonusCash = 1 if math.random(1,5) == 1 then for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,'Event: ' .. EventTable[EventTableIndex] .. '!') end end if EventTable[EventTableIndex] == "Ghouls" then EventType = 1 elseif EventTable[EventTableIndex] == "Blackout" then EventType = 2 ents.FindByName("fog_controller"):AcceptInput("SetColor","0 0 0 400") ents.FindByName("fog_controller"):AcceptInput("SetColorSecondary","0 0 0 400") ents.FindByName("fog_controller"):AcceptInput("SetStartDist","-1000") ents.FindByName("fog_controller"):AcceptInput("SetEndDist","500") ents.FindByName("fog_controller"):AcceptInput("SetMaxDensity","0.99") ents.FindByName("cc_effect"):AcceptInput("Enable") elseif EventTable[EventTableIndex] == "Armored Zombies" then EventType = 3 elseif EventTable[EventTableIndex] == "Blood Moon" then EventType = 4 ents.FindByName("fog_controller"):AcceptInput("SetColor","110 26 20 400") ents.FindByName("fog_controller"):AcceptInput("SetColorSecondary","110 26 20 400") ents.FindByName("fog_controller"):AcceptInput("SetStartDist","-1000") ents.FindByName("fog_controller"):AcceptInput("SetEndDist","500") ents.FindByName("fog_controller"):AcceptInput("SetMaxDensity","0.5") elseif EventTable[EventTableIndex] == "Ammopack Shortage" then EventType = 5 elseif EventTable[EventTableIndex] == "Reduced Funds" then EventType = 6 BonusCash = 0.2 elseif EventTable[EventTableIndex] == "Medical Shortage" then EventType = 7 elseif EventTable[EventTableIndex] == "Golden Rain" then EventType = 8 elseif EventTable[EventTableIndex] == "Sold Out" then EventType = 9 for _, station in pairs(ents.FindAllByClass("func_upgradestation")) do station:AcceptInput("Disable") end end if EventTableIndex == 9 then ShuffleInPlace(EventTable) EventTableIndex = 0 end EventTableIndex = EventTableIndex + 1 end end function RestoreAmmo(_,activator) activator:RefillAmmo() end function AddCashOnKillNormal() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then local amount = 50 * BonusCash player:AddCurrency(amount) end end end function AddCashOnKillElite() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then local amount = 250 * BonusCash player:AddCurrency(amount) end end end function AddCashOnKillNormalReduced() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then local amount = 25 * BonusCash player:AddCurrency(amount) end end end function AddCashOnKillEliteReduced() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then local amount = 100 * BonusCash player:AddCurrency(amount) end end 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 OnPlayerConnected(player) -- powerup spawning if player:IsRealPlayer() then player:AddCallback(ON_DEATH, function() local number = math.random(1,100) if number <= 25 then -- 25% chance SpawnRedempPowerup(player) end end); else player:AddCallback(ON_DEATH, function() local number = math.random(1,100) if number <= 2 then -- 2% chance SpawnPowerup(player) end end); player:AddCallback(ON_DAMAGE_RECEIVED_PRE, function(ent, damage) if player:InCond(123) and (damage.Attacker:IsRealPlayer()) then local mult = 1 local applier = player:GetConditionProvider(123) if IsValid(applier) and (IsValid(applier:GetPlayerItemBySlot(1))) then mult = applier:GetPlayerItemBySlot(1):GetAttributeValue("CARD: damage bonus") end if mult == nil then mult = 1 end player:RemoveCond(123) damage.Damage = 350 * mult damage.DamageType = DMG_BURN --damage.DamageCustom = TF_DMG_CUSTOM_TAUNTATK_ARMAGEDDON --custom kill icon player:TakeDamage(damage) player:IgnitePlayerDuration(10,damage.Attacker) ents.FindByName("EOI_fx_spawner"):Teleport(player:GetAbsOrigin()) ents.FindByName("EOI_fx_spawner"):AcceptInput("ForceSpawn") eoi_scan(ent,damage.Attacker) end end) end end function eoi_scan(ent,attacker) --scan loop for _, others in pairs(ents.FindInSphere(ent:GetAbsOrigin(),192)) do if others:IsBot() then if others:InCond(123) then local mult = 1 local applier = others:GetConditionProvider(123) if IsValid(applier) and (IsValid(applier:GetPlayerItemBySlot(1))) then mult = applier:GetPlayerItemBySlot(1):GetAttributeValue("CARD: damage bonus") end if mult == nil then mult = 1 end others:RemoveCond(123) others:TakeDamage({Damage = 350 * mult, Attacker = attacker, DamageType = DMG_BURN}) others:IgnitePlayerDuration(10,attacker) ents.FindByName("EOI_fx_spawner"):Teleport(others:GetAbsOrigin()) ents.FindByName("EOI_fx_spawner"):AcceptInput("ForceSpawn") eoi_scan(ent,attacker) end end end end function OnWaveSpawnBot(bot, wave, tags) if EventType == 1 then bot:Addcond(28,-1) end if EventType == 3 then bot:SetAttributeValue("dmg taken increased",0.33) --bot:SetAttributeValue("dmg from ranged reduced",0.33) --bot:SetAttributeValue("mult dmgtaken from melee",0.33) end if EventType == 4 then bot:SetAttributeValue("major move speed bonus",1.5) bot:SetAttributeValue("dmg penalty vs players",2) --bot:SetAttributeValue("damage bonus",2) end end function SpawnPowerup(player) -- normal powerups ents.FindByName(PowerupTable[PowerupTableIndex] .. "_spawner"):Teleport(player:GetAbsOrigin()) ents.FindByName(PowerupTable[PowerupTableIndex] .. "_spawner"):AcceptInput("ForceSpawn") if PowerupTableIndex == 7 then ShuffleInPlace(PowerupTable) PowerupTableIndex = 0 end PowerupTableIndex = PowerupTableIndex + 1 end function SpawnRedempPowerup(player) -- redemption powerups ents.FindByName(PowerupTableRedemp[PowerupTableIndexRedemp] .. "_spawner"):Teleport(player:GetAbsOrigin()) ents.FindByName(PowerupTableRedemp[PowerupTableIndexRedemp] .. "_spawner"):AcceptInput("ForceSpawn") if PowerupTableIndexRedemp == 2 then ShuffleInPlace(PowerupTableRedemp) PowerupTableIndexRedemp = 0 end PowerupTableIndexRedemp = PowerupTableIndexRedemp + 1 end function ActivateRestore() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AddHealth(500,0) player:RefillAmmo() player:Print(2,"Players And Ammo Restored!") player:PlaySoundToSelf("Halloween.spell_overheal") end end end function ActivateGoldenZombies() BonusCashTime = 1980 -- 30 seconds, 66 ticks in a second for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Bonus Cash On Kill!") player:PlaySoundToSelf("Powerup.PickUpBase") timer.Simple(27, function() player:PlaySoundToSelf("WeaponMedi_Shield.Retract") end) end end end function ActivateWeakerZombies() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Weaker Zombies!") player:PlaySoundToSelf("Powerup.PickUpPlague") end end end function ActivateTeamResistance() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Team Resistance!") player:PlaySoundToSelf("Powerup.PickUpResistance") player:AddCond(93,30) end end end function ActivateLifeSteal(_,activator) -- the _ is required to make this work otherwise it gets a nil value if activator:IsRealPlayer() then activator:Print(2,"Life Steal!") activator:PlaySoundToSelf("Powerup.PickUpVampire") activator:SetAttributeValue("heal on hit for slowfire", 10) activator:SetAttributeValue("heal on kill", 50) timer.Simple(60, function() activator:SetAttributeValue("heal on hit for slowfire", nil) activator:SetAttributeValue("heal on kill", nil) end) end end function ActivateStrongArms(_,activator) if activator:IsRealPlayer() then activator:Print(2,"Strong Arms") activator:PlaySoundToSelf("Powerup.PickUpStrength") activator:GetPlayerItemBySlot(2):SetAttributeValue("dmg penalty vs players",5) timer.Simple(30, function() activator:GetPlayerItemBySlot(2):SetAttributeValue("dmg penalty vs players", nil) end) end end function ActivateSafeGuard(_,activator) if activator:IsRealPlayer() then if activator:InCond(129) == false then activator:Print(2,"You Will Be Revived Next Death!") activator:PlaySoundToSelf("Powerup.PickUpPrecision") activator:AddCond(70,-1) activator:AddCond(129,-1) else activator:Print(2,"Temporary Safeguard!") activator:PlaySoundToSelf("Powerup.PickUpPrecision") activator:AddCond(5,2.5) activator:AddCond(32,5) end end end function ActivateRetribution() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Retribution!") player:PlaySoundToSelf("Powerup.PickUpTemp.Uber") player:AddCond(56,30) -- crit boost end end end function ActivateKnockout() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Knockout!") player:PlaySoundToSelf("Powerup.PickUpSupernovaActivate") else player:TakeDamage({Attacker = player, Damage = 50}) end end end function OnGameTick() if BonusCashTime > 0 then BonusCash = 4 BonusCashTime = BonusCashTime -1 elseif EventType == 6 then BonusCash = 0.2 else BonusCash = 1 end if EventType == 5 then for _, pack in pairs(ents.FindAllByClass("item_ammopack_medium")) do pack:AcceptInput("Disable") end for _, pack in pairs(ents.FindAllByClass("item_ammopack_full")) do pack:AcceptInput("Disable") end else for _, pack in pairs(ents.FindAllByClass("item_ammopack_medium")) do pack:AcceptInput("Enable") end for _, pack in pairs(ents.FindAllByClass("item_ammopack_full")) do pack:AcceptInput("Enable") end end if EventType == 7 then for _, pack in pairs(ents.FindAllByClass("item_healthkit_medium")) do pack:AcceptInput("Disable") end for _, pack in pairs(ents.FindAllByClass("item_healthkit_full")) do pack:AcceptInput("Disable") end else for _, pack in pairs(ents.FindAllByClass("item_healthkit_medium")) do pack:AcceptInput("Enable") end for _, pack in pairs(ents.FindAllByClass("item_healthkit_full")) do pack:AcceptInput("Enable") end end CurrectWave = ents.FindByClass('tf_objective_resource').m_nMannVsMachineWaveCount if ImmuneToCure == true then for _, player in pairs(ents.GetAllPlayers()) do player:RemoveCond(43) end end for _, player in pairs(ents.GetAllPlayers()) do if player:IsPlayer() then if EventType == 8 then --Golden Rain player:AddCond(24,0.5) end end if player:IsRealPlayer() then local curHealth = player.m_iHealth if player:InCond(112) == true then -- attributes to add when plagued player:SetAttributeValue("no double jump", 1) player:AddCond(126, -1) else player:SetAttributeValue("no double jump", nil) player:RemoveCond(126) end if player:InCond(129) == true and curHealth == 1 then -- safegaurd revive function player:AddCond(5,3.5) player:AddCond(32,6) player:AddHealth(550,0) player:PlaySoundToSelf("Powerup.PickUpSupernova") player:StunPlayer(1,1,TF_STUNFLAG_BONKSTUCK) timer.Simple(0.1, function() -- delay so the revive can work player:RemoveCond(129) end) end else if player:InCond(12) == true then -- weaker zombies function player:SetAttributeValue("dmg taken increased", 2) player:SetAttributeValue("move speed penalty", 0.5) player:SetAttributeValue("damage bonus HIDDEN", 0.5) else player:SetAttributeValue("dmg taken increased", nil) player:SetAttributeValue("move speed penalty", nil) player:SetAttributeValue("damage bonus HIDDEN", nil) end if EventType == 1 then player:Addcond(64,-1) else player:RemoveCond(64) end end end end