|
Tenek Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 12
|
07-29-2008 04:19
Hi everybody.
I looking for some advice or help with this, I'm wanting to make a smoke grenade, that when fired, the grenade hits a person or wall/floor etc starts to disperse a smoke cloud that creates a semi dense cover of smoke that would linger for about 30 secs.
What would be the best way to do this, or if anyone has a script that would do this, any help would be appreciated.
Many thanks.
|
|
Raymond Nightfire
Known reverse engineer
Join date: 5 Nov 2007
Posts: 51
|
One already exsists in SL
07-29-2008 09:23
If you need a smokebomb, I will send you a full permed one I found.  I used it as a base for my tiny modded smokebomb thrower, and its free with all of my other tiny throwers. 
_____________________
Warning, I WILL reverse engineer any thing that is copy/mod!! I don't mean to offend the original builder, I just like to see how things are made and to get ideas for my own builds. 
|
|
Tenek Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 12
|
07-29-2008 09:37
Thank you, that would be most kind.
/me smiles
As you probably could guess, my av's name is Tenek Epsilon.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-29-2008 11:23
This is quite simple really. From a 'collision_start' and 'land_collision_start' handler, switch to a different state (you could do it with a variable as well, but a new state would be a simple way of marking that "we want to do this only from the first collision"  . In the 'state_entry' of that state, start both a llParticleSystem() and a timer. From the timer event, turn off the particles (llParticleSystem([])). If you'd really want to be able to pick up the grenade and reuse it, switch back to the original state if you get an 'on_rez' event. It could look something like this (I just did a rough job on the particle smoke; you might want to tweak that): // Obtained from rez start parameter integer smokeDuration = 0;
particlesOn() { llParticleSystem( [ PSYS_PART_START_ALPHA, 0.4, PSYS_PART_END_ALPHA, 0.8, PSYS_PART_START_COLOR, <0.2, 0.2, 0.2>, PSYS_PART_END_COLOR, <0.7, 0.7, 0.7>, PSYS_PART_START_SCALE, <1.0, 1.0, 1.0>, PSYS_PART_END_SCALE, <4.0, 4.0, 4.0>, PSYS_PART_MAX_AGE, 4.0, //PSYS_SRC_MAX_AGE, 0.0, PSYS_SRC_ACCEL, ZERO_VECTOR, PSYS_SRC_ANGLE_BEGIN, 0.0, PSYS_SRC_ANGLE_END, PI, PSYS_SRC_BURST_PART_COUNT, 6, PSYS_SRC_BURST_RADIUS, 0.0, PSYS_SRC_BURST_RATE, 0.1, PSYS_SRC_BURST_SPEED_MIN, 1.0, PSYS_SRC_BURST_SPEED_MAX, 1.5, //PSYS_SRC_OMEGA, ZERO_VECTOR, //PSYS_SRC_TARGET_KEY, NULL_KEY, //PSYS_SRC_TEXTURE, "", PSYS_SRC_PATTERN, //PSYS_SRC_PATTERN_ANGLE, //PSYS_SRC_PATTERN_ANGLE_CONE, //PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY, //PSYS_SRC_PATTERN_DROP, PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_FLAGS, 0 //| PSYS_PART_BOUNCE_MASK //| PSYS_PART_EMISSIVE_MASK //| PSYS_PART_FOLLOW_SRC_MASK //| PSYS_PART_FOLLOW_VELOCITY_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK //| PSYS_PART_TARGET_LINEAR_MASK //| PSYS_PART_TARGET_POS_MASK //| PSYS_PART_WIND_MASK ]); }
particlesOff() { llParticleSystem([]); }
default { state_entry() { if (smokeDuration != 0) { state armed; } }
on_rez(integer startParam) { smokeDuration = startParam; if (smokeDuration != 0) { state armed; } } }
state armed { on_rez(integer startParam) { smokeDuration = startParam; state default; }
collision_start(integer nDetected) { state activated; }
land_collision_start(vector pos) { state activated; } }
state activated { state_entry() { particlesOn(); llSetTimerEvent(smokeDuration); }
timer() { particlesOff(); // maybe llDie() if object isn't temporary }
on_rez(integer startParam) { smokeDuration = startParam; state default; } }
|