Home |
Add a script
|
||
|---|---|---|---|
| Category: | Contributor: | Description | |
| Particles | Anonymous | RedWand.lsl | |
Red Wand
RedWand.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:Red Wand 3 // ARCHIVED BY:Ferd Frederix 4 5 ////////////////////////////////////////////////////////////////// 6 ////////////////////////////////////////////////////////////////// 7 //// eltee Statosky's Particle Creation Engine 1.0 8 //// 01/09/2004 9 //// *PUBLIC DOMAIN* 10 //// Free to use 11 //// Free to copy 12 //// Free to poke at 13 //// Free to hide in stuff you sell 14 //// Just please leave this header intact 15 ////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////// 17 18 integer effectFlags=0; 20 21 22 /////////////////////////////////////////////////////// 23 // Color Secelection Variables 24 /////////////////////////////////////////////////////// 25 // Interpolate between startColor and endColor 27 // Starting color for each particle 28 vector startColor = <1, .7, 0.>; 29 // Ending color for each particle 30 vector endColor = <1, .7, 0>; 31 // Starting Transparency for each particle (1.0 is solid) 32 float startAlpha = 1.0; 33 // Ending Transparency for each particle (0.0 is invisible) 34 float endAlpha = 0.0; 35 // Enables Absolute color (true) ambient lighting (false) 37 38 39 /////////////////////////////////////////////////////// 40 // Size & Shape Selection Variables 41 /////////////////////////////////////////////////////// 42 // Interpolate between startSize and endSize 44 // Starting size of each particle 45 vector startSize = <0.1, 0.1, 0.0>; 46 // Ending size of each particle 47 vector endSize = <0.1, 0.1, 0.0>; 48 // Turns particles to face their movement direction 50 // Texture the particles will use ("" for default) 51 string texture = ""; 52 53 54 /////////////////////////////////////////////////////// 55 // Timing & Creation Variables Variables 56 /////////////////////////////////////////////////////// 57 // Lifetime of one particle (seconds) 58 float particleLife = 3.0; 59 // Lifetime of the system 0.0 for no time out (seconds) 60 float SystemLife = 0.0; 61 // Number of seconds between particle emissions 62 float emissionRate = 0.001; 63 // Number of particles to releast on each emission 64 integer partPerEmission = 5; 65 66 67 /////////////////////////////////////////////////////// 68 // Angular Variables 69 /////////////////////////////////////////////////////// 70 // The radius used to spawn angular particle patterns 71 float radius = .5; 72 // Inside angle for angular particle patterns 73 float innerAngle = 1; 74 // Outside angle for angular particle patterns 75 float outerAngle = 90; 76 // Rotational potential of the inner/outer angle 77 vector omega = <1.0, 1.0, 0.0>; 78 79 80 /////////////////////////////////////////////////////// 81 // Movement & Speed Variables 82 /////////////////////////////////////////////////////// 83 // The minimum speed a particle will be moving on creation 84 float minSpeed = 0.0; 85 // The maximum speed a particle will be moving on creation 86 float maxSpeed = 0.1; 87 // Global acceleration applied to all particles 88 vector acceleration = <0.0, 0.0, 0.0>; 89 // If true, particles will be blown by the current wind 91 // if true, particles 'bounce' off of the object's Z height 93 // If true, particles spawn at the container object center 95 // If true, particles will move to expire at the target 97 // Desired target for the particles (any valid object/av key) 98 // target Needs to be set at runtime 99 key target = "";100 101 102 ///////////////////////////////////////////////////////103 //As yet unimplemented particle system flags104 ///////////////////////////////////////////////////////108 109 ///////////////////////////////////////////////////////110 // Pattern Selection111 ///////////////////////////////////////////////////////112 // Uncomment the pattern call you would like to use113 // Drop parcles at the container objects' center114 //integer pattern = PSYS_SRC_PATTERN_DROP;115 // Burst pattern originating at objects' center116 integer pattern = PSYS_SRC_PATTERN_EXPLODE;117 // Uses 2D angle between innerAngle and outerAngle118 //integer pattern = PSYS_SRC_PATTERN_ANGLE;119 // Uses 3D cone spread between innerAngle and outerAngle120 //integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE;121 // 122 //integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY;123 124 125 126 setParticles()127 {128 // Here is where to set the current target129 // llGetKey() targets this script's container object130 // llGetOwner() targets the owner of this script131 // Feel free to insert any other valid key132 target="";133 // The following block of if statements is used to construct the mask 134 if (colorInterpolation) effectFlags = effectFlags|PSYS_PART_INTERP_COLOR_MASK;135 if (sizeInterpolation) effectFlags = effectFlags|PSYS_PART_INTERP_SCALE_MASK;136 if (windEffect) effectFlags = effectFlags|PSYS_PART_WIND_MASK;137 if (bounceEffect) effectFlags = effectFlags|PSYS_PART_BOUNCE_MASK;138 if (followSource) effectFlags = effectFlags|PSYS_PART_FOLLOW_SRC_MASK;139 if (followVelocity) effectFlags = effectFlags|PSYS_PART_FOLLOW_VELOCITY_MASK;140 if (target!="") effectFlags = effectFlags|PSYS_PART_TARGET_POS_MASK;141 if (glowEffect) effectFlags = effectFlags|PSYS_PART_EMISSIVE_MASK;142 //Uncomment the following selections once they've been implemented143 // if (randomAcceleration) effectFlags = effectFlags|PSYS_PART_RANDOM_ACCEL_MASK;144 // if (randomVelocity) effectFlags = effectFlags|PSYS_PART_RANDOM_VEL_MASK;145 // if (particleTrails) effectFlags = effectFlags|PSYS_PART_TRAIL_MASK;146 llParticleSystem([147 PSYS_PART_FLAGS, effectFlags,148 PSYS_SRC_PATTERN, pattern,149 PSYS_PART_START_COLOR, startColor,150 PSYS_PART_END_COLOR, endColor,151 PSYS_PART_START_ALPHA, startAlpha,152 PSYS_PART_END_ALPHA, endAlpha,153 PSYS_PART_START_SCALE, startSize,154 PSYS_PART_END_SCALE, endSize, 155 PSYS_PART_MAX_AGE, particleLife,156 PSYS_SRC_ACCEL, acceleration,157 PSYS_SRC_TEXTURE, texture,158 PSYS_SRC_BURST_RATE, emissionRate,159 PSYS_SRC_INNERANGLE, innerAngle,160 PSYS_SRC_OUTERANGLE, outerAngle,161 PSYS_SRC_BURST_PART_COUNT, partPerEmission, 162 PSYS_SRC_BURST_RADIUS, radius,163 PSYS_SRC_BURST_SPEED_MIN, minSpeed,164 PSYS_SRC_BURST_SPEED_MAX, maxSpeed, 165 PSYS_SRC_MAX_AGE, SystemLife,166 PSYS_SRC_TARGET_KEY, target,167 PSYS_SRC_OMEGA, omega ]);168 }169 170 default171 {172 state_entry()173 {174 running=TRUE;175 llSetText("Running", <1.0, 1.0, 1.0>, 0.5);176 setParticles();177 }178 179 touch_start(integer num_detected)180 {181 if (running==TRUE)182 {183 running=FALSE;184 llSetText("Stopped", <1.0, 1.0, 1.0>, 0.5);185 llParticleSystem([]);186 }187 else188 {189 running=TRUE;190 llSetText("Running", <1.0, 1.0, 1.0>, 0.5);191 setParticles();192 }193 }194 }195 // END //