function ExplodeSapper(bot, attacker) for _, others in pairs(ents.FindInSphere(bot:GetAbsOrigin(),147)) do if others:IsBot() then others:TakeDamage({ Attacker = attacker, Damage = 100, DamageType = DMG_BLAST, DamageCustom = TF_DMG_CUSTOM_MERASMUS_GRENADE }) end end util.ParticleEffect( "rd_robot_explosion", bot:GetAbsOrigin() + Vector(0, 0, 32), Vector(0, 0, 0), bot ) bot:PlaySound("BaseExplosionEffect.Sound") bot.SapperExploded = true end function OnGameTick() print("hello world") for _, player in pairs(ents.GetAllPlayers()) do if ( player:IsBot() ) and ( player:InCond(50) ) and ( player:GetConditionProvider(50):GetPlayerItemBySlot(4):GetAttributeValue("sapper health bonus") ~= nil ) then local attacker = player:GetConditionProvider(50) if ( player.SapperExplodeDelay < 1 ) and ( player.SapperExploded == false ) then ExplodeSapper(player, attacker) else player.SapperExplodeDelay = player.SapperExplodeDelay -1 end elseif ( player:IsBot() ) and ( not player:InCond(50) ) and ( player.SapperExplodeDelay ~= 3 * 66) then player.SapperExplodeDelay = 3 * 66 end end end function OnWaveSpawnBot(bot, wave, tags) bot.SapperExploded = false bot.SapperDamageDelay = 0 bot.SapperExplodeDelay = 3 * 66 bot:AddCallback(ON_DEATH, function(ent) if ( bot:IsBot() ) and ( bot:InCond(50) ) and ( bot:GetConditionProvider(50):GetPlayerItemBySlot(4):GetAttributeValue("sapper health bonus") ~= nil ) then local attacker = bot:GetConditionProvider(50) if ( bot.SapperExploded == false ) and ( bot.SapperExplodeDelay > 0 ) then ExplodeSapper(bot, attacker) end end end) end