Particles.lsl 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // :CATEGORY:Transmogrify
  2. // :NAME:TransmogrifyAvatar
  3. // :AUTHOR:Ferd Frederix
  4. // :CREATED:2013-09-08
  5. // :EDITED:2014-01-01 12:18:57
  6. // :ID:921
  7. // :NUM:1324
  8. // :REV:1
  9. // :WORLD:Second Life
  10. // :DESCRIPTION:
  11. // makes a flash of smoke when you transmogrify
  12. // :CODE:
  13. // Transmogrifyer script
  14. // License: CC-BY. Please do not remove the copyright or this notice
  15. // Author: Ferd Frederix
  16. // Particles is a poofer effect for changing. Put it in the head, body and feet section of the avatar and in the pet.
  17. // Easy to change the colors, or add a texture.
  18. // Sends a RED flash of 400 particles for 1 second.
  19. // If you add a texture to it, put the same texture on the side of a small box inside your pet so it will be cached and appear instantly.
  20. // MASK FLAGS: set to "TRUE" to enable
  21. integer glow = TRUE; // Makes the particles glow
  22. integer bounce = FALSE; // Make particles bounce on Z plane of objects
  23. integer interpColor = TRUE; // Color - from start value to end value
  24. integer interpSize = TRUE; // Size - from start value to end value
  25. integer wind = FALSE; // Particles effected by wind
  26. integer followSource = FALSE; // Particles follow the source
  27. integer followVel = TRUE; // Particles turn to velocity direction
  28. // Choose a pattern from the following:
  29. // PSYS_SRC_PATTERN_EXPLODE
  30. // PSYS_SRC_PATTERN_DROP
  31. // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
  32. // PSYS_SRC_PATTERN_ANGLE_CONE
  33. // PSYS_SRC_PATTERN_ANGLE
  34. // PSYS_SRC_PATTERN_EXPLODE;
  35. integer pattern = PSYS_SRC_PATTERN_EXPLODE;
  36. // Select a target for particles to go towards
  37. // "" for no target, "owner" will follow object owner
  38. // and "self" will target this object
  39. // or put the key of an object for particles to go to
  40. key target = ""; // if set to a UUID, such as llGetOwner(0), the particles go that-away
  41. // PARTICLE PARAMETERS
  42. float age = 0.1; // Life of each particle
  43. float maxSpeed = 10.0; // Max speed each particle is spit out at
  44. float minSpeed = 3; // Min speed each particle is spit out at
  45. string texture = ""; // Texture used for particles, default used if blank
  46. float startAlpha = 0.5; // Start alpha (transparency) value
  47. float endAlpha = 0.5; // End alpha (transparency) value
  48. vector startColor = <0,0,1>; // Start color of particles <R,G,B>
  49. vector endColor = <0,0,1>; // End color of particles <R,G,B> (if interpColor == TRUE)
  50. vector startSize = <1.0,2.0,1.0>; // Start size of particles
  51. vector endSize = <1,2,1.0>; // End size of particles (if interpSize == TRUE)
  52. vector push = <0.0,0.0,0.0>; // Force pushed on particles
  53. // SYSTEM PARAMETERS
  54. float rate = 0.1; // How fast (rate) to emit particles
  55. float life = 1.0; // Life in seconds for the system to make particles
  56. integer count = 40; // How many particles to emit per BURST
  57. // life (1) / age (.1) * count (4) = 400 particles, about 10% of what anyone can see
  58. float radius = 0.25; // Radius to emit particles for BURST pattern, helps cover up the avatar
  59. float outerAngle = TWO_PI; // Outer angle for all ANGLE patterns, TWO_PI is a full sphere
  60. float innerAngle = 0.5; // Inner angle for all ANGLE patterns
  61. vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source
  62. // SCRIPT VARIABLES
  63. integer flags;
  64. // nothing to see here. Go play somewhere else
  65. StartSteam()
  66. {
  67. flags = 0;
  68. if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
  69. if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
  70. if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
  71. if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
  72. if (wind) flags = flags | PSYS_PART_WIND_MASK;
  73. if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
  74. if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
  75. if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
  76. llParticleSystem([ PSYS_PART_MAX_AGE,age,
  77. PSYS_PART_FLAGS,flags,
  78. PSYS_PART_START_COLOR, startColor,
  79. PSYS_PART_END_COLOR, endColor,
  80. PSYS_PART_START_SCALE,startSize,
  81. PSYS_PART_END_SCALE,endSize,
  82. PSYS_SRC_PATTERN, pattern,
  83. PSYS_SRC_BURST_RATE,rate,
  84. PSYS_SRC_ACCEL, push,
  85. PSYS_SRC_BURST_PART_COUNT,count,
  86. PSYS_SRC_BURST_RADIUS,radius,
  87. PSYS_SRC_BURST_SPEED_MIN,minSpeed,
  88. PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
  89. PSYS_SRC_TARGET_KEY,target,
  90. PSYS_SRC_INNERANGLE,innerAngle,
  91. PSYS_SRC_OUTERANGLE,outerAngle,
  92. PSYS_SRC_OMEGA, omega,
  93. PSYS_SRC_MAX_AGE, life,
  94. PSYS_SRC_TEXTURE, texture,
  95. PSYS_PART_START_ALPHA, startAlpha,
  96. PSYS_PART_END_ALPHA, endAlpha
  97. ]);
  98. }
  99. default
  100. {
  101. state_entry()
  102. {
  103. StartSteam(); // show the flash when it resets
  104. }
  105. link_message(integer sender_number, integer number, string message, key id)
  106. {
  107. if (message == "switch")
  108. {
  109. StartSteam();
  110. }
  111. }
  112. }