local InWave = false function normalRespawnTimer() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:SetAttributeValue("min respawn time", 20) end end end function noRespawnTimer() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:SetAttributeValue("min respawn time", 666666) end end end function has_value (tab, val) for index, value in ipairs(tab) do if value == val then return true end end return false end function plagueKnife(damage, activator, caller) if damage >= 100 then --hack because butter knife deals 62 damage activator:TakeDamage({Damage = activator.m_iHealth *0.5, Attacker = activator, DamageType = DMG_PARALYZE}) if caller:IsBot() then for _, others in pairs(ents.FindInSphere(caller:GetAbsOrigin(),192)) do if others:IsBot() then others:AddCond(112,-1,activator) util.ParticleEffect( "plague_healthkit_pickup", others:GetEyePos() ) util.ParticleEffect( "plague_healthkit_pickup", others:GetEyePos() ) util.ParticleEffect( "merasmus_dazed_blood", others:GetAbsOrigin() + Vector( 0, 0, 36 ) ) end end util.ParticleEffect( "merasmus_tp", activator:GetAbsOrigin() + Vector( 0, 0, 36 ) ) end end end function shockBeam(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit ents.FindByName("FX_Shock_spawner"):Teleport(caller:GetAbsOrigin() + Vector(0,0,48)) ents.FindByName("FX_Shock_spawner"):AcceptInput("ForceSpawn") caller:StunPlayer(0.65,0.7,TF_STUNFLAG_SLOWDOWN,activator) for _, player in pairs(ents.FindInSphere(caller:GetAbsOrigin(),192)) do if activator.m_iTeamNum ~= player.m_iTeamNum and caller ~= player and (player:IsPlayer()) then --not same team and not same bot player:TakeDamage({Attacker = activator, Damage = 35, DamageType = DMG_SHOCK, DamageCustom = TF_DMG_CUSTOM_PLASMA}) player:StunPlayer(0.65,0.7,TF_STUNFLAG_SLOWDOWN,activator) end end end function ComboPreAttack(_,activator,weapon) util.StartLagCompensation(activator) local Trace = util.Trace({ start = activator:GetAbsOrigin() + Vector(0, 0, 75), mask = MASK_SOLID, distance = 72.5, angles = activator:GetAbsAngles(), filter = activator }) util.FinishLagCompensation(activator) if ( Trace.Hit ) and ( Trace.HitNonWorld ) then activator.ResetDelay = CurTime() + 0.4 end timer.Simple(0.5, function() if activator.ResetDelay <= CurTime() then activator.ComboNumber = 1 end end) end function ComboPunch(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if activator:InCond(34) then activator:AddHealth(15) end if activator.ComboNumber == 2 then timer.Simple(0.01, function() activator:AddCond(34,0.35) end) activator.ComboNumber = -1 end if activator.ComboNumber == nil then activator.ComboNumber = 1 end activator.ComboNumber = activator.ComboNumber + 1 if not caller then activator.ComboNumber = 1 end end function ChristmasPunch(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit util.ParticleEffect("xms_snowburst", caller:GetAbsOrigin() + Vector(0,0,48)) caller:PlaySound("xmas.jingle_noisemaker") if caller:IsPlayer() then for _, player in pairs(ents.FindInSphere(caller:GetAbsOrigin(),128)) do if damage > 300 then if activator.m_iTeamNum ~= player.m_iTeamNum and (player:IsPlayer()) then --not same team player:StunPlayer(6, 0.9, TF_STUNFLAGS_LOSERSTATE, activator) end else if activator.m_iTeamNum ~= player.m_iTeamNum and (player:IsPlayer()) then --not same team player:StunPlayer(3, 0.67, TF_STUNFLAG_SLOWDOWN, activator) end end end end end function CalcOffset( text ) local len = string.len( text ) local t = ( len / 48 ) local x = 1 * ( 1 - t ) x = ( 1 - ( x / 3 ) ) / 2.1 return x end function OnPlayerDisconnected( player ) pcall( timer.Stop, player.DisplayTimer ) end function OnPlayerConnected( player ) if player:IsRealPlayer() then player.InteractCooldown = false player.HoldTime = 0 player.PentUpDamage = 0 player.StoneWall = false player.DamagePerSec = false player.DamageDelay = 0 player.FloatHealth = player.m_iHealth player.ResetDelay = CurTime() player.ComboNumber = 1 player.DisplayTimer = timer.Create( 0.1, function() if ( IsValid( player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ) ) ) and string.match( player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ):GetItemName(), "Consumable" ) then local string = player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ):GetItemName() .. ": " .. tostring( math.round( player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ):GetAttributeValue( "powerup charges" ), 0 ) ) player:ShowHudText({channel = 3, y = 0.8, x = ( CalcOffset( string ) - 0.55 ), r1 = 255, r2 = 255, g1 = 255, g2 = 255, b2 = 255, b2 = 255, effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 0.15}, string ) end end, 0 ) player:AddCallback( ON_DAMAGE_RECEIVED_POST, function( ent, dmginfo ) if ent.StoneWall == true then if IsDamageType( dmginfo.DamageType, DMG_BULLET ) or IsDamageType( dmginfo.DamageType, DMG_BUCKSHOT ) then dmginfo.Damage = dmginfo.Damage * ent:GetAttributeValueByClass( "mult_dmgtaken_from_bullets", 1 ) end if IsDamageType( dmginfo.DamageType, DMG_BLAST ) then dmginfo.Damage = dmginfo.Damage * ent:GetAttributeValueByClass( "mult_dmgtaken_from_explosions", 1 ) end if IsDamageType( dmginfo.DamageType, DMG_BURN ) or IsDamageType( dmginfo.DamageType, DMG_IGNITE ) then dmginfo.Damage = dmginfo.Damage * ent:GetAttributeValueByClass( "mult_dmgtaken_from_fire", 1 ) end if IsDamageType( dmginfo.DamageType, DMG_CRITICAL ) then dmginfo.Damage = dmginfo.Damage * ent:GetAttributeValueByClass( "mult_dmgtaken_from_crit", 1 ) end if IsDamageType( dmginfo.DamageType, DMG_MELEE ) then dmginfo.Damage = dmginfo.Damage * ent:GetAttributeValueByClass( "dmg_from_melee", 1 ) end ent.PentUpDamage = ent.PentUpDamage + dmginfo.Damage util.ParticleEffect( "miss_text", ent:GetEyePos() + Vector( 0, 0, 16 ) ) dmginfo.Damage = 0 return true end end) player:AddCallback( ON_SPAWN, function( ent ) player.PentUpDamage = 0 player.StoneWall = false player.DamagePerSec = false player.FloatHealth = player.m_iHealth end) end 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 > 6 and ( player:IsAlive() ) and ( player:OnTeam( 2 ) ) and ( IsValid( player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ) ) ) and ( player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ):GetAttributeValue( "powerup charges" ) > 0 ) then UseAction(player) player.InteractCooldown = true player.HoldTime = 0 timer.Simple(0.5, function() player.InteractCooldown = false end) end else player.holdTime = 0 end if ( not InWave ) and ( IsValid( player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ) ) ) then player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ):SetAttributeValue( "powerup charges", player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ):GetAttributeValue( "powerup max charges", true ) ) end if player.PentUpDamage > 0 and ( player.StoneWall == false ) then if player.DamagePerSec == false then player.DamagePerSec = player.PentUpDamage / ( 16 * 10 ) player.FloatHealth = player.m_iHealth end if CurTime() >= player.DamageDelay then player.DamageDelay = CurTime() + 0.1 if math.round( player.FloatHealth, 0 ) ~= math.round( player.m_iHealth, 0 ) then player.FloatHealth = player.m_iHealth end player.FloatHealth = player.FloatHealth - player.DamagePerSec local dmg = { Damage = math.abs( math.round( player.m_iHealth - player.FloatHealth, 0 ) ), Attacker = player, DamageType = DMG_GENERIC | DMG_PREVENT_PHYSICS_FORCE | DMG_NEVERGIB } player:TakeDamage( dmg ) player.PentUpDamage = math.max( player.PentUpDamage - player.DamagePerSec, 0 ) end else player.DamagePerSec = false end if player.StoneWall == true then player:SetAttributeValue( "dmg taken increased", 0 ) else player:SetAttributeValue( "dmg taken increased", nil ) end -- print( player.StoneWall, player.PentUpDamage, player.DamagePerSec ) end end end function UseAction( player ) local bottle = player:GetPlayerItemBySlot( LOADOUT_POSITION_ACTION ) if bottle:GetItemName() == "{Consumable} Medical Shot" and ( player.m_iHealth < player.m_iMaxHealth ) then player:AddHealth( 25, false ) bottle:SetAttributeValue( "powerup charges", bottle:GetAttributeValue( "powerup charges" ) - 1 ) player:PlaySoundToSelf( "HealthKit.Touch" ) elseif bottle:GetItemName() == "{Consumable} Adrenaline Shot" and ( not player:InCond( 32 ) ) then player:AddCond( TF_COND_SPEED_BOOST, 6 ) player:RemoveCond( TF_COND_STUNNED ) --Remove slow player:SetAttributeValue( "mult stun resistance", 0 ) timer.Simple(6, function() player:SetAttributeValue( "mult stun resistance", nil ) end) bottle:SetAttributeValue( "powerup charges", bottle:GetAttributeValue( "powerup charges" ) - 1 ) elseif bottle:GetItemName() == "{Consumable} Stone Wall" and ( player.StoneWall == false ) then player:AddCond( TF_COND_PASSTIME_INTERCEPTION, 7.5 ) player.StoneWall = true timer.Simple(7.5, function() player.StoneWall = false end) bottle:SetAttributeValue( "powerup charges", bottle:GetAttributeValue( "powerup charges" ) - 1 ) elseif bottle:GetItemName() == "{Consumable} Wrath Injection" and ( player:GetAttributeValue( "dmg penalty vs players" ) == nil ) then player:SetAttributeValue( "dmg penalty vs players", lerp( 1.75, 1.15, ( ( #ents.GetAllAliveRealPlayers() - 1 ) / ( math.max( #ents.GetAllRealPlayers() - 1, 1 ) ) ) ) ) --player:AcceptInput( "RunScriptCode", "ScreenFade( !activator, 250, 50, 50, 25, 0.05, 1.5, 2 )", player, player ) player:PlaySound( "Wrath.Use_1" ) --player:PlaySound( "Wrath.Use_1" ) player:PlaySound( "Wrath.Use_2" ) --player:PlaySound( "Wrath.Use_2" ) player:PlaySound( "Wrath.Use_3" ) --player:PlaySound( "Wrath.Use_3" ) player:AcceptInput( "RunScriptCode", "ScreenFade( !activator, 250, 50, 50, 25, 3, 27, 1 )", player, player ) --timer.Simple(1, function() player:AcceptInput( "RunScriptCode", "ScreenFade( !activator, 250, 50, 50, 25, 3, 16.95, 1 )", player, player ) end) timer.Simple(30, function() player:SetAttributeValue( "dmg penalty vs players", nil ) end) bottle:SetAttributeValue( "powerup charges", bottle:GetAttributeValue( "powerup charges" ) - 1 ) end end function OnWaveSpawnBot(bot, wave, tags) --only used in superbuffed version GiveCallbacks( bot, tags ) end function GiveCallbacks( bot, tags ) if bot.m_iClass ~= TF_CLASS_SPY then local usesLeft = 3 local maxHealth = bot.m_iHealth local curHealth = bot.m_iHealth local enraged = false local ShotCount = 0 local enrageCount = 0 local maxammo = bot.m_hActiveWeapon.m_iClip1 local __Callback_Enrage__ = nil local __Callback_Uber__ = nil local __Callback_FireCanteens__ = nil local __Callback_Cleanup__ = nil __Callback_Cleanup__ = bot:AddCallback(ON_DEATH, function() --clean up bot:RemoveCallback(ON_DAMAGE_RECEIVED_POST, __Callback_Enrage__) bot:RemoveCallback(ON_DAMAGE_RECEIVED_PRE, __Callback_Uber__) bot:RemoveCallback(ON_DEATH, __Callback_Cleanup__) for i=0, 2 do if ( IsValid( bot:GetPlayerItemBySlot(i) ) ) and ( __Callback_FireCanteens__ ) then bot:GetPlayerItemBySlot(i):RemoveCallback(ON_FIRE_WEAPON_PRE, __Callback_FireCanteens__) end end end) __Callback_Enrage__ = bot:AddCallback(ON_DAMAGE_RECEIVED_POST, function(ent, damage, previousHealth) curHealth = bot.m_iHealth if IsValid(bot:GetPlayerItemBySlot(0)) then if ( bot:GetPlayerItemBySlot(0):GetItemName() == "The Phlogistinator" ) and ( not has_value(tags, "bot_boss") ) and ( not bot:InCond(44) ) then --phlog taunt when injured function. if curHealth <= maxHealth*0.8 and ( enraged == false ) then enraged = true bot:Taunt("TAUNT_BASE_WEAPON", 0) end end end if has_value(tags, "bot_enragable") then --enrage bot function if curHealth <= maxHealth*0.65 and ( enraged == false ) then if maxHealth > 20000 then enraged = true bot:AddCond(34,17) bot:AddCond(26,17) bot:AddCond(71,1) bot:AddCond(52,2.5) bot:ChangeAttributes("Enraged") timer.Simple(17, function() bot:ChangeAttributes("Defualt") end) else enraged = true bot:AddCond(34,7) bot:AddCond(26,7) bot:AddCond(71,1) bot:AddCond(52,2.5) bot:ChangeAttributes("Enraged") timer.Simple(7, function() bot:ChangeAttributes("Defualt") end) end end end end) __Callback_Uber__ = bot:AddCallback(ON_DAMAGE_RECEIVED_PRE, function(ent, damage) curHealth = bot.m_iHealth if has_value(tags, "bot_canteenuber") then --uber canteen bot function if not bot:InCond(8) then if curHealth <= maxHealth*0.25 and ( enraged == false ) then usesLeft = 0 bot:AddCond(52,5) util.PrintToChatAll('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fÜBERCHARGE \x07FBECCBPower Up Canteen!') for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end enraged = true elseif damage.Damage >= curHealth and ( enraged == false ) then -- makes the uber canteen bot servive a lethal strike -- usesLeft = 0 bot:AddCond(52,5) util.PrintToChatAll('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fÜBERCHARGE \x07FBECCBPower Up Canteen!') for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end enraged = true end end end end) timer.Simple(0.5, function() __Callback_FireCanteens__ = bot.m_hActiveWeapon:AddCallback(ON_FIRE_WEAPON_PRE, function(ent) if has_value(tags, "bot_canteencrit") then --crit canteen bot function if ( not bot:InCond(34) ) and ( not bot:InCond(51) ) then --only increment shot count when not critboosted and not in spawn ShotCount = ShotCount + 1 if ShotCount >= 3 and ( enrageCount < 3 ) then ShotCount = 0 enrageCount = enrageCount + 1 bot:AddCond(34,5) util.PrintToChatAll('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fCRITS \x07FBECCBPower Up Canteen!') --what an ungodly parameter for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end end else ShotCount = 0 --to prevent back to back to back crit canteens end end if has_value(tags, "bot_canteenammo") then --ammo canteen bot function if ent.m_iClip1 == 0 and (usesLeft ~= 0) then usesLeft = usesLeft - 1 ent.m_iClip1 = maxammo util.PrintToChatAll('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fAMMO REFILL \x07FBECCBPower Up Canteen!') for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end end end end) end) end end function OnWaveInit(wave) InWave = false end function OnWaveStart(wave) InWave = true end function RocketNoclip( self, classname ) timer.Simple( 0.1, function() print( self ) if IsValid( self ) and self:GetModel() == "models/player/items/all_class/haunted_eyeball_hat_demo.mdl" then local NoClip = self:AddCallback( ON_SHOULD_COLLIDE, function( _, collided ) if not IsValid( self ) then self:RemoveCallback(NoClip) end print( "collided" ) return false end) end end) end ents.AddCreateCallback("tf_projectile_rocket", RocketNoclip)