Trailparticle getting chopped up

Discuss programming in the QuakeC language.
Post Reply
Mexicouger
Posts: 514
Joined: Sat May 01, 2010 10:12 pm
Contact:

Trailparticle getting chopped up

Post by Mexicouger »

So I have created a tracer for a bullet. The bullet is a temporary entity and thinks every 0.05 seconds to call upon the function "trail" to create a trailparticle behind it a bit. It works fine and all when I shoot 1 or 2 bullets. But When I shoot 3 bullets, the tracer particles flicker and/or disapear..

Image
As you can see in the image, the particle effect is far behind the bullet. At this point in the screenshot, 3 bullets had been fired and this bullets tracer particle effects started flickering.

Here is my particle effect:

Code: Select all

//Bullet tracer
effect bullet_trace
count 1
countabsolute 1
trailspacing 0.05
type smoke
blend add
size 0.2 0.2
tex 4 4
time 0.1 0.5
alpha 100 120 250
originjitter 1 1 3
stretchfactor 3
Any help would be appreciated! If anyone needs more information I will be happy to explain further. I basically want to find out why the particles flicker and/or disapear and how to prevent it. Thanks!
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Trailparticle getting chopped up

Post by Seven »

Hello Mexicouger,

You should not (need not) write a QC time loop, if you want to add partiles to a (moving) entity.
Knowing from other threads, you are using the Darkplaces engine:
Darkplaces helps you with it and takes over the work.

This is what need:
//DP_ENT_TRAILEFFECTNUM
//idea: LordHavoc
//darkplaces implementation: LordHavoc
//field definitions:
.float traileffectnum;
//description:
//use a custom effectinfo.txt effect on this entity, assign it like this:
//self.traileffectnum = particleeffectnum("mycustomeffect");
//this will do both the dlight and particle trail as described in the effect, basically equivalent to trailparticles() in CSQC but performed on a server entity.
It was implemented into DP in june 2011, so even the "stable" build from 2011 has it.

Put it into your spawning bullet function like this:
...
bullet = spawn();
bullet.traileffectnum = particleeffectnum("bullet_trace");
....
Next thing is your particle effect declaration.
You must not use the "count" or "countabsolute" keyword for moving entities.
(by the way, you must not use both in the same block)
That is only for entities with movement = 0
You must use the keyword "trailspacing" for your bullet.
(bigger value means bigger gap/pause between particles, so try with "trailspacing 1" first and then go slowly upwards until you are staisfied)

This is very good explained in the dpwiki as well.
As you know it is offline, so please use the backup instead:
http://www.quakewiki.net/darkplaces-wik ... reference/

Also think about your usage of "time" and the very high "alpha" fade-rate in the same block.

There are many examples of effectinfo.txt usage for moving and static effects in the downloadable "small mod compilation". If you want you can look inside and read/see some samples there.

Best wishes,
Seven
Post Reply