Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float gfParticleTimer = 10; // Seconds.
- integer gbParticleFlag;
- ParticlesOn()
- {
- integer i;
- string sTexName;
- vector vTexSize;
- vector vColor;
- vColor.x = llFrand(1);
- vColor.y = llFrand(1);
- vColor.z = llFrand(1);
- i = llFloor(llFrand(5));
- if (i == 0)
- {
- sTexName = "Ribbon2";
- vTexSize = <0.10, 0.35, 0>;
- }
- else if (i == 1)
- {
- sTexName = "Diamond4";
- vTexSize = <0.20, 0.20, 0>;
- }
- else if (i == 2)
- {
- sTexName = "Dot6";
- vTexSize = <0.08, 0.08, 0>;
- }
- else if (i == 3)
- {
- sTexName = "Star7";
- vTexSize = <0.13, 0.13, 0>;
- }
- else
- {
- vTexSize = <0.15, 0.15, 0>;
- i = llFloor(llFrand(3));
- if (i == 0) sTexName = "Twirl5a";
- else if (i == 1) sTexName = "Twirl5b";
- else sTexName = "Twirl5c";
- }
- //
- llParticleSystem
- ([
- PSYS_SRC_TEXTURE, llGetInventoryKey(sTexName)
- , PSYS_PART_FLAGS, 0 // Specify any combination of the following:
- // | PSYS_PART_BOUNCE_MASK // Particles bounce.
- | PSYS_PART_EMISSIVE_MASK // Full-bright and unaffected by sunlight.
- // | PSYS_PART_FOLLOW_SRC_MASK // Move with emitter. Nothing to do with spin.
- | PSYS_PART_FOLLOW_VELOCITY_MASK // Rotate "top" towards direction of movement or emission.
- // | PSYS_PART_INTERP_COLOR_MASK // Color and alpha transition from START to END.
- // | PSYS_PART_INTERP_SCALE_MASK // Size/scale transitions from START to END.
- // | PSYS_PART_RIBBON_MASK // Joined together into one continuous triangle strip.
- // | PSYS_PART_TARGET_LINEAR_MASK // Move in straight line towards PSYS_SRC_TARGET_KEY.
- // | PSYS_PART_TARGET_POS_MASK // Change direction.
- // | PSYS_PART_WIND_MASK // Wind affects movement.
- //
- , PSYS_SRC_PATTERN, // Only ONE is specified (velocity directions):
- // PSYS_SRC_PATTERN_EXPLODE // Sphere.
- PSYS_SRC_PATTERN_ANGLE_CONE // Sphere, sub-sphere, cone or ring.
- // PSYS_SRC_PATTERN_ANGLE // Flat circle, semi-circle, arc or ray. Flattens PSYS_SRC_PATTERN_ANGLE_CONE.
- // PSYS_SRC_PATTERN_DROP // No initial velocity.
- , PSYS_SRC_BURST_RADIUS, 0.0 // Distance from emitter where particles are created. Max 50.
- , PSYS_PART_MAX_AGE, 5.0 // Particle lifetime, in seconds. Max 30.
- // , PSYS_SRC_TARGET_KEY, llGetKey() // A target's key toward which the particle goes (POS_MASK or LINEAR_MASK).
- , PSYS_SRC_ANGLE_END, (DEG_TO_RAD * -90) // Ending arc angle (radians between 0 and PI).
- , PSYS_SRC_ANGLE_BEGIN, (DEG_TO_RAD * 45) // Above is more important. Half angle of a circular or spherical "dimple".
- , PSYS_SRC_ACCEL, <0.0, 0.0, -0.4> // Magnet on particles to make arcs. -z makes gravity.
- , PSYS_SRC_OMEGA, <0.0, 0.0, 0.0> // Rotation between bursts of the emitter in radians per second along each axis.
- , PSYS_SRC_BURST_RATE, 0.02 // Interval between particle emission bursts. 0=fast as possible. 0.05
- , PSYS_SRC_BURST_PART_COUNT, 5 // Particles emitted in each burst.
- , PSYS_SRC_BURST_SPEED_MIN, 0.6 // Minimum speed upon emission (meters per second). (random between min and max per burst)
- , PSYS_SRC_BURST_SPEED_MAX, 2.0 // See PSYS_SRC_BURST_SPEED_MIN.
- , PSYS_SRC_MAX_AGE, 4.0 // Time that the emitter will operate upon coming into view. 0=infinite.
- , PSYS_PART_START_COLOR, vColor // Color of particles upon emission.
- , PSYS_PART_END_COLOR, vColor // PSYS_PART_INTERP_COLOR_MASK must be set (see FLAGS).
- , PSYS_PART_START_ALPHA, 1.0 // 0 to 1 level of translucency (alpha). 1=opaque.
- , PSYS_PART_END_ALPHA, 1.0 // PSYS_PSYS_PART_INTERP_COLOR_MASK must be set (see FLAGS).
- , PSYS_PART_START_SCALE, vTexSize // Scale (size) of particles upon emission.
- , PSYS_PART_END_SCALE, vTexSize // PSYS_PART_INTERP_SCALE_MASK must be set (see FLAGS). <0.10, 0.35, 0.0>
- , PSYS_PART_START_GLOW, 0.1 // 0 to 1 level of "glow". 1=full glow.
- , PSYS_PART_END_GLOW, 0.1 // PSYS_PART_INTERP_SCALE_MASK must be set (see FLAGS).
- ]);
- }
- ParticlesOff()
- {
- llParticleSystem([]);
- }
- default
- {
- touch_start(integer total_number)
- {
- ParticlesOn();
- gbParticleFlag = TRUE;
- llResetTime();
- llSetTimerEvent(0.25);
- }
- timer()
- {
- // Turn particles off if necessary, and put timer back.
- if (gbParticleFlag)
- {
- if (llGetTime() > gfParticleTimer)
- {
- ParticlesOff();
- gbParticleFlag = FALSE;
- llSetTimerEvent(0);
- }
- else ParticlesOn();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement