Garry's Mod
[ARC9] PolyArms Project
grenade fragmentation
-- Simulate grenade shrapnel using trace lines with custom damage and effects timer.Simple(0.1, function() if not IsValid(self) then return end local num_shrapnel = math.random(50, 120) for i = 1, num_shrapnel do local dir = VectorRand():GetNormalized() local src = self:GetPos() + Vector(0, 0, 5) -- raise slightly to avoid ground hits local tr = util.TraceLine({ start = src, endpos = src + dir * 3072, filter = {self} }) if IsValid(tr.Entity) and tr.Entity.TakeDamage then local dmg = DamageInfo() dmg:SetDamage(math.random(10, 65)) dmg:SetAttacker(IsValid(self:GetOwner()) and self:GetOwner() or self) dmg:SetInflictor(self) dmg:SetDamageType(DMG_SLASH) tr.Entity:TakeDamageInfo(dmg) end if tr.Hit then local ed = EffectData() ed:SetOrigin(tr.HitPos) ed:SetNormal(tr.HitNormal) util.Effect("cball_bounce", ed) end end end)
แก้ไขล่าสุดโดย Dahaka; 23 พ.ค. @ 8: 02pm
< >
กำลังแสดง 1-1 จาก 1 ความเห็น
Darsu  [ผู้พัฒนา] 23 พ.ค. @ 10: 57pm 
This just adds unnecessary randomization to damage
< >
กำลังแสดง 1-1 จาก 1 ความเห็น
ต่อหน้า: 1530 50