Hello, Is it possible to make custom tracers for the Entity.FireBullets() BulletInfo structure?
Override the firebullets function in a metatable. Make sure to “backup” and call the old function somewhere along the line. The best way to do this would be to use the callback trace to calculate how your tracer is drawn, then pass the arguments down to the old function.
Okay I could definitely see using a detour in this scenario, reading the BulletInfo structure, reading the TracerName to check if it is one of my custom tracers then create that effect and set the TracerName to “None”.
Thank you sir.
The only thing I’m having trouble playing out in my mind is making the tracer effect match up with when the bullet actually hits and deals damage.
Like if I wanted to use my own custom effect or particle tracer for example the vortigaunt_beam and vortigaunt_beam_b particle tracers
util.ParticleTracerEx( “vortigaunt_beam”, FirePos, HitPos, true, Attacker:EntIndex(), 1 )
Now wait a moment - you’re not trying to override default tracers?
Couldn’t you make a scripted effect to handle all that stuff for you?
You wouldn’t need to detour in that case. You could just use the callback to pass arguments to an instance of your custom effect, from there doing your particle tracers and stuff.
At least that’s my interpretation… mind providing a little more context?
Sure, I’m making an automated sentry, I’ve made a custom model with a head that rotates on a tripod.
I want the sentry to fire the regular bullets like the AR2Tracer, Tracer, StriderTracer, ectera
But I also want the tracer on the bullets to be some custom effects and a few of the particle tracers like vortiguant_beam and vortiguant_beam_b
The regular tracers are simple, I just pass it to the BulletInfo.TracerName structure and I’m done, but for the custom effects and the particle tracers I’m not sure how to get it so that when damage is dealt to the target through FireBullets it matches up with when the effect/particle hits the target also.
Oh, you mean like a hit indicator?
Why not just use an inline Callback function to summon an effect?
I mean there are a few different point in time when I can create the effect its just getting when the effect hits the target to match up with when damage is dealt to the target is what I’m confused on.
I’m a little discombobulated by what you’re trying to say…
Why not just create the effect in callback?
All you have to do is make a custom effect. You can set the effect name using the TracerName key in the BulletInfo struct.
Just setup your effects init function like so…
[lua]function EFFECT:Init( data )
self.Weapon = data:GetEntity() self.StartPos = data:GetStart() self.EndPos = data:GetOrigin() self.Attachment = data:GetAttachment() self.StartPos = self:GetTracerShootPos( self.StartPos, self.Weapon, self.Attachment ) self:SetRenderBoundsWS( self.StartPos, self.EndPos )
FireBullets will pass all of that data to your custom effect. There is no need to override anything, everything you need is already there for you.
Okay thank you very much BlackAwps that answers a good chunk of my questions. I’ll just have to assume that the stock effects and vortigaunt particle tracers move at the same speed FireBullets fires it’s bullets, and if not too bad I suppose.