--By Zilloy --Big thanks to Wacev for helping with this function OnPlayerConnected( player ) --prevents the timers from stacking upon respawning if player:IsRealPlayer() then player:AddCallback( ON_SPAWN, function( ent ) -- ent:AcceptInput("$DisplayTextChat", "{yellow}ON_SPAWN CallBack.") if ent.buffDecayTimer and ent.BerserkEnabled == true then -- ent:AcceptInput("$DisplayTextChat", "{green}Timer found, stopping.") -- timer.Stop( ent.buffDecayTimer ) ent.BerserkEnabled = false -- else -- ent:AcceptInput("$DisplayTextChat", "{red}Timer NOT found.") end if ent.buckshotTimer and ent.BuckshotRouletteEnabled == true then -- ent:AcceptInput("$DisplayTextChat", "{green}Timer found, stopping.") -- timer.Stop( ent.buckshotTimer ) ent.BuckshotRouletteEnabled = false -- else -- ent:AcceptInput("$DisplayTextChat", "{red}Timer NOT found.") end if ent.artDepSoundTimer and ent.ArtilleryDeploySoundEnabled == true then -- ent:AcceptInput("$DisplayTextChat", "{green}Timer found, stopping.") -- timer.Stop( ent.artDepSoundTimer ) ent.ArtilleryDeploySoundEnabled = false -- else -- ent:AcceptInput("$DisplayTextChat", "{red}Timer NOT found.") end if ent.AtomicTimer and ent.AtomicDeployEnabled == true then -- ent:AcceptInput("$DisplayTextChat", "{green}Timer found, stopping.") -- timer.Stop( ent.artDepSoundTimer ) ent.AtomicDeployEnabled = false -- else -- ent:AcceptInput("$DisplayTextChat", "{red}Timer NOT found.") end if ent.speedRead and ent.speedReadEnable == true then -- ent:AcceptInput("$DisplayTextChat", "{green}Timer found, stopping.") -- timer.Stop( ent.artDepSoundTimer ) ent.speedReadEnable = false -- else -- ent:AcceptInput("$DisplayTextChat", "{red}Timer NOT found.") end end) player:AddCallback( ON_KEY_PRESSED, function( ent, key ) --Hailstorm ADS if key == IN_ATTACK2 and ent:IsAlive() == true then if ent.m_iClass == 2 and IsValid( ent:GetPlayerItemBySlot(0) ) then local playerPrimaryWeapon = ent:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) if playerPrimaryWeapon:GetClassname() == "tf_weapon_revolver" and player.m_hActiveWeapon == playerPrimaryWeapon then local adsStatus = playerPrimaryWeapon:GetAttributeValue("can headshot") or 0 if adsStatus ~= 1 then ent:PlaySound("physics/metal/weapon_footstep1.wav") -- ent:AddCond(TF_COND_AIMING, -1, ent) --T-Pose while moving playerPrimaryWeapon:SetAttributeValue("can headshot", 1) playerPrimaryWeapon:SetAttributeValue("revolver use hit locations", 1) playerPrimaryWeapon:SetAttributeValue("disable weapon switch", 1) playerPrimaryWeapon:SetAttributeValue("fire rate bonus HIDDEN", 0.65) playerPrimaryWeapon:SetAttributeValue("damage penalty", 2) playerPrimaryWeapon:SetAttributeValue("weapon spread bonus", 0.1) playerPrimaryWeapon:SetAttributeValue("move speed penalty", 0.5) playerPrimaryWeapon:SetAttributeValue("no_jump", 1) playerPrimaryWeapon:SetAttributeValue("custom item model attachment viewmodel", "models/weapons/w_smg1.mdl,25 -1.95 -8.2,0 0 0,2") else ent:PlaySound("physics/metal/weapon_footstep2.wav") -- ent:RemoveCond(TF_COND_AIMING) playerPrimaryWeapon:SetAttributeValue("can headshot", nil) playerPrimaryWeapon:SetAttributeValue("revolver use hit locations", nil) playerPrimaryWeapon:SetAttributeValue("disable weapon switch", nil) playerPrimaryWeapon:SetAttributeValue("fire rate bonus HIDDEN", 0) playerPrimaryWeapon:SetAttributeValue("damage penalty", nil) playerPrimaryWeapon:SetAttributeValue("weapon spread bonus", nil) playerPrimaryWeapon:SetAttributeValue("move speed penalty", nil) playerPrimaryWeapon:SetAttributeValue("no_jump", nil) playerPrimaryWeapon:SetAttributeValue("custom item model attachment viewmodel", "models/weapons/w_smg1.mdl,29 -11 -8,0 0 0,2") end end end end end) -- player:AddCallback( ON_KEY_RELEASED, function( ent, key ) -- if key == IN_ATTACK2 then -- end -- end) end end function BerserkMinigunDecay(_, activator) math.round = function(num, decimals) if (not decimals or decimals <= 0) then return math.floor(num + 0.5) else local mod = 10 ^ decimals return math.floor((num + mod) + 0.5) /mod end end local userPrimaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) userPrimaryWeapon:SetAttributeValue("CARD: damage bonus", 1) userPrimaryWeapon:SetAttributeValue("dmg taken increased", 1) activator.BerserkEnabled = true -- local buffDecayTimer activator.buffDecayTimer = timer.Create(0.1, function () -- activator:AcceptInput("$DisplayTextChat", "{blue}Timer working.") if activator.BerserkEnabled == false and activator:IsValid() then timer.Stop(activator.buffDecayTimer) return end local damageStack = userPrimaryWeapon:GetAttributeValue("CARD: damage bonus") or 1 local vulnStack = userPrimaryWeapon:GetAttributeValue("dmg taken increased") or 1 if damageStack > 1 then damageStack = damageStack - 0.01 if damageStack < 1 then damageStack = 1 end vulnStack = vulnStack - 0.005 if vulnStack < 1 then vulnStack = 1 end userPrimaryWeapon:SetAttributeValue("CARD: damage bonus", damageStack) userPrimaryWeapon:SetAttributeValue("dmg taken increased", vulnStack) local displayDamage = math.round(damageStack * 80, 0) --because the minigun has -20% damage. displays true damage displayDamage = tostring(displayDamage) local displayVuln = math.round(vulnStack * 100 -100, 0) displayVuln = tostring(displayVuln) activator:AcceptInput("$DisplayTextCenter", " DMG: "..displayDamage.."% \n VUL: "..displayVuln.."% ", activator) end end, 0) end function BerserkMinigun(damage, activator, caller) math.round = function(num, decimals) if (not decimals or decimals <= 0) then return math.floor(num + 0.5) else local mod = 10 ^ decimals return math.floor((num + mod) + 0.5) /mod end end local userPrimaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) local damageStack = userPrimaryWeapon:GetAttributeValue("CARD: damage bonus") or 1 local vulnStack = userPrimaryWeapon:GetAttributeValue("dmg taken increased") or 1 local buffratio = userPrimaryWeapon:GetAttributeValue("fire rate bonus") or 1 if damageStack < 2 then --TODO: limit stack to 1.2 during setup damageStack = damageStack + (0.015 * buffratio) vulnStack = vulnStack + (0.0075 * buffratio) end userPrimaryWeapon:SetAttributeValue("CARD: damage bonus", damageStack) userPrimaryWeapon:SetAttributeValue("dmg taken increased", vulnStack) local displayDamage = math.round(damageStack * 80, 0) displayDamage = tostring(displayDamage) local displayVuln = math.round(vulnStack * 100 -100, 0) displayVuln = tostring(displayVuln) activator:AcceptInput("$DisplayTextCenter", " DMG: "..displayDamage.."% \n VUL: "..displayVuln.."% ", activator) end function BuckshotRoulette(_, activator) local userPrimaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) activator.BuckshotRouletteEnabled = true activator.buckshotTimer = timer.Create(0.1, function () -- activator:AcceptInput("$DisplayTextChat", "{blue}Timer working.") if activator.BuckshotRouletteEnabled == false and activator:IsValid() then timer.Stop(activator.buckshotTimer) return end if math.random(1,2) == 1 then userPrimaryWeapon:SetAttributeValue("override projectile type", 27) -- activator:AcceptInput("$DisplayTextChat", "{AAAAAA}Got 1, setting to blank.") else userPrimaryWeapon:SetAttributeValue("override projectile type", nil) -- activator:AcceptInput("$DisplayTextChat", "{red}Got not 1, setting to live.") end end, 0) end function BuckshotGamble(_, activator) local userPrimaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) local isBlank = userPrimaryWeapon:GetAttributeValue("override projectile type") or 1 local altFire = userPrimaryWeapon:GetAttributeValue("damage penalty") or 1 if altFire == 2 then if isBlank == 27 then activator:PlaySound("weapons/shotgun/shotgun_fire6.wav") activator:AcceptInput("$Suicide") end end end function ArtilleryDeploySound(_, activator) activator.ArtilleryDeploySoundEnabled = true activator.ArtilDeployed = false activator.artDepSoundTimer = timer.Create(0.05, function () -- activator:AcceptInput("$DisplayTextChat", "{blue}Timer working.") if activator.ArtilleryDeploySoundEnabled == false and activator:IsValid() then timer.Stop(activator.artDepSoundTimer) return end if activator:InCond(0) == true and activator.ArtilDeployed == false then if math.random(1,2) == 1 then activator:PlaySound("physics/metal/weapon_footstep1.wav") else activator:PlaySound("physics/metal/weapon_footstep2.wav") end activator.ArtilDeployed = true elseif activator:InCond(0) == false and activator.ArtilDeployed == true then activator.ArtilDeployed = false end end, 0) end function HailstormFix(_, activator) local userPrimaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) local isStuck = userPrimaryWeapon:GetAttributeValue("disable weapon switch") or 0 if isStuck == 1 then userPrimaryWeapon:SetAttributeValue("can headshot", nil) userPrimaryWeapon:SetAttributeValue("revolver use hit locations", nil) userPrimaryWeapon:SetAttributeValue("disable weapon switch", nil) userPrimaryWeapon:SetAttributeValue("fire rate bonus HIDDEN", 0) userPrimaryWeapon:SetAttributeValue("damage penalty", nil) userPrimaryWeapon:SetAttributeValue("weapon spread bonus", nil) userPrimaryWeapon:SetAttributeValue("move speed penalty", nil) userPrimaryWeapon:SetAttributeValue("no_jump", nil) userPrimaryWeapon:SetAttributeValue("custom item model attachment viewmodel", "models/weapons/w_smg1.mdl,29 -11 -8,0 0 0,2") timer.Simple(0.1, function() activator:AcceptInput("$WeaponSwitchSlot",0,activator) end) end local userSecondaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_SECONDARY) if userSecondaryWeapon:GetClassname() == "tf_weapon_smg" or userSecondaryWeapon:GetClassname() == "tf_weapon_charged_smg" then activator:RemoveItem(userSecondaryWeapon) timer.Simple(0.1, function() activator:GiveItem("The Cozy Camper") end) end end function AtomicMinigunDecay(_, activator) local userPrimaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) local revpenalty = userPrimaryWeapon:GetAttributeValue("healing received penalty") or 1 activator.AtomicDeployEnabled = true activator.AtomicDeployed = false activator.AtomicTimer = timer.Create(0.1, function () -- activator:AcceptInput("$DisplayTextChat", "{blue}Timer working.") if activator.AtomicDeployEnabled == false and activator:IsValid() then timer.Stop(activator.AtomicTimer) return end if revpenalty > 0 and activator.AtomicDeployed == true then revpenalty = revpenalty - 0.002 if revpenalty < 0 then revpenalty = 0 end userPrimaryWeapon:SetAttributeValue("healing received penalty", revpenalty) elseif not activator:InCond(30) and activator.AtomicDeployed == true then activator:AddCond(30, -1, activator) activator:AcceptInput("$DisplayTextCenter", "MAXIMUM OVERHEAT REACHED", activator) end if activator:InCond(0) == true and activator.AtomicDeployed == false then activator.AtomicDeployed = true -- activator:AcceptInput("$DisplayTextChat", "{green}Minigun deployed, waiting for unrev") elseif activator:InCond(0) == false and activator.AtomicDeployed == true then activator.AtomicDeployed = false userPrimaryWeapon:SetAttributeValue("Projectile speed increased HIDDEN", nil) activator:RemoveCond(19) -- activator:RemoveCond(40) userPrimaryWeapon:SetAttributeValue("healing received penalty", nil) revpenalty = 1 activator:RemoveCond(30) -- activator:AcceptInput("$DisplayTextChat", "{green}Minigun unrevved, removing boosts") end end, 0) end function AtomicMinigun(damage, activator, caller) local userPrimaryWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_PRIMARY) local spentAmmo = userPrimaryWeapon:GetAttributeValue("Projectile speed increased HIDDEN") or 1 -- if spentAmmo < 501 then if spentAmmo < 151 then spentAmmo = spentAmmo + 1 userPrimaryWeapon:SetAttributeValue("Projectile speed increased HIDDEN", spentAmmo) -- activator:AcceptInput("$DisplayTextChat", "{blue}"..spentAmmo) end if spentAmmo > 150 and not activator:InCond(19) then activator:AddCond(19, -1, activator) -- activator:AcceptInput("$DisplayTextChat", "{yellow}100 ammo spent; giving mini-crits") end -- if spentAmmo > 500 and not activator:InCond(40) then -- activator:AddCond(40, -1, activator) -- end end function SpeedGarden(_, activator) local userMeleeWeapon = activator:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE) activator.speedReadEnable = true userMeleeWeapon:SetAttributeValue("mult dmg while midair", nil) activator.speedRead = timer.Create(0.05, function () -- activator:AcceptInput("$DisplayTextChat", "{blue}Timer working.") if activator.speedReadEnable == false and activator:IsValid() then timer.Stop(activator.speedRead) return end local speed = activator.m_vecAbsVelocity:Length() local speedToDamage = (speed / 400)^1.5 + 1 timer.Simple(0.3, function() if activator:IsAlive() then -- activator:AcceptInput("$DisplayTextChat", "{yellow}"..speed) -- activator:AcceptInput("$DisplayTextChat", "{red}"..speedToDamage) userMeleeWeapon:SetAttributeValue("mult dmg while midair", speedToDamage) end end) end, 0) end