InvulnerableCondTable = { TF_COND_INVULNERABLE, TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED, TF_COND_INVULNERABLE_USER_BUFF, TF_COND_INVULNERABLE_CARD_EFFECT, } Wavebar = ents.FindByClass("tf_objective_resource") function IsInvulnerable(player) for _, cond in pairs(InvulnerableCondTable) do if player:InCond(cond) then break return true end end return false end function GetVelocity(entity) return Vector(entity.m_vecVelocity[1], entity.m_vecVelocity[2], entity.m_vecVelocity[3]) end function GetViewModel(player) for _, vm in pairs(ents.FindAllByClass("tf_viewmodel")) do if vm.m_hOwner == player then return vm end end end function GetEyeAngles(player) return Vector(player.m_angEyeAngles[1], player.m_angEyeAngles[2], player.m_angEyeAngles[3]) end function GetViewHeight(player) local result = player.m_vecViewOffset[3] if player.m_fFlags & FL_DUCKING ~= 0 then result = 40 * player.m_flModelScale end return result end function GetCamera(player) local origin = player:GetAbsOrigin() local height = GetViewHeight(player) local result = origin + Vector(0, 0, height) return result end function Delay(seconds) local globaltime = CurTime() local newtime = globaltime + seconds return newtime end ------- iChiefAmmo = 220 bChiefActive = false SCOUT_EXPLODE_VELOCITY_MULT = 2.5 SCOUT_EXPLODE_FALL_MULT = 16 SCOUT_EXPLODE_ALLOW_QUICKFIX = 1 SCOUT_EXPLODE_EASTEREGG_COOLDOWN = 0.75 SCOUT_EXPLODE_EASTEREGG_MAX_JUMPS = 9 ROCK_LAUNCH_VELOCITY = 200 ROCK_MODEL_INDEX = precache.PrecacheModel("models/weapons/c_models/c_rock_pyro/c_rock_pyro.mdl") function Deafen() for _, player in pairs(ents.GetAllPlayers()) do ents.FindByName('cmd'):AcceptInput('command', 'soundfade 80 5 2 0', player) end end function GetClip(player) local wep = player.m_hActiveWeapon if wep == nil or not player:IsAlive() then return end local clip = wep.m_iClip1 return clip end function OnBarrage(_, activator) local chosen for _, bot in pairs(ents.GetAllPlayers()) do if bot:IsAlive() and bot.m_iszClassIcon == "soldier_barrage" and bot ~= activator then chosen = bot break end end if chosen == nil then return end if GetClip(activator) == 0 then chosen:SetAttributeValue("no_attack", nil) elseif GetClip(activator) == 29 then chosen:SetAttributeValue("no_attack", 1) end end function OnBarrageDead() for _, bot in pairs(ents.GetAllPlayers()) do bot:SetAttributeValue("no_attack", nil) end end function OnChiefSpawn() bChiefActive = true end function OnChiefDead() bChiefActive = false end function DeductAmmo() local chosen for _, bot in pairs(ents.GetAllPlayers()) do if bot:IsAlive() and bot.m_iszClassIcon == "heavy" and bot.m_bIsMiniBoss == 1 then chosen = bot break end end iChiefAmmo = iChiefAmmo - 1 for _, player in pairs(ents.GetAllPlayers()) do player:DisplayTextCenter(iChiefAmmo) end if iChiefAmmo < 1 then chosen:WeaponStripSlot(LOADOUT_POSITION_PRIMARY) chosen:WeaponStripSlot(LOADOUT_POSITION_MELEE) chosen:WeaponSwitchSlot(LOADOUT_POSITION_SECONDARY) chosen:WeaponStripSlot(LOADOUT_POSITION_PRIMARY) end end function BustletDetonate(bot) local mimic = ents.CreateWithKeys("tf_point_weapon_mimic", { ["$weaponname"] = "bustlet detonator", teamnum = bot.m_iTeamNum, targetname = "boom", }, true, true) local shake = ents.CreateWithKeys("env_shake", { radius = 500, frequency = 200, amplitude = 150, duration = 1, targetname = "boom", }) bot:PlaySound("NilValue.Bustlet_Explode") util.ParticleEffect("Explosions_UW_Debris001", bot:GetAbsOrigin() + Vector(0,0,50), nil, bot) mimic:SetAbsOrigin(bot:GetAbsOrigin() + Vector(0, 0, 25)) shake:SetAbsOrigin(bot:GetAbsOrigin() + Vector(0, 0, 50)) bot:Suicide() mimic:SetOwner(bot) mimic:FireOnce() shake:StartShake() timer.Simple(0.2, function() mimic:Remove() shake:Remove() end) if bot.m_hRagdoll ~= nil then bot.m_hRagdoll:Remove() end end function ScoutExplode(player) if not player:IsAlive() then return false end local vel = GetVelocity(player) player:SetLocalVelocity((vel * SCOUT_EXPLODE_VELOCITY_MULT) * player.m_iAirDash) player:AddCond(TF_COND_BLASTJUMPING) for _, medigun in pairs(ents.FindAllByClass("tf_weapon_medigun")) do local owner = medigun.m_hOwner if medigun.m_hHealingTarget == player and medigun.m_iItemDefinitionIndex == 411 then --quick fix if SCOUT_EXPLODE_ALLOW_QUICKFIX == 1 then owner:SetLocalVelocity(GetVelocity(owner) + GetVelocity(player)) end end end player:PlaySound("NilValue.AirdashExplode") util.ParticleEffect("ExplosionCore_MidAir_Flare", player:GetAbsOrigin(), nil, player) util.ParticleEffect("Explosion_Smoke_1", player:GetAbsOrigin(), nil, player) --die if you explode too much player.iConsecutiveExplosions = player.iConsecutiveExplosions + 1 if player.iConsecutiveExplosions == SCOUT_EXPLODE_EASTEREGG_MAX_JUMPS then ents.FindByName("cmd"):AcceptInput("command", "dsp_player 36", player) util.ParticleEffect("rd_robot_explosion_smoke_linger", player:GetAbsOrigin(), nil, player) tempents.Send("TFBlood", {m_vecOrigin = player:GetAbsOrigin()}, nil) elseif player.iConsecutiveExplosions > SCOUT_EXPLODE_EASTEREGG_MAX_JUMPS then for _, e in pairs(InvulnerableCondTable) do player:RemoveCond(e) end player:TakeDamage({ Attacker = player, Damage = player.m_iHealth * 3000, DamageType = DMG_BLAST, Inflictor = player, }) player:Suicide() --failsafe end player.flExplosionReset = Delay(SCOUT_EXPLODE_EASTEREGG_COOLDOWN) -- util.PrintToChatAll(player.iConsecutiveExplosions) end function HasRock(player) local melee = player:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE) if melee and melee:GetAttributeValueByClass("throwable_damage", 0) == 1 then return true end return false end function LaunchPlayerWithRock(player) local mult = player:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE):GetAttributeValueByClass("throwable_particle_trail_only", 0) local impulse = ((GetEyeAngles(player):GetForward()) * ROCK_LAUNCH_VELOCITY) * mult if player.m_hGroundEntity ~= nil then impulse[3] = 0 end player:SetLocalVelocity(GetVelocity(player) + impulse) end function EmitRock(player) if not player:IsAlive() then return false end local mimic = ents.CreateWithKeys("tf_point_weapon_mimic", { ["$weaponname"] = "Rock Emitter", teamnum = player.m_iTeamNum, targetname = "aaaaa", }, true, true) mimic:SetOwner(player) mimic:Teleport(GetCamera(player)) mimic:SetAbsAngles(GetEyeAngles(player)) mimic:FireOnce() LaunchPlayerWithRock(player) player:PlaySound("NilValue.RockThrow") timer.Simple(4, function() mimic:Remove() end) end function Recall(damage, activator, caller) -- print("called") if caller:IsPlayer() and caller.m_iTeamNum ~= activator.m_iTeamNum then caller:ForceRespawn() caller:AddCond(TF_COND_SPEED_BOOST, 7, activator) end for _, player in pairs(ents.GetAllPlayers()) do player:DisplayTextChat("{blue}Giant Heavy{9EC34F} RECALLED {red}" .. caller:GetPlayerName() .. "{reset}!") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end function ProcureBomb(num, activator) local player = activator local bomb = ents.CreateWithKeys("item_teamflag", { targetname = intelnew, teamnum = 3, gametype = 3, origin = "0 0 -50000", flag_model = "models/props_td/atom_bomb.mdl", }, true, true) bomb.m_nFlagStatus = 1 bomb.m_hMoveParent = player bomb.m_hParent = player bomb.m_pParent = player player.m_hItem = bomb bomb:SetParentAttachment("flag") player:BotCommand("interrupt_action -posent march_pos" .. num .. " -duration 999") print(num) end --------------- function OnWaveInit() iChiefAmmo = 220 end function OnPlayerConnected(player) player.bBustlet = 0 player.iAirDashTime = 0 player.iConsecutiveExplosions = 0 player.flExplosionReset = 0 player.iAirDashCount2 = 0 player:AddCallback(ON_DEATH, function() player.bBustlet = 0 player:SetAttributeValue("no_attack", nil) player.flExplosionReset = 0 player.iConsecutiveExplosions = 0 player.iAirDashCount2 = 0 ents.FindByName("cmd"):AcceptInput("command", "dsp_player 0", player) end) player:AddCallback(ON_DAMAGE_RECEIVED_PRE, function(_, damageinfo) local attacker = damageinfo.Attacker local weapon = damageinfo.Weapon local inflictor = damageinfo.Inflictor local dtype = damageinfo.DamageType if player.bBustlet == 1 and IsInvulnerable(player) == false and (attacker == nil or attacker ~= nil and attacker.m_iTeamNum ~= player.m_iTeamNum) then player.m_hGroundEntity = nil if not player:InCond(TF_COND_STUNNED) and player.m_iStunFlags & TF_STUNFLAG_BONKSTUCK == 0 then if attacker == nil then attacker = player end player:StunPlayer(4, 1, TF_STUNFLAG_BONKSTUCK | TF_STUNFLAG_SLOWDOWN | TF_STUNFLAG_LIMITMOVEMENT, attacker) player:PlaySound("NilValue.BustletStun") --player:RunScriptCode("self.StopSound(`TFPlayer.StunImpact`)") damageinfo.Damage = 0 else if damageinfo.DamageType & DMG_CLUB == 0 then BustletDetonate(player) end end end if player:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE) ~= nil and player:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE):GetAttributeValueByClass("throwable_healing", 0) == 1 then if dtype & DMG_FALL ~= 0 then if player.m_hGroundEntity:GetClassname() == "player" and player.m_iTeamNum ~= player.m_hGroundEntity.m_iTeamNum and player.m_hGroundEntity:IsAlive() then player.m_hGroundEntity:TakeDamage({ Damage = damageinfo.Damage * 20, DamageCustom = TF_DMG_CUSTOM_BOOTS_STOMP, Attacker = player, }) damageinfo.Damage = 0 player:PlaySound("Weapon_Mantreads.Impact") else damageinfo.Damage = damageinfo.Damage * SCOUT_EXPLODE_FALL_MULT damageinfo.DamageCustom = TF_DMG_CUSTOM_PLASMA_CHARGED player:PlaySound("NilValue.SuperFall") player:RunScriptCode("self.ViewPunch(QAngle(30,0,-25))") end end end return true end) end function OnGameTick() for _, ambient in pairs(ents.FindAllByClass("info_target")) do if ambient.m_hOwnerEntity ~= nil then ambient:Teleport(ambient.m_hOwnerEntity:GetAbsOrigin()) end end for _, gun in pairs(ents.FindAllByClass("tf_weapon*")) do if gun:GetAttributeValue("throwable fire speed") == 1 then if gun.m_hOwner ~= nil and gun.m_hOwner:InCond(TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED) then gun:SetAttributeValue("no_attack", 1) else gun:SetAttributeValue("no_attack", nil) end end end for _, player in pairs(ents.GetAllPlayers()) do if player.bBustlet == 1 then local mins = Vector(-25, -25, -83) local maxs = mins * -1 local org = player:GetAbsOrigin() for _, ent in pairs(ents.FindInBox(org + mins, org + maxs)) do if ent:IsPlayer() or ent:IsObject() then if ent:IsAlive() and ent.m_iTeamNum ~= player.m_iTeamNum then BustletDetonate(player) end end end end --[[ if player.m_iAirDash == 1 then player.iAirDashTime = player.iAirDashTime + 1 else player.iAirDashTime = 0 end ]] if player.iAirDashCount2 ~= player.m_iAirDash then if player:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE):GetAttributeValueByClass("throwable_healing", 0) == 1 and player.m_iAirDash > 0 then ScoutExplode(player) end player.iAirDashCount2 = player.m_iAirDash end if Delay(0) >= player.flExplosionReset then player.iConsecutiveExplosions = 0 end local vm = GetViewModel(player) if player:IsAlive() and HasRock(player) and player.m_hActiveWeapon == player:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE) then vm:RunScriptCode("self.SetPoseParameter(0, 5)") if vm.m_nSequence == 22 then vm:RunScriptCode("self.SetSequence(self.LookupSequence(`spell_fire`))") end if vm.m_nSequence == 30 and vm.m_flCycle > 0.3 then EmitRock(player) vm.m_flCycle = 0 vm.m_nSequence = 21 end end if player.m_hActiveWeapon ~= player:GetPlayerItemBySlot(LOADOUT_POSITION_MELEE) then vm:RunScriptCode("self.SetPoseParameter(0, 0)") end end end --[[ents.AddCreateCallback("item_healthkit_medium", function(ent) ent:AddCallback(ON_SHOULD_COLLIDE, function(entity, cause) if entity.m_hOwnerEntity ~= nil and entity.m_hOwnerEntity.m_iTeamNum == 3 then if cause ~= nil and cause.m_iTeamNum == 2 then cause:TakeDamage({ Attacker = entity.m_hOwnerEntity, Damage = 50000, DamageType = 2048, }) entity:Remove() return false end end end) end) ]] ents.AddCreateCallback("tf_projectile_throwable_brick", function(ent) ent.m_nModelIndex = ROCK_MODEL_INDEX ent:SetModelOverride("models/weapons/c_models/c_rock_pyro/c_rock_pyro.mdl") -- print("spawned brick") end) function OnWaveSpawnBot(bot) timer.Simple(0.1, function() if bot.bBustlet == 1 then bot:RunScriptCode("self.RemoveBotTag(`common`)") end end) end