-- Note: Powerup spawn logic and some of the power logic and the core of the interact logic was copied from bauernhof local CurrectWave = 0 local EventType = nil local BonusCashTime = 0 local BonusCash = 1 local HardMode = false local InWave = false local t1_cash_amount = 100 local t1_token_amount = 1 local t2_cash_amount = 1500 local t2_token_amount = 10 local t3_cash_amount = 4000 local t3_token_amount = 30 local t4_cash_amount = 12500 local t4_token_amount = 100 local HellTokenTable = { [1] = "-299 3433 32", [2] = "1075 3953 32", [3] = "-647 1783 216", [4] = "-848 474 -156", [5] = "-430 131 368", [6] = "1010 -2222 -126", [7] = "2223 44 32", [8] = "-27 2497 -427" } local HellTokenSpawnTable = { [1] = Vector(-299, 3433, 32), [2] = Vector(1075, 3953, 32), [3] = Vector(-647, 1783, 216), [4] = Vector(-848, 474, -156), [5] = Vector(-430, 131, 368), [6] = Vector(1010, -2222, -126), [7] = Vector(2223, 44, 32), [8] = Vector(-27, 2497, -427) } local FirePillarSpawnTable = { [1] = Vector(1886, -645, 256), [2] = Vector(2038, 497, 192), [3] = Vector(925, 62, -32), [4] = Vector(1022, 547, 207), [5] = Vector(1667, 1110, 37), [6] = Vector(1972, 1749, 178), [7] = Vector(1206, 1784, 31), [8] = Vector(614, 2253, -61), [9] = Vector(1281, 3028, 32), [10] = Vector(1075, 3953, 32), [11] = Vector(-18, 2946, -183), [12] = Vector(580, 4037, -180), [13] = Vector(-467, 3397, 32), [14] = Vector(-538, 2070, 2), [15] = Vector(-139, 1501, 18), [16] = Vector(-908, 1411, 218), [17] = Vector(-649, 873, 271), [18] = Vector(-6, 890, 54), [19] = Vector(-744, -245, 366), [20] = Vector(-436, -355, 17), [21] = Vector(-365, -828, 240), [22] = Vector(244, -1233, -53), [23] = Vector(999, -821, -38), [24] = Vector(579, -798, 240), [25] = Vector(1494, -1296, 35), [26] = Vector(523, -1829, -149), [27] = Vector(-854, 147, -158), [28] = Vector(-17, 2353, -397), [29] = Vector(1311, 3899, 32), [30] = Vector(915, 2521, -181), [31] = Vector(-492, 136, 368), [32] = Vector(879, -327, 192), [33] = Vector(77, 4069, -103), [34] = Vector(111, 195, 31), [35] = Vector(1578, -342, 192), [36] = Vector(-529, 2982, 32), [37] = Vector(2320, 64, -200) } local FirePillarIndex = 1 local FirePillarDelay = 5 * 66 local FirePillarCount = 3 local weapontable = { [1] = { {name = "Scrap Shotgun", slot = 0}, {name = "Scrap RPG", slot = 0}, {name = "Scrap Needle Gun", slot = 0}, {name = "Homemade Flamethrower", slot = 0}, {name = "Old Trooper Rifle", slot = 0}, {name = "Peg Leg", slot = 0}, {name = "Explosive Gas Can", slot = 1}, {name = "Scrap Pistol", slot = 1}, {name = "Scrap SMG", slot = 1}, {name = "Scrap Shield", slot = 1}, {name = "Homemade Grenade", slot = 1}, {name = "Prototype Medigun", slot = 1}, {name = "Wooden Bat", slot = 2}, {name = "Golf Club", slot = 2}, {name = "Nailed Plank", slot = 2}, {name = "Wrench", slot = 2}, }, [2] = { {name = "Basic Shotgun", slot = 0}, {name = "Basic RPG", slot = 0}, {name = "Needle Gun", slot = 0}, {name = "Flamethrower", slot = 0}, {name = "Metal Boots", slot = 0}, {name = "Bow", slot = 0}, {name = "Hunting Rifle", slot = 0}, {name = "Grenade Launcher", slot = 0}, {name = "Chain Gun", slot = 0}, {name = "Basic SMG", slot = 1}, {name = "Basic Pistol", slot = 1}, {name = "Frag Grenade", slot = 1}, {name = "Wooden Shield", slot = 1}, {name = "Medigun", slot = 1}, {name = "Energy Drink", slot = 1}, {name = "Stickybomb Launcher", slot = 1}, {name = "Cleaver", slot = 1}, {name = "Jar of Piss", slot = 1}, {name = "Boxing Gloves", slot = 2}, {name = "Bonesaw", slot = 2}, {name = "Metal Bat", slot = 2}, {name = "Cursed Sword", slot = 2}, {name = "Jagged Wrench", slot = 2}, {name = "Fire Ax", slot = 2}, }, [3] = { {name = "Double Barrel Shotgun", slot = 0}, {name = "The H.I.V.E. Launcher", slot = 0}, {name = "Nail Gun", slot = 0}, {name = "Dragon's Breath", slot = 0}, {name = "Compound Bow", slot = 0}, {name = "Sniper Rifle", slot = 0}, {name = "Multi-Grenade Launcher", slot = 0}, {name = "N.R.G. Powered Bolts", slot = 0}, {name = "Leather Boots", slot = 0}, {name = "Minigun", slot = 0}, {name = "LMG", slot = 1}, {name = "Hand Cannon", slot = 1}, {name = "Frontline General", slot = 1}, {name = "Shockgun", slot = 1}, {name = "Impact Grenade", slot = 1}, {name = "Metal Shield", slot = 1}, {name = "Quick-Fix", slot = 1}, {name = "Heal-A-Cola", slot = 1}, {name = "Spikeybomb Launcher", slot = 1}, {name = "Flare Gun", slot = 1}, {name = "Jump Pack", slot = 1}, {name = "Jar of 'milk'", slot = 1}, {name = "Kukri", slot = 2}, {name = "Rejuv-saw", slot = 2}, {name = "Spiky Wrench", slot = 2}, {name = "Long Sword", slot = 2}, {name = "Spiked Bat", slot = 2}, }, [4] = { {name = "Auto Shotgun", slot = 0}, {name = "Laser Bazooka", slot = 0}, {name = "Machinal Bow", slot = 0}, {name = "50. Cal Sniper Rifle", slot = 0}, {name = "Particle Rifle", slot = 0}, {name = "Combustor", slot = 0}, {name = "Multi-Launcher", slot = 0}, {name = "Riot Shredder", slot = 0}, {name = "The Cure", slot = 0}, {name = "Freeze Thrower", slot = 0}, {name = "Long Fall Boots", slot = 0}, {name = "Ray Gun", slot = 1}, {name = "HMG", slot = 1}, {name = "Incendiary Grenade", slot = 1}, {name = "Minelayer", slot = 1}, {name = "Jetpack", slot = 1}, {name = "Smart Flare", slot = 1}, {name = "Reverse Medigun", slot = 1}, {name = "Crit-A-Cola Deluxe", slot = 1}, {name = "The Forbidden Jar", slot = 1}, {name = "Stun Shield", slot = 1}, {name = "Halberd", slot = 2}, {name = "Steel Fists", slot = 2}, {name = "Knife", slot = 2}, {name = "Candy Cane", slot = 2}, {name = "Bear Claws", slot = 2}, {name = "Teleporter Wrench", slot = 2}, } } function OnWaveStart() --stuff I made on my own PowerupTable = {[1] = "Restore", [2] = "GoldenZombies", [3] = "WeakerZombies", [4] = "TeamResistance", [5] = "LifeSteal", [6] = "SafeGuard", [7] = "StrongArms", [8] = "Extraammo", [9] = "Treasurehunter" } PowerupTableIndex = 1 ShuffleInPlace(PowerupTable) PowerupTableRedemp = { [1] = "Retribution", [2] = "Knockout", [3] = "Sentryhats" } 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", [10] = "Unsoldered", [11] = "Survivors", [12] = "Corrupteds", [13] = "Blazing Zombies", [14] = "Hell Storm", [15] = "Power Surge", [16] = "Fog" } EventTableIndex = 1 ShuffleInPlace(EventTable) ShuffleInPlace(FirePillarSpawnTable) EventType = nil ents.FindByName("fog_underworld"):AcceptInput("SetColor","102 49 0") ents.FindByName("fog_underworld"):AcceptInput("SetColorSecondary","62 23 0") ents.FindByName("fog_underworld"):AcceptInput("SetStartDist","0") ents.FindByName("fog_underworld"):AcceptInput("SetEndDist","5500") ents.FindByName("fog_underworld"):AcceptInput("SetMaxDensity","0.6") ents.FindByName("cc_effect"):AcceptInput("Disable") if HardMode then for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf('ui/duel_challenge_accepted.wav') end end end InWave = true for index,_ in pairs(HellTokenTable) do local KeyValues = { model = "models/pickups/emitter.mdl", skin = 1, origin = HellTokenTable[index], fademindist = 1800, fademaxdist = 2400 } ents.CreateWithKeys("prop_dynamic", KeyValues, true, true) end SetHellTokenTimer(20) for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. player.HellTokens) end end end function RemoveHellToken(amount, activator) if activator:IsRealPlayer() then activator.HellTokens = activator.HellTokens - amount activator:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. activator.HellTokens) end end function AddHellToken(_,activator) if activator:IsRealPlayer() then activator.HellTokens = activator.HellTokens + 1 activator:Print(2,"You have collected 1 Hell Token!") activator:PlaySoundToSelf("misc/halloween/spell_pickup.wav") activator:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. activator.HellTokens) end end function AddTenHellToken(_,activator) if activator:IsRealPlayer() then activator.HellTokens = activator.HellTokens + 10 activator:Print(2,"You have collected 10 Hell Tokens!") activator:PlaySoundToSelf("misc/halloween/spell_pickup_rare.wav") activator:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. activator.HellTokens) end end function AddDevHellToken(_,activator) if activator:IsRealPlayer() then activator.HellTokens = activator.HellTokens + 10000 activator:Print(2,"You have collected 10 Hell Tokens!") activator:PlaySoundToSelf("misc/halloween/spell_pickup_rare.wav") activator:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. activator.HellTokens) end end function OnWaveReset(wave) --stuff I made on my own EventType = nil InWave = false ents.FindByName("fog_underworld"):AcceptInput("SetColor","102 49 0") ents.FindByName("fog_underworld"):AcceptInput("SetColorSecondary","62 23 0") ents.FindByName("fog_underworld"):AcceptInput("SetStartDist","0") ents.FindByName("fog_underworld"):AcceptInput("SetEndDist","5500") ents.FindByName("fog_underworld"):AcceptInput("SetMaxDensity","0.6") ents.FindByName("cc_effect"):AcceptInput("Disable") pcall(timer.Stop, CreationTimer) pcall(timer.Stop, display) for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player.HellTokens = 0 player.Deaths = 0 player.ConsecutiveWavesSurvived = 0 player.ConsecutiveWavesKilled = 0 end end end function GiveSurvivorCash() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AddCurrency(1000) end end end function WaveEndChecks() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then if player.Deaths >= 5 then player.Deaths = 0 player.HellTokens = player.HellTokens + 25 player:Print(2,"Catch Up Bonus: +25 Hell Tokens") player:PlaySoundToSelf("misc/halloween/spell_pickup_rare.wav") player:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. player.HellTokens) end if not player:IsAlive() then player.ConsecutiveWavesKilled = player.ConsecutiveWavesKilled + 1 end if ( player.ConsecutiveWavesKilled >= 1 ) and ( player:IsAlive() ) then if ( player.ConsecutiveWavesKilled >= 3 ) and ( player:IsAlive() ) then local add = player.ConsecutiveWavesKilled * 2 player.HellTokens = player.HellTokens + add player:Print(2,'Comeback Bonus: +' .. add .. ' Hell Tokens') player:PlaySoundToSelf("misc/halloween/spell_pickup.wav") player:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. player.HellTokens) end player.ConsecutiveWavesKilled = 0 end end end end function EnableHardMode() if ( not HardMode ) and ( not InWave ) then HardMode = true util.PrintToChatAll("Hard more enabled") for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf('ui/duel_challenge.wav') end end elseif not InWave then HardMode = false util.PrintToChatAll("Hard more disabled") for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf('ui/duel_challenge_rejected.wav') end end else util.PrintToChatAll("This setting cannot be changed during the wave") end end function Event() --stuff I made on my own if EventType == 11 then for _, player in pairs(ents.GetAllPlayers()) do if ( tostring(player:GetPlayerName()) == "Survivor" ) and ( player:IsBot() ) and ( player:IsAlive() ) then GiveSurvivorCash() player:AcceptInput("$Suicide") end end end if EventType == 12 then for _, player in pairs(ents.GetAllPlayers()) do if ( string.match(tostring(player:GetPlayerName()), "Corrupted") ) and ( player:IsBot() ) and ( player:IsAlive() ) then player:AcceptInput("$Suicide") end end ents.FindByName("interface"):AcceptInput("$PauseWavespawn", "Corrupteds") end EventType = nil ents.FindByName("fog_underworld"):AcceptInput("SetColor","102 49 0") ents.FindByName("fog_underworld"):AcceptInput("SetColorSecondary","62 23 0") ents.FindByName("fog_underworld"):AcceptInput("SetStartDist","0") ents.FindByName("fog_underworld"):AcceptInput("SetEndDist","5500") ents.FindByName("fog_underworld"):AcceptInput("SetMaxDensity","0.6") 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 ) or ( HardMode ) then if EventTable[EventTableIndex] == "Ghouls" then EventType = 1 elseif EventTable[EventTableIndex] == "Blackout" then EventType = 2 ents.FindByName("fog_underworld"):AcceptInput("SetColor","0 0 0 400") ents.FindByName("fog_underworld"):AcceptInput("SetColorSecondary","0 0 0 400") ents.FindByName("fog_underworld"):AcceptInput("SetStartDist","-1000") ents.FindByName("fog_underworld"):AcceptInput("SetEndDist","500") ents.FindByName("fog_underworld"):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_underworld"):AcceptInput("SetColor","110 26 20 400") ents.FindByName("fog_underworld"):AcceptInput("SetColorSecondary","110 26 20 400") ents.FindByName("fog_underworld"):AcceptInput("SetStartDist","-1000") ents.FindByName("fog_underworld"):AcceptInput("SetEndDist","500") ents.FindByName("fog_underworld"):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 elseif EventTable[EventTableIndex] == "Unsoldered" then EventType = 10 local engie = false for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then if player.m_iClass == 9 then engie = true player:SetAttributeValue("engy sentry fire rate increased", 4) player:SetAttributeValue("mult firerocket rate", 4) break end end end if not engie then if EventTableIndex == 17 then ShuffleInPlace(EventTable) EventTableIndex = 0 end EventTableIndex = EventTableIndex + 1 Event() return end elseif EventTable[EventTableIndex] == "Survivors" then EventType = 11 ents.FindByName("interface"):AcceptInput("$ResumeWavespawn", "Survivors") timer.Simple(1, function() ents.FindByName("interface"):AcceptInput("$PauseWavespawn", "Survivors") end) CreateAnnotation("Survivors have spawned. Assist them for a reward!", 8, "644 4099 -180") elseif EventTable[EventTableIndex] == "Corrupteds" then EventType = 12 ents.FindByName("interface"):AcceptInput("$ResumeWavespawn", "Corrupteds") CreateAnnotation("Corrupted Bots have spawned! They attack both sides.", 8, "590 1016 210") elseif EventTable[EventTableIndex] == "Blazing Zombies" then EventType = 13 elseif EventTable[EventTableIndex] == "Hell Storm" then EventType = 14 elseif EventTable[EventTableIndex] == "Power Surge" then EventType = 15 timer.Simple(3,function() local rand = math.random(1,12) if rand == 1 then --this shit is horrible ActivateRestore() elseif rand == 2 then ActivateGoldenZombies() elseif rand == 3 then ActivateWeakerZombies() elseif rand == 4 then ActivateTeamResistance() elseif rand == 5 then ActivateLifeStealGlobal() elseif rand == 6 then ActivateSafeGuardGlobal() elseif rand == 7 then ActivateStrongArmsGlobal() elseif rand == 8 then ActivateExtraammoGlobal() elseif rand == 9 then ActivateTreasurehunter() elseif rand == 10 then ActivateRetribution() elseif rand == 11 then ActivateKnockout() elseif rand == 12 then ActivateSentryhats() end end) elseif EventTable[EventTableIndex] == "Fog" then EventType = 16 ents.FindByName("fog_underworld"):AcceptInput("SetColor","84 82 82") ents.FindByName("fog_underworld"):AcceptInput("SetColorSecondary","84 82 82") --ents.FindByName("fog_underworld"):AcceptInput("SetColor","8 8 13") --ents.FindByName("fog_underworld"):AcceptInput("SetColorSecondary","13 8 8") ents.FindByName("fog_underworld"):AcceptInput("SetStartDist","50") ents.FindByName("fog_underworld"):AcceptInput("SetEndDist","350") ents.FindByName("fog_underworld"):AcceptInput("SetMaxDensity","0.9") --ents.FindByName("fog_underworld"):AcceptInput("SetMaxDensity","1") end util.PrintToChatAll('Event: ' .. EventTable[EventTableIndex] .. '!') for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,'Event: ' .. EventTable[EventTableIndex] .. '!') if ( player.m_iClass == 9 ) and ( EventType ~= 10 ) then player:SetAttributeValue("engy sentry fire rate increased", nil) player:SetAttributeValue("mult firerocket rate", nil) end if EventType == 13 then player:SetAttributeValue("hud overlay", "effects/imcookin") else player:SetAttributeValue("hud overlay", nil) end end end if EventTableIndex >= 16 then ShuffleInPlace(EventTable) EventTableIndex = 0 end EventTableIndex = EventTableIndex + 1 end end function CreateAnnotation(message, duration, pos) local index if index == nil then index = 1 else index = index + 1 end local KeyValues = { display_text = message, lifetime = duration, origin = pos, offset = 8, targetname = "annotation " .. tostring(index) } ents.CreateWithKeys("training_annotation", KeyValues, true, true) timer.Simple(0.015,function() ents.FindByName("annotation " .. tostring(index)):AcceptInput("show") end) timer.Simple(duration,function() ents.FindByName("annotation " .. tostring(index)):AcceptInput("kill") end) end function FindAndDestroyWeapon(player, weapon, tier, tableslot, wepslot) if weapontable[tier][tableslot].slot == wepslot then player:AcceptInput( "$StripExtraItem", weapon ) player:AcceptInput( "$RemoveItem", weapon ) end end math.randomfloat = function(m, n) if (m) then if (n) then if (n == m) then return m; elseif (m > n) then m, n = n, m; end -- n should be greater than m local dif = n - m; local mod = dif * math.random(); return m + mod; else return m * math.random(); end else return math.random(); end end function Interact(player) if player.InteractWith == "vending_t1_cash" then if player.m_nCurrency >= t1_cash_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[1]) local wep = weapontable[1][rand] FindAndDestroyWeapon(player, "Peg Leg", 1, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 1, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 1, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 1, rand, 0) timer.Simple(0.015, function() player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) player:RemoveCurrency(t1_cash_amount) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have the cash for this") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "vending_t1_token" then if player.helltokens >= t1_token_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[1]) local wep = weapontable[1][rand] FindAndDestroyWeapon(player, "Peg Leg", 1, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 1, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 1, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 1, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 1, rand, 0) timer.Simple(0.015, function() player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) RemoveHellToken(t1_token_amount,player) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have enough Hell Tokens") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "vending_t2_cash" then if player.m_nCurrency >= t2_cash_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[2]) local wep = weapontable[2][rand] FindAndDestroyWeapon(player, "Peg Leg", 2, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 2, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 2, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 2, rand, 0) timer.Simple(0.015, function() player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) player:RemoveCurrency(t2_cash_amount) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have the cash for this") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "vending_t2_token" then if player.helltokens >= t2_token_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[2]) local wep = weapontable[2][rand] FindAndDestroyWeapon(player, "Peg Leg", 2, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 2, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 2, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 2, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 2, rand, 0) timer.Simple(0.015, function() player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) RemoveHellToken(t2_token_amount,player) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have enough Hell Tokens") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "vending_t3_cash" then if player.m_nCurrency >= t3_cash_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[3]) local wep = weapontable[3][rand] FindAndDestroyWeapon(player, "Peg Leg", 3, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 3, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 3, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 3, rand, 0) timer.Simple(0.015, function() if (player.m_iClass ~= 9) then --they don't work on engie player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) else if (wep.name == "Shockgun") or (wep.name == "Frontline General") then player:AcceptInput( "$AwardAndGiveExtraItem", wep.name .. ' ' ) --extra space for primary versions player:Print(2,'You have received the ' .. wep.name) else player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) end end player:RemoveCurrency(t3_cash_amount) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have the cash for this") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "vending_t3_token" then if player.helltokens >= t3_token_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[3]) local wep = weapontable[3][rand] FindAndDestroyWeapon(player, "Peg Leg", 3, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 3, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 3, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 3, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 3, rand, 0) timer.Simple(0.015, function() if (player.m_iClass ~= 9) then --they don't work on engie player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) else if (wep.name == "Shockgun") or (wep.name == "Frontline General") then player:AcceptInput( "$AwardAndGiveExtraItem", wep.name .. ' ' ) --extra space for primary versions player:Print(2,'You have received the ' .. wep.name) else player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) end end RemoveHellToken(t3_token_amount,player) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have enough Hell Tokens") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "vending_t4_cash" then if player.m_nCurrency >= t4_cash_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[4]) local wep = weapontable[4][rand] FindAndDestroyWeapon(player, "Peg Leg", 4, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 4, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 4, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 4, rand, 0) timer.Simple(0.015, function() player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) player:RemoveCurrency(t4_cash_amount) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have the cash for this") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "vending_t4_token" then if player.helltokens >= t4_token_amount then player:PlaySound("buttons/button4.wav") timer.Simple(1, function() local rand = math.random(1,#weapontable[4]) local wep = weapontable[4][rand] FindAndDestroyWeapon(player, "Peg Leg", 4, rand, 0) FindAndDestroyWeapon(player, "Scrap Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Metal Boots", 4, rand, 0) FindAndDestroyWeapon(player, "Wooden Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Leather Boots", 4, rand, 0) FindAndDestroyWeapon(player, "Metal Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Stun Shield", 4, rand, 1) FindAndDestroyWeapon(player, "Long Fall Boots", 4, rand, 0) timer.Simple(0.015, function() player:AcceptInput( "$AwardAndGiveExtraItem", wep.name ) player:Print(2,'You have received the ' .. wep.name) RemoveHellToken(t4_token_amount,player) player:PlaySound("mvm/mvm_bought_upgrade.wav") end) end) else player:Print(2,"You don't have enough Hell Tokens") player:PlaySound("buttons/button8.wav") end elseif player.InteractWith == "trader" then local bonusmult = player:GetAttributeValue("currency bonus") if bonusmult == nil then bonusmult = 1 end if player.HellTokens > 0 then if ( player.HellTokens <= 10 ) then player:PlaySound("vo/compmode/cm_heavy_summary_callout_01.mp3") elseif ( player.HellTokens > 10 ) and ( player.HellTokens <= 25 ) then player:PlaySound("vo/heavy_mvm_loot_common01.mp3") elseif ( player.HellTokens > 25 ) and ( player.HellTokens <= 80 ) then player:PlaySound("vo/heavy_mvm_loot_rare02.mp3") elseif ( player.HellTokens > 80 ) then player:PlaySound("vo/heavy_mvm_loot_godlike01.mp3") end player:PlaySoundToSelf("MVM.MoneyPickup") player:AddCurrency(player.HellTokens * 50 * bonusmult) player:Print(2,"You have made $" .. player.HellTokens * 50 * bonusmult) player.HellTokens = 0 player:ShowHudText({channel = 3, y = 0.7, x = 0.78, r1 = 250, r2 = 250, g1 = 50, g2 = 50, b1 = 0, b2 = 0, effect = 2, fixTime = 0.01, fadeinTime = 0.01, fadeoutTime = 10, holdTime = 69420}, "Hell Tokens: " .. player.HellTokens) else player:Print(2,"You need Hell Tokens to trade.") player:PlaySound("Heavy.No03") end end end function OnWaveInit() timer.Simple(0.5,function() ents.FindByName("interact_vending_t1_cash"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t1_cash" player:Print(2,"Get random Tier 1 weapons, $" .. t1_cash_amount) end end) ents.FindByName("interact_vending_t1_cash"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_vending_t1_tokens"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t1_token" player:Print(2,"Get random Tier 1 weapons, " .. t1_token_amount .. " Hell Tokens") end end) ents.FindByName("interact_vending_t1_tokens"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_vending_t2_cash"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t2_cash" player:Print(2,"Get random Tier 2 weapons, $" .. t2_cash_amount) end end) ents.FindByName("interact_vending_t2_cash"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_vending_t2_tokens"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t2_token" player:Print(2,"Get random Tier 2 weapons, " .. t2_token_amount .. " Hell Tokens") end end) ents.FindByName("interact_vending_t2_tokens"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_vending_t3_cash"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t3_cash" player:Print(2,"Get random Tier 3 weapons, $" .. t3_cash_amount) end end) ents.FindByName("interact_vending_t3_cash"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_vending_t3_tokens"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t3_token" player:Print(2,"Get random Tier 3 weapons, " .. t3_token_amount .. " Hell Tokens") end end) ents.FindByName("interact_vending_t3_tokens"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_vending_t4_cash"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t4_cash" player:Print(2,"Get random Tier 4 weapons, $" .. t4_cash_amount) end end) ents.FindByName("interact_vending_t4_cash"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_vending_t4_tokens"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "vending_t4_token" player:Print(2,"Get random Tier 4 weapons, " .. t4_token_amount .. " Hell Tokens") end end) ents.FindByName("interact_vending_t4_tokens"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) ents.FindByName("interact_trader"):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then local bonusmult = player:GetAttributeValue("currency bonus") if bonusmult == nil then bonusmult = 1 end player.InteractWith = "trader" player:Print(2,"Trade Hell Tokens for cash. You will make $" .. player.HellTokens * 50 * bonusmult) end end) ents.FindByName("interact_trader"):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) end) end function AddCashOnKillNormalReduced(_, activator) for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then local amount = 25 * BonusCash player:AddCurrency(amount) end end local chance = math.random(0,100) if ( activator:IsValid() ) and ( chance <= 3 ) then local amount = math.random(1,99) amount = amount / 33 amount = math.ceil(amount) for i=1, amount do local vec = activator:GetAbsOrigin() + Vector(math.random(-64,64), (math.random(-64,64)), 0) ents.FindByName("Helltoken_spawner"):Teleport(vec) ents.FindByName("Helltoken_spawner"):AcceptInput("ForceSpawn") util.ParticleEffect("merasmus_object_spawn", vec) end end end function AddCashOnKillEliteReduced(_, activator) for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then local amount = 100 * BonusCash player:AddCurrency(amount) end end local chance = math.random(0,100) if ( activator:IsValid() ) and ( chance <= 20 ) then local amount = math.random(1,100) amount = amount / 10 amount = math.ceil(amount) for i=1, amount do local vec = activator:GetAbsOrigin() + Vector(math.random(-64,64), (math.random(-64,64)), 0) util.ParticleEffect("merasmus_object_spawn", vec) if amount == 10 then ents.FindByName("RareHelltoken_spawner"):Teleport(vec) ents.FindByName("RareHelltoken_spawner"):AcceptInput("ForceSpawn") break else ents.FindByName("Helltoken_spawner"):Teleport(vec) ents.FindByName("Helltoken_spawner"):AcceptInput("ForceSpawn") end 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() player.Deaths = player.Deaths + 1 local chance = math.random(1,100) if chance <= 25 then -- 25% chance SpawnRedempPowerup(player) end end); player.HoldTime = 0 player.InteractWith = "nothing" player.InteractCooldown = false player.HellTokens = 0 player.Deaths = 0 player.ConsecutiveWavesSurvived = 0 player.ConsecutiveWavesKilled = 0 else player:AddCallback(ON_DEATH, function() local chance = math.random(1,100) if chance <= 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 if ( damage.Attacker:IsBot() ) and ( damage.Attacker:InCond(43) ) and ( IsValid(player.Curer) ) then damage.Attacker = player.Curer --makes the medic get credit for cured zombies' damage return true 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(others,attacker) end end end end function OnWaveSpawnBot(bot, wave, tags) bot.Curer = nil 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 if EventType == 13 then bot:SetAttributeValue("set damagetype ignite",1) bot:SetAttributeValue("mult afterburn delay",0.5) bot:SetAttributeValue("weapon burn dmg increased",2) bot:SetAttributeValue("attach particle effect static",3042) end end function SpawnPowerup(player) -- normal powerups ents.FindByName(PowerupTable[PowerupTableIndex] .. "_spawner"):Teleport(player:GetAbsOrigin()) ents.FindByName(PowerupTable[PowerupTableIndex] .. "_spawner"):AcceptInput("ForceSpawn") if PowerupTableIndex == 9 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 == 3 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,false) player:RefillAmmo() player:Print(2,"Players And Ammo Restored!") player:PlaySoundToSelf("Halloween.spell_overheal") end end util.PrintToChatAll("Players And Ammo Restored!") 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 util.PrintToChatAll("Bonus Cash On Kill!") 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 util.PrintToChatAll("Weaker Zombies!") 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 util.PrintToChatAll("Team Resistance!") 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!") util.PrintToChatAll(tostring(activator:GetPlayerName()) .. ' has picked up 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 ActivateLifeStealGlobal() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Life Steal!") player:PlaySoundToSelf("Powerup.PickUpVampire") player:SetAttributeValue("heal on hit for slowfire", 10) player:SetAttributeValue("heal on kill", 50) timer.Simple(60, function() player:SetAttributeValue("heal on hit for slowfire", nil) player:SetAttributeValue("heal on kill", nil) end) end end util.PrintToChatAll("Life Steal!") end function ActivateStrongArms(_,activator) if activator:IsRealPlayer() then activator:Print(2,"Strong Arms") util.PrintToChatAll(tostring(activator:GetPlayerName()) .. ' has picked up 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 ActivateStrongArmsGlobal() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Strong Arms") player:PlaySoundToSelf("Powerup.PickUpStrength") player:GetPlayerItemBySlot(2):SetAttributeValue("dmg penalty vs players",5) timer.Simple(30, function() player:GetPlayerItemBySlot(2):SetAttributeValue("dmg penalty vs players", nil) end) end end util.PrintToChatAll("Strong Arms!") end function ActivateSafeGuard(_,activator) if activator:IsRealPlayer() then if activator:InCond(129) == false then activator:Print(2,"You Will Be Revived Next Death!") util.PrintToChatAll(tostring(activator:GetPlayerName()) .. ' has picked up Safeguard') 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 ActivateSafeGuardGlobal() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then if player:InCond(129) == false then player:Print(2,"You Will Be Revived Next Death!") player:PlaySoundToSelf("Powerup.PickUpPrecision") player:AddCond(70,-1) player:AddCond(129,-1) else player:Print(2,"Temporary Safeguard!") player:PlaySoundToSelf("Powerup.PickUpPrecision") player:AddCond(5,2.5) player:AddCond(32,5) end end end util.PrintToChatAll("Safeguard!") 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 util.PrintToChatAll("Retribution!") end function ActivateKnockout(_,activator) for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Knockout!") player:PlaySoundToSelf("Powerup.PickUpSupernovaActivate") else player:TakeDamage({Attacker = activator, Damage = 50}) end end util.PrintToChatAll("Knockout!") end function ActivateExtraammo(_,activator) if activator:IsRealPlayer() then activator:Print(2,"Extra ammo!") util.PrintToChatAll(tostring(activator:GetPlayerName()) .. ' has picked up Extra Ammo') activator:RefillAmmo() timer.Simple(0.015, function() activator.m_iAmmo[2] = activator.m_iAmmo[2] * 3 --primary activator.m_iAmmo[3] = activator.m_iAmmo[3] * 3 --secondary activator.m_iAmmo[5] = activator.m_iAmmo[5] * 3 --sandman/wrap activator.m_iAmmo[6] = activator.m_iAmmo[6] * 3 --cleaver end) end end function ActivateExtraammoGlobal() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Extra ammo!") player:RefillAmmo() timer.Simple(0.015, function() player.m_iAmmo[2] = player.m_iAmmo[2] * 3 --primary player.m_iAmmo[3] = player.m_iAmmo[3] * 3 --secondary player.m_iAmmo[5] = player.m_iAmmo[5] * 3 --sandman/wrap player.m_iAmmo[6] = player.m_iAmmo[6] * 3 --cleaver end) end end util.PrintToChatAll("Extra Ammo!") end function ActivateTreasureHunter() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Treasure Hunter!") player:PlaySoundToSelf("items/powerup_pickup_agility.wav") end end SetHellTokenTimer(1) timer.Simple(20, function() SetHellTokenTimer(20) end) util.PrintToChatAll("Treasure Hunter!") end function SetHellTokenTimer(delay) pcall(timer.Stop, CreationTimer) CreationTimer = timer.Create(delay, function() local randpos = HellTokenSpawnTable[math.random(1,#HellTokenSpawnTable)] local rand = math.random(0,100) util.ParticleEffect("merasmus_object_spawn", randpos) if rand <= 5 then ents.FindByName("RareHelltoken_spawner"):AcceptInput("$SetLocalOrigin", randpos) ents.FindByName("RareHelltoken_spawner"):AcceptInput("ForceSpawn") else ents.FindByName("Helltoken_spawner"):AcceptInput("$SetLocalOrigin", randpos) ents.FindByName("Helltoken_spawner"):AcceptInput("ForceSpawn") end end, 0) end function ActivateSentryhat() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() and player:IsAlive() then player:Print(2,"Sentry Hats!") player:PlaySoundToSelf("Building_Sentrygun.Built") local KeyValues = { TeamNum = 2, defaultupgrade = 2, SolidToPlayer = 0, spawnflags = 10, origin = player:GetAbsOrigin() + Vector(0, 0, 72), targetname = 'sentry hat ' .. tostring(player:GetSteamId()) } ents.CreateWithKeys("obj_sentrygun", KeyValues, true, true) timer.Simple(0.015, function() for _, sentry in pairs(ents.FindAllByClass("obj_sentrygun")) do if sentry.m_iName == 'sentry hat ' .. tostring(player:GetSteamId()) then sentry["$attributeoverride"] = 1 sentry["$damagemult"] = 10 end end end) timer.Create(0.015, function() for _, sentry in pairs(ents.FindAllByClass("obj_sentrygun")) do if sentry.m_iName == 'sentry hat ' .. tostring(player:GetSteamId()) then sentry:Teleport(player:GetAbsOrigin() + Vector(0, 0, 72), player:GetAbsAngles()) end end end, 30/0.015) timer.Simple(30, function() for _, sentry in pairs(ents.FindAllByClass("obj_sentrygun")) do if sentry.m_iName == 'sentry hat ' .. tostring(player:GetSteamId()) then sentry:AcceptInput("kill") end end end) end end util.PrintToChatAll("Sentry Hats!") 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 if EventType == 14 then if FirePillarDelay < 1 then for i=1, FirePillarCount do ents.FindByName("FirePillar_spawner"):Teleport(FirePillarSpawnTable[FirePillarIndex]) ents.FindByName("FirePillar_spawner"):AcceptInput("ForceSpawn") if FirePillarIndex == #FirePillarSpawnTable then ShuffleInPlace(FirePillarSpawnTable) FirePillarIndex = 0 end FirePillarIndex = FirePillarIndex + 1 end FirePillarDelay = 5 * 66 else FirePillarDelay = FirePillarDelay -1 end end CurrectWave = ents.FindByClass('tf_objective_resource').m_nMannVsMachineWaveCount 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 if EventType == 16 then --Golden Rain player:StunPlayer(0.5, 0.4, TF_STUNFLAG_SLOWDOWN) 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,false) 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 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(1.5, function() player.InteractCooldown = false end) end else player.holdTime = 0 end if player:InCond(43) then player:WeaponSwitchSlot(2) end if ( IsValid(player:GetPlayerItemBySlot(0)) ) and ( player:GetPlayerItemBySlot(0):GetItemName() == "Long Fall Boots" ) and ( not player:InCond(84) ) then player:AddCond(84) else player:RemoveCond(84) end player:SetAttributeValue("head scale", nil) player:SetAttributeValue("voice pitch scale", nil) player:SetAttributeValue("increased air control", nil) player:SetAttributeValue("increased jump height", nil) 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 function CureHit(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if ( caller:IsBot() ) and ( not caller:InCond(43) ) then caller:Addcond(43) caller.Curer = activator caller:SetAttributeValue("mult dmgtaken from melee", 0.5) timer.Simple(10, function() caller:AcceptInput("$Suicide") end) end end function StunShield(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if ( caller:IsBot() ) then if ( caller.m_bIsMiniBoss == 0 ) then local duration = damage / 7.5 duration = duration + 1 caller:StunPlayer(duration, 1, TF_STUNFLAGS_BIGBONK, activator) caller:SetLocalVelocity( ( Vector(1000,1000,0) * activator:GetAbsAngles():GetForward() ) + Vector(0,0,750) ) else local duration = damage / 7.5 duration = duration + 1.5 local slow = damage / 75 caller:StunPlayer(duration, slow, TF_STUNFLAG_SLOWDOWN, activator) caller:SetLocalVelocity( ( Vector(500,500,0) * activator:GetAbsAngles():GetForward() ) + Vector(0,0,375) ) end end end function Teleported(taunt, activator) if taunt == "scenes/player/engineer/low/taunt_drg_melee.vcd" then local cantp = true local oldpos = activator:GetAbsOrigin() if activator.m_iAmmo[4] < 100 then cantp = false else cantp = true end timer.Simple(1.8, function() if cantp then activator.m_iHealth = activator.m_iHealth - 50 activator.m_iAmmo[4] = activator.m_iAmmo[4] - 100 end end) timer.Simple(2.3, function() if activator.m_iHealth < 1 then activator:AcceptInput("$Suicide") end if not cantp then activator:SetAbsOrigin(oldpos) end end) end end function Drone(_,Drone) local owner = Drone.m_hBuilder local Update local posmod = 1 local accel = 0.01 local decel = 0.025 local height = 16 local fakevel = Drone:GetAbsOrigin() local buildpos = Drone:GetAbsOrigin() local dis = 96 local failcounter = 0 Drone:AddCallback(ON_REMOVE, function() pcall(timer.Stop, Update) end) Drone:AddCallback(ON_DEATH, function() pcall(timer.Stop, Update) end) Update = timer.Create(0.015, function() local pos = Drone:GetAbsOrigin() local ang = Drone:GetAbsAngles() local ownerpos = owner:GetAbsOrigin() local desiredheight = ownerpos.z + 72 + height local currentheight = pos.z if ( owner:IsAlive() ) then if ( IsValid(Drone) ) then if owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" then dis = 128 else dis = 48 end if ( Drone.m_iState ~= 0 ) then if pos:Distance(owner:GetAbsOrigin()) >= dis + 72 + height then fakevel = pos + ( Vector(posmod * 5,posmod * 5,0) * ang:GetForward()) posmod = posmod + ( posmod * accel) elseif ( pos:Distance(owner:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) and ( posmod * 5 < 6 ) then fakevel = pos - ( Vector(5,5,0) * ang:GetForward()) posmod = posmod - ( posmod * decel) else if posmod > 1 then fakevel = pos + ( Vector(posmod * 5,posmod * 5,0) * ang:GetForward()) posmod = posmod - ( posmod * decel) else posmod = 1 fakevel = pos end end if ( currentheight <= desiredheight ) and ( currentheight - desiredheight < 8 ) then if ( pos:Distance(owner:GetAbsOrigin()) >= dis + 72 + height ) or ( ( pos:Distance(owner:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+3) else fakevel = Vector(fakevel.x,fakevel.y,currentheight+0.5) end elseif currentheight >= desiredheight and ( currentheight - desiredheight > 8 ) then if ( pos:Distance(owner:GetAbsOrigin()) >= dis + 72 + height ) or ( ( pos:Distance(owner:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight-3) else fakevel = Vector(fakevel.x,fakevel.y,currentheight-0.5) end else fakevel = Vector(fakevel.x,fakevel.y,currentheight) end else if ( currentheight <= ( buildpos.z + 72 + height ) ) and ( currentheight - desiredheight < 8 ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+0.5) end end Drone:SetAbsOrigin(fakevel) Drone:FaceEntity(owner) else failcounter = failcounter + 1 print("Error, Invaild Drone", failcounter) if failcounter >= 66 then pcall(timer.Stop, Update) end end else pcall(timer.Stop, Update) Drone:AcceptInput("RemoveHealth", 9999) end end, 0) end