-- used scroobs emponhit as base function railgun_stun(damage, activator, caller) if caller:IsRealPlayer() == true then return end local stun = true local dmg_mult = 1 local explosion_radius = 1 if damage < 4 then --afterburn stunlocking is ridiculous return end local upgradeLevel = (activator:GetPlayerItemBySlot(0):GetAttributeValue("disguise speed penalty")) or 0.25 if caller.m_iHealth > 1500 then dmg_mult = 5 stun = false explosion_radius = 0.001 end if stun then caller:AddCond(71, (upgradeLevel * 4), activator) end timer.Simple(0.75, function() local callerOrigin = caller:GetAbsOrigin() local botOrigin = "" .. callerOrigin[1] .. " " .. callerOrigin[2] .. " " .. callerOrigin[3] .. "" local explosionParticle = ents.CreateWithKeys("info_particle_system",{ ["start_active"] = "0", ["flag_as_weather"] = "0", ["effect_name"] = "Explosions_MA_Dustup_2", ["origin"] = botOrigin, ["angles"] = "0 0 0", }) local explosionParticle2 = ents.CreateWithKeys("info_particle_system",{ ["start_active"] = "0", ["flag_as_weather"] = "0", ["effect_name"] = "rd_robot_explosion_smoke_linger", ["origin"] = botOrigin, ["angles"] = "0 0 0", }) explosionParticle:AcceptInput("Start") explosionParticle2:AcceptInput("Start") local sphereResults = ents.FindInSphere(caller:GetAbsOrigin(), 150 * explosion_radius * (1 + (upgradeLevel/2))) local dmgTable = { Attacker = activator, -- Attacker Inflictor = nil, -- Direct cause of damage, usually a projectile Weapon = activator:GetPlayerItemBySlot(2), Damage = 100 * upgradeLevel * dmg_mult, DamageType = DMG_BLAST, -- Damage type, see DMG_* globals. Can be combined with | operator DamageCustom = nil, -- Custom damage type, see TF_DMG_* globals CritType = 0, -- Crit type, 0 = no crit, 1 = mini crit, 2 = normal crit DamagePosition = nil, -- Where the target was hit at DamageForce = nil, -- Knockback force of the attack ReportedPosition = nil -- Where the attacker attacked from } if sphereResults then for _, entity in pairs(sphereResults) do if entity:IsPlayer() and entity:IsAlive() and entity.m_iTeamNum ~= activator.m_iTeamNum then entity:TakeDamage(dmgTable) entity:AddCond(30, 4, entity) end end end end) end