A question about tracers.

I’m making a quick little laser pistol for my community build server, And so far, I’m doing pretty good; sounds, effects, tracers, all that fancy stuff. However, I’ve ran into a problem. I want the pistol to have a small spread along with it, but the only thing I can adjust is the actual bullet itself, and not the tracer. Is it possible for a tracer to “follow” a bullet in random directions or am I just gonna have to scrap the spread idea?

a bullet tracer or a utilities trace?


Can you show the code for your bullet and tracer because it should follow the bullet 0.0

It’s horribly slapped together and it needs optimization… But here you go.

self:ShootBullet( 100, 1, 0 )

// Remove 1 bullet from our clip
self:TakePrimaryAmmo( 1 )

	local vShootPos = self.Owner:GetShootPos()
	local vShootAng = self.Owner:GetAimVector()
	local t = {}		

	t.caller  	= self.Owner	
	t.start   	= vShootPos	
	t.sang	 	= vShootAng	
	t.mreps	 	= 100		
	t.reps   	= 0 
	t.damage 	= 40
	t.length 	= 70
	t.filter 	= self.Owner		
	t.maxpens 	= 20
	t.pens	  	= 0
	t.powdeg  	= .01
	t.skew	  	= Vector( .05, .05, .05 )
	t.canbounce	= true
	t.bounceang	= .3
	t.bouncechance	= .4

// Punch the player's view
self.Owner:ViewPunch( Angle( -1, 0, 0 ) )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.08 )

local trace = self.Owner:GetEyeTrace()

local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetNormal( trace.HitNormal )
effectdata:SetEntity( trace.Entity )
effectdata:SetAttachment( trace.PhysicsBone )

local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetStart( self.Owner:GetShootPos() )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Weapon )
util.Effect( “ToolTracer”, effectdata )
if (SERVER) then
local owner=self.Owner
if self.Owner.SENT then

–Bleh? This swep doesn’t work if this isn’t here.


function SWEP:ShootBullet( damage, num_bullets, aimcone )
local bullet = {}
bullet.Num = num_bullets
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( aimcone, aimcone, 0 )
bullet.Tracer = 5000
bullet.Force = 5000
bullet.Damage = damage
bullet.AmmoType = “AR2AltFire”
self.Owner:FireBullets( bullet )



I just want to see if I could actually make a half-decent looking swep. But this whole tracer thing is irkin’ me.

Create a callback for the bullet struct, tell it where to make the effect end.

Call me an idiot for saying this, but I honestly have no idea how to do that; I’ve never really had experience with bullet tracers before.

would there happen to be a better looking example? I mean,I still don’t quite understand it.