Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Particles eltees_Particle_Engine_1  

eltees_Particle_Engine_1

eltee's Particle Engine 1.lsl

Category: Particles
By : eltee Statosky
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for eltees_Particle_Engine_1
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. eltees_Particle_Engine_1_1.lsl
1
2 //////////////////////////////////////////////////////////////////
3 //// eltee Statosky's Particle Creation Engine 1.5
4 //// 09/09/2004
5 //// *PUBLIC DOMAIN*
6 //// Free to use/copy/poke/ripoff and sell stuff with
7 //////////////////////////////////////////////////////////////////
8
9
10 ///////////////////////////////////////////////////////
11 // Effect Flag Collection variable
12 ///////////////////////////////////////////////////////
13 integer effectFlags;
14 integer running=TRUE;
15
16
17 ///////////////////////////////////////////////////////
18 // Color Variables
19 //
20 // These affect color and transparency
21 ///////////////////////////////////////////////////////
22 // colorInterpolation TRUE gives a smooth start to end change
23 // The colors are presented as <R, G, B> values between 0 and 1
24 // The alphas are transparency. 1.0 is solid, 0.0 is clear
25 // glowEffect TRUE has bright 'light like' particles
26 // glowEffect FALSE has unlit 'smoke like' particles
27 integer colorInterpolation = TRUE;
28 vector startColor = <0.5, 0.0, 0.75>;
29 vector endColor = <0.0, 1.0, 1.0>;
30 float startAlpha = 1.0;
31 float endAlpha = 0.0;
32 integer glowEffect = TRUE;
33
34
35 ///////////////////////////////////////////////////////
36 // Size & Shape Variables
37 //
38 // These affect the particle's physical appearance
39 ///////////////////////////////////////////////////////
40 // sizeInterpolation TRUE gives a smooth start to end change
41 // The sizes are presented as <X, Y, 0.0> (z is meaningless)
42 // followVelocity TRUE is the only way to get particles to
43 // 'tilt' but can be very tricky to implement
44 // texture = "texturename" loads texturename as particle shape
45 integer sizeInterpolation = TRUE;
46 vector startSize = <0.5, 0.5, 0.0>;
47 vector endSize = <0.5, 0.5, 0.0>;
48 integer followVelocity = TRUE;
49 string texture = "p_lightflare";
50
51
52 ///////////////////////////////////////////////////////
53 // Timing & Creation Variables Variables
54 //
55 // Affects the number and density of particles
56 ///////////////////////////////////////////////////////
57 // ParticleLife sets the Lifetime of one particle (seconds)
58 // SystemLife sets the lifetime of the emitter (0.0 is infinite)
59 // EmissionRate is how many seconds between particle spawns
60 // PartPerEmission is how many particles spawn at a time
61 float particleLife = 1.0;
62 float SystemLife = 0.0;
63 float emissionRate = 0.25;
64 integer partPerEmission = 1;
65
66
67 ///////////////////////////////////////////////////////
68 // 3D Particle Space Variables
69 //
70 // Affect how the particles spawn into the world
71 ///////////////////////////////////////////////////////
72 // The radius is used to spawn angular particle patterns
73 // The angles are represented on 'both' sides of a prim
74 // The begin angle is the 'upper' starting point (radians)
75 // The end angle is the 'lower' stopping point (radians)
76 // Omega sets the speed of rotation about the <x,y,z> axis
77 float radius = 0.0;
78 float beginAngle = 0.0;
79 float endAngle = 0.0;
80 vector omega = <0.0, 0.0, 0.0>;
81
82
83 ///////////////////////////////////////////////////////
84 // Movement & Speed Variables
85 //
86 // Affects how particles travel in 3D space
87 ///////////////////////////////////////////////////////
88 // The speed values set the minimum and maximum speed
89 // particles have upon spawning.
90 // The acceleration is global to all particles (think gravity)
91 // WindEffect TRUE applies the current sim wind to particles
92 // BounceEffect TRUE means particles bounce on the 'floor'
93 // aka the z height of their emitter
94 // FollowSource TRUE means particles start on their emitter
95 // and move as it moves.
96 // FollowTarget means particles travel in linear path from
97 // emitter to their target object
98 // Target is declared here but used in the setParticles function
99 float minSpeed = 0.02;
100 float maxSpeed = 0.02;
101 vector acceleration = <0.0, 0.0, 0.0>;
102 integer windEffect = FALSE;
103 integer bounceEffect = FALSE;
104 integer followSource = TRUE;
105 integer followTarget = FALSE;
106 key target;
107
108
109 ///////////////////////////////////////////////////////
110 // Pattern Selection
111 //
112 // (Uncomment one of the following)
113 ///////////////////////////////////////////////////////
114 // DROP simply drops the particles at the emitters center
115 // EXPLODE has all particles moving outward from the center
116 // ANGLE has particles at radius distance and between angle
117 // values in a 2D plane shape
118 // ANGLE_CONE has particles at radius distance and between
119 // angle values in a 3D cone shape
120
121 //integer pattern = PSYS_SRC_PATTERN_DROP;
122 integer pattern = PSYS_SRC_PATTERN_EXPLODE;
123 //integer pattern = PSYS_SRC_PATTERN_ANGLE;
124 //integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE;
125
126
127
128 ///////////////////////////////////////////////////////
129 // Particle System Call Function
130 //
131 // Calling this function applies the particle
132 // parameters to the current prim the script is in.
133 ///////////////////////////////////////////////////////
134 setParticles()
135 {
136 // Here is where to set the current target to any valid key
137 // target=llGetKey(); //Targets the emitter
138 // target=llGetOwner(); //Targets the owner
139
140 // The following if statements are used to construct the mask
141 if(colorInterpolation) effectFlags = effectFlags|PSYS_PART_INTERP_COLOR_MASK;
142 if(sizeInterpolation) effectFlags = effectFlags|PSYS_PART_INTERP_SCALE_MASK;
143 if(windEffect) effectFlags = effectFlags|PSYS_PART_WIND_MASK;
144 if(bounceEffect) effectFlags = effectFlags|PSYS_PART_BOUNCE_MASK;
145 if(followSource) effectFlags = effectFlags|PSYS_PART_FOLLOW_SRC_MASK;
146 if(followVelocity) effectFlags = effectFlags|PSYS_PART_FOLLOW_VELOCITY_MASK;
147 if(target!="") effectFlags = effectFlags|PSYS_PART_TARGET_POS_MASK;
148 if(glowEffect) effectFlags = effectFlags|PSYS_PART_EMISSIVE_MASK;
150 PSYS_PART_FLAGS, effectFlags,
151 PSYS_SRC_PATTERN, pattern,
152 PSYS_PART_START_COLOR, startColor,
153 PSYS_PART_END_COLOR, endColor,
154 PSYS_PART_START_ALPHA, startAlpha,
155 PSYS_PART_END_ALPHA, endAlpha,
156 PSYS_PART_START_SCALE, startSize,
157 PSYS_PART_END_SCALE, endSize,
158 PSYS_PART_MAX_AGE, particleLife,
159 PSYS_SRC_ACCEL, acceleration,
160 PSYS_SRC_TEXTURE, texture,
161 PSYS_SRC_BURST_RATE, emissionRate,
162 PSYS_SRC_ANGLE_BEGIN, beginAngle,
163 PSYS_SRC_ANGLE_END, endAngle,
164 PSYS_SRC_BURST_PART_COUNT, partPerEmission,
167 PSYS_SRC_BURST_SPEED_MAX, maxSpeed,
168 PSYS_SRC_MAX_AGE, SystemLife,
169 PSYS_SRC_TARGET_KEY, target,
170 PSYS_SRC_OMEGA, omega ]);
171 }
172
173 vector colorChoose()
174 {
175 integer col=0;
176 col=(integer)llFrand(12);
177 if(col==0) return <1,0,0>;
178 if(col==1) return <0,1,0>;
179 if(col==2) return <0,0,1>;
180 if(col==3) return <1,1,0>;
181 if(col==4) return <1,0,1>;
182 if(col==5) return <0,1,1>;
183 if(col==6) return <1,0.5,0>;
184 if(col==7) return <1,0,0.5>;
185 if(col==8) return <0.5,1,0>;
186 if(col==9) return <0,1,0.5>;
187 if(col==10) return <0.5,0,1>;
188 if(col==11) return <0,0.5,1>;
189 return <1,1,1>;
190 }
191
192 default
193 {
195 {
196 startColor=colorChoose();
197 endColor=startColor;
198 setParticles();
199 llListen(0, "", "", "");
200 }
201
202 on_rez(integer param)
203 {
204 startColor=colorChoose();
205 endColor=startColor;
206 setParticles();
207 }
208
209 listen(integer chan, string name, key id, string msg)
210 {
211 if(id==llGetOwner())
212 {
213 if(msg=="die")
214 {
215 llDie();
216 }
217 }
218 }
219 }
220 // END //

Back to the Best Free Tools in Second Life and OpenSim.