Join us in Phaze Demesnes

LSL Script Library Home   Add a script Show All
Category: Contributor: Description
Particles Anonymous tropfen.lsl
Tropical
tropfen.lsl

Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.

1 // CATEGORY:Particles
2 // DESCRIPTION:Tropical
3 // ARCHIVED BY:Ferd Frederix
4
5 //This is an updated version of a normal particle script- James Hanner
6 // Mask Flags - set to TRUE to enable
7 integer glow = TRUE; // Make the particles glow
8 integer bounce = FALSE; // Make particles bounce on Z plane of object
9 integer interpColor = TRUE; // Go from start to end color
10 integer interpSize = TRUE; // Go from start to end size
11 integer wind = FALSE; // Particles effected by wind
12 integer followSource = TRUE; // Particles follow the source
13 integer followVel = FALSE; // Particles turn to velocity direction
14
15 //Set these as the channel and message to use to turn on and off the system
16 integer ch = 42;
17 string messageon = "";
18 string messageoff = "";
19
20 // Choose a pattern from the following:
21 // PSYS_SRC_PATTERN_EXPLODE
22 // PSYS_SRC_PATTERN_DROP
23 // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
24 // PSYS_SRC_PATTERN_ANGLE_CONE
25 // PSYS_SRC_PATTERN_ANGLE
26 integer pattern = PSYS_SRC_PATTERN_DROP;
27
28 // Select a target for particles to go towards
29 // "" for no target, "owner" will follow object owner
30 // and "self" will target this object
31 // and "detected" to use the nearest person
32 // or put the key of an object for particles to go to
33 key target = "";
34
35 // Particle paramaters
36 float age = 4; // Life of each particle
37 float maxSpeed = 15; // Max speed each particle is spit out at
38 float minSpeed = 1.5; // Min speed each particle is spit out at
39 string texture = "28adc6ed-a359-1512-68a9-6a2b4b77c7b7"; // Texture used for particles, default used if blank
40 float startAlpha = .7; // Start alpha (transparency) value
41 float endAlpha = .4; // End alpha (transparency) value
42 vector startColor = <.8,.8,.9>; // Start color of particles <R,G,B>
43 vector endColor = <1,.6,.2>; // End color of particles <R,G,B> (if interpColor == TRUE)
44 vector startSize = <.13,.13,.13>; // Start size of particles
45 vector endSize = <0.11,0.11,0.11>; // End size of particles (if interpSize == TRUE)
46 vector push = <0, 0, -3>; // Force pushed on particles
47
48 // System paramaters
49 float rate = 1; // How fast (rate) to emit particles
50 float radius = 0.2; // Radius to emit particles for BURST pattern
51 integer count = 1; // How many particles to emit per BURST
52 float outerAngle = 0; // Outer angle for all ANGLE patterns float outerAngle = 1.54
53 float innerAngle = 0; // Inner angle for all ANGLE patterns float innerAngle = 1.55
54 vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source
55 float life = 0; // Life in seconds for the system to make particles
56
57 // Script variables
58 integer pre = 2; //Adjust the precision of the generated list.
59
60 integer flags;
61 list sys;
62 integer type;
63 vector tempVector;
64 rotation tempRot;
65 string tempString;
66 integer i;
67
68 string float2String(float in)
69 {
70 return llGetSubString((string)in,0,pre - 7);
71 }
72
73 updateParticles()
74 {
75 flags = 0;
76 if(target == "detected") target = llDetectedKey(0);
77 if (target == "owner") target = llGetOwner();
78 if (target == "self") target = llGetKey();
79 if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
80 if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
81 if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
82 if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
83 if (wind) flags = flags | PSYS_PART_WIND_MASK;
84 if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
85 if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
86 if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
87 sys = [ PSYS_PART_MAX_AGE,age,
88 PSYS_PART_FLAGS,flags,
89 PSYS_PART_START_COLOR, startColor,
90 PSYS_PART_END_COLOR, endColor,
91 PSYS_PART_START_SCALE,startSize,
92 PSYS_PART_END_SCALE,endSize,
93 PSYS_SRC_PATTERN, pattern,
95 PSYS_SRC_ACCEL, push,
101 PSYS_SRC_ANGLE_BEGIN,innerAngle,
102 PSYS_SRC_ANGLE_END,outerAngle,
103 PSYS_SRC_OMEGA, omega,
104 PSYS_SRC_MAX_AGE, life,
105 PSYS_SRC_TEXTURE, texture,
106 PSYS_PART_START_ALPHA, startAlpha,
107 PSYS_PART_END_ALPHA, endAlpha
108 ];
109
111 }
112
113 default
114 {
117 {
118 updateParticles(); //Start making particles
119 llListen(ch, "", NULL_KEY, messageoff);
120 }
121
122 listen(integer channel, string name, key id, string message)
123 {
124 state off; //Switch to the off state
125 }
126 }
127
128 state off
129 {
131 {
132 llParticleSystem([]); //Stop making particles
133 llListen(ch, "", NULL_KEY, messageon);
134 }
135
136 listen(integer channel, string name, key id, string message)
137 {
138 state default;
139 }
140 }// END //