Don't use code like this:
llParticleSystem([ stuff ]);
llSleep(2.0);
llParticleSystem([]);
I'm not sure why exactly but I usually don't see particles with that kind of code. Why? Two possible reasons:
1) The object update might not be occuring because the event handler is still paused on your sleep.
2) Because of latency from the sim to your client, by the time the client/viewer gets the object update to start showing particles, suddenly there's a 'turn off particles' following it. The llSleep(2.0) doesn't guarantee there'll be 2 seconds between start and stop on the client side.
#2 there can also apply if you do something like this:
state_entry() {
llParticleSystem([ stuff ]);
llSetTimerEvent(2.0);
}
timer() {
llParticleSystem([]);
}
Again, the turn on command may be delayed more than the turn off command. the 2 seconds wait is on the sim side, not on the client side.
You're better off setting the turn off time INSIDE the particle definition, with the PSYS_SRC_MAX_AGE parameter. That timer is started when particles start being created in the client, independent of when the script in the sim think it said to start the particle display.
Also, make sure your PSYS_SRC_BURST_RATE is LESS than your PSYS_SRC_MAX_AGE or the delay between particle bursts might result in no bursts at all between start and shutoff.
Pulling it all together, something like:
default {
state_entry() {
llParticleSystem( [
PSYS_SRC_BURST_RATE, 0.05,
PSYS_SRC_MAX_LIFE, 1.1, // turn emitter off after 1.1 seconds. less than 1.0 may yield no particles too!
PSYS_SRC_BURST_PART_COUNT, 2, // 2 per burst
PSYS_PART_MAX_LIFE, 5.0, // particles fade after 5sec
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE
] );
llResetTime(); llSetTimerEvent( 3.0 );
}
timer() {
llParticleSystem( [ ] );
// why the timer event? Because when you turn particles off with PSYS_SRC_MAX_LIFE, they aren't 'completely' off. Everytime a player gets close enough to see this prim it will start the particle display again until PSYS_SRC_MAX_LIFE expires again!
}
}
I hope this helps!
