Home |
Add a script
|
||
|---|---|---|---|
| Category: | Contributor: | Description | |
| Particles | eltee Statosky | blood!.lsl | |
Plays sound and sprays blood when collided
blood!.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:Plays sound and sprays blood when collided 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 string texturer = "e08ab401-2945-29f7-0797-a6c67a405b5b"; 18 integer effectFlags=0; 20 key owner; 21 22 /////////////////////////////////////////////////////// 23 // Color Secelection Variables 24 /////////////////////////////////////////////////////// 25 // Interpolate between startColor and endColor 27 // Starting color for each particle 28 vector startColor = <1,1,1>; 29 // Ending color for each particle 30 vector endColor = <1, 1, 1>; 31 // Starting Transparency for each particle (1.0 is solid) 32 float startAlpha = 0.8; 33 // Ending Transparency for each particle (0.0 is invisible) 34 float endAlpha = 0.3; 35 // Enables glow around particles 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.5, 0.5, 0.5>; 46 // Ending size of each particle 47 vector endSize = <0.5, 0.5, 0.5>; 48 // Turns particles to face their movement direction 50 // Texture the particles will use ("" for default) 51 string texture = texturer; 52 53 54 /////////////////////////////////////////////////////// 55 // Timing & Creation Variables Variables 56 /////////////////////////////////////////////////////// 57 // Lifetime of one particle (seconds) 58 float particleLife = 2.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.20; 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 = 0.0; 72 // Inside angle for angular particle patterns 73 float innerAngle = 0; 74 // Outside angle for angular particle patterns 75 float outerAngle = 0; 76 // Rotational potential of the inner/outer angle 77 vector omega = <2.0, 2.0, 0.2>; 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.5>; 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_EXPLODE ;121 // 122 //integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY123 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 {173 {174 owner = llGetOwner(); 175 }176 state_entry()177 {178 llSetBuoyancy(0.0);179 llCollisionSound("",0.0);180 llCollisionSprite("");181 llParticleSystem([]);183 }184 collision_start(integer detected)185 {186 integer type = llDetectedType(0);187 key person = llDetectedKey(0);188 if(type & AGENT)189 {190 if(person != owner)191 {192 llSetForce(<0,0,0>, TRUE);193 running=TRUE;194 setParticles();195 llTriggerSound("hit", 0.7); 196 llSetBuoyancy(-0.1);197 llSleep(1.0);198 running=FALSE;199 llParticleSystem([]);200 llSetStatus(STATUS_PHANTOM, TRUE);201 llDie();202 }203 } 204 else205 {llDie();} 206 }208 {209 llParticleSystem([]);210 llSetStatus(STATUS_PHANTOM, TRUE);211 llDie();212 213 }214 215 216 217 }218 // END //