Bullets not working properly(missing impact effects/force)
0 replies, posted
I don't know why, but my SWEP does not apply force to physics objects and fails to create impact effects for water and glass.
I have been trying for a while now to figure it out, no lua errors and everything else works. I think it has something to do with how I create and fire my bullets.
Here is the primary fire code, is there anything obvious?
[LUA]
function SWEP:PrimaryAttack()
//if not self:CanShootWeapon() then return end
if not self:CanPrimaryAttack() then return end
self:SetNextPrimaryFire(CurTime() + self.ERPS)
local bullet = {}
bullet.Num = self.EBulletsPerShot
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector(accuracy * 0.1 , accuracy * 0.1, 0)
bullet.Distance = self.ERange
bullet.Tracer = 1
bullet.TracerName = "Tracer"
bullet.Force = self.EBaseDamage/2
bullet.Damage = self.EBaseDamage
bullet.AmmoType = self.Primary.Ammo
self.Owner:FireBullets(bullet)
self:TakePrimaryAmmo(self.ETakeAmmoAmmount)
self:EmitSound(Sound(self.Primary.Sound))
self:ShootAnimation()
local rnda = self.ERecoil * (1+(1*(1-(self.Owner:Health()/100)))) * -1
local rndb = self.ERecoil * (1+(1*(1-(self.Owner:Health()/100)))) * math.random(-1, 1)
self.Owner:ViewPunch(Angle(rnda,rndb,0))
end[/LUA]
Also, whenever I shoot a physics object it prints
"AddMultiDamage: g_MultiDamage.GetDamageForce() == vec3_origin"
in the console.
[editline]6th February 2017[/editline]
Nevermind! I fixed it, it had something to do with primary ammo being updated in SWEP:Initialize()
Sorry, you need to Log In to post a reply to this thread.