Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Particle Particle to Viictim  

Particle to Viictim

Makes particles nto a weapon. Shoots them at avatars you choose from a menu

Category: Particle
By : Ferd Frederix
Created: 2014-04-04 Edited: 2014-04-04
Worlds: Second Life

the Zip file

Download all files for Particle to Viictim
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Script.lsl
Get file # 2. Particle_Garden__Grows_slowly_rando_1.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2
3 string texture;
4
5 updateParticles(key target)
6 {
7 // MASK FLAGS: set to "TRUE" to enable
8 integer glow = FALSE; // Makes the particles glow
9 integer bounce = FALSE; // Make particles bounce on Z plane of objects
10 integer interpColor = TRUE; // Color - from start value to end value
11 integer interpSize = TRUE; // Size - from start value to end value
12 integer wind = FALSE; // Particles effected by wind
13 integer followSource = TRUE; // Particles follow the source
14 integer followVel = TRUE; // Particles turn to velocity direction
15
16 // Choose a pattern from the following:
17 // PSYS_SRC_PATTERN_EXPLODE
18 // PSYS_SRC_PATTERN_DROP
19 // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
20 // PSYS_SRC_PATTERN_ANGLE_CONE
21 // PSYS_SRC_PATTERN_ANGLE
22 integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY;
23 // PSYS_SRC_PATTERN_EXPLODE;
24
25
26 // PARTICLE PARAMETERS
27
28 float age = 5; // Life of each particle
29 float maxSpeed = 1.0; // Max speed each particle is spit out at
30 float minSpeed = 1.0; // Min speed each particle is spit out at
31
32 float startAlpha = 1.0; // Start alpha (transparency) value
33 float endAlpha = 1.0; // End alpha (transparency) value
34 vector startColor = <1.0,1.0,1.0>; // Start color of particles <R,G,B>
35 vector endColor = <1.0,1.0,1.0>; // End color of particles <R,G,B> (if interpColor == TRUE)
36 vector startSize = <1.0,1.0,1.0>; // Start size of particles
37 vector endSize = <1.0,1.0,1.0>; // End size of particles (if interpSize == TRUE)
38 vector push = <1.0,0.0,0.0>; // Force pushed on particles
39
40 // SYSTEM PARAMETERS
41
42 float rate = .1; // How fast (rate) to emit particles
43 float radius = 0.75; // Radius to emit particles for BURST pattern
44 integer count = 10; // How many particles to emit per BURST
45 float outerAngle = TWO_PI; // Outer angle for all ANGLE patterns PI/4
46 float innerAngle = 0.5; // Inner angle for all ANGLE patterns
47 vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source
48 float life = 5; // Life in seconds for the system to make particles
49
50 // SCRIPT VARIABLES
51
52 integer flags;
53
54 if(glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
55 if(bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
56 if(interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
57 if(interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
58 if(wind) flags = flags | PSYS_PART_WIND_MASK;
59 if(followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
60 if(followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
61 if(target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
62
64 PSYS_PART_FLAGS,flags,
65 PSYS_PART_START_COLOR, startColor,
66 PSYS_PART_END_COLOR, endColor,
67 PSYS_PART_START_SCALE,startSize,
68 PSYS_PART_END_SCALE,endSize,
69 PSYS_SRC_PATTERN, pattern,
71 PSYS_SRC_ACCEL, push,
77 PSYS_SRC_INNERANGLE,innerAngle,
78 PSYS_SRC_OUTERANGLE,outerAngle,
79 PSYS_SRC_OMEGA, omega,
80 PSYS_SRC_MAX_AGE, life,
81 PSYS_SRC_TEXTURE, texture,
82 PSYS_PART_START_ALPHA, startAlpha,
83 PSYS_PART_END_ALPHA, endAlpha
84 ]);
85
86
87
88
89 }
90
91 // Multi-Page Dialog Menu System
92 // Omei Qunhua December 2013
93
94 integer gActionsPerPage = 9; // Number of action choice buttons per menu page (must be 1 to 10, or 12)
95 list gListActions ;
96 list gListKeys;
97 // ========================================================================================================
98
99 integer gTotalActions;
100 integer gPage; // Current dialog page number (counting from zero)
101 integer gMaxPage; // Highest page number (counting from zero)
102 integer gChan; // Channel used for dialog communications.
103 key gUser; // Current user accessing the dialogs
104
105 BuildDialogPage(key user)
106 {
107 // Build a dialog menu for current page for given user
108 integer start = gActionsPerPage * gPage; // starting offset into action list for current page
109 // set up scrolling buttons as needed
110 list buttons = [ "<<", " ", ">>" ];
111 if(gActionsPerPage == 10) buttons = [ "<<", ">>" ];
112 else if(gActionsPerPage > 10) buttons = []; // No room for paging buttons
113
114 // 'start + gActionsPerPage -1' might point beyond the end of the list -
115 // - but LSL stops at the list end, without throwing a wobbly
116 buttons += llList2List(gListActions, start, start + gActionsPerPage - 1);
117 llDialog(user, "\nPage " + (string) (gPage+1) + " of " + (string) (gMaxPage + 1) + "\n\nChoose an action", buttons, gChan);
118 llSetTimerEvent(60); // If no response in time, return to 'ready' state
119 }
120
121 default
122 {
124 {
126
127 gTotalActions = llGetListLength(gListActions);
128
129 // Validate 'ActionsPerPage' value
130 if(gActionsPerPage < 1 || gActionsPerPage > 12)
131 {
132 llOwnerSay("Invalid 'gActionsPerPage' - must be 1 to 12");
133 return;
134 }
135
136 // Compute number of menu pages that will be available
137 gMaxPage = (gTotalActions - 1) / gActionsPerPage;
138 if(gActionsPerPage > 10)
139 {
140 gMaxPage = 0;
141 if(gTotalActions > gActionsPerPage)
142 {
143 llOwnerSay("Too many actions in total for this setting");
144 return;
145 }
146 }
147
148 // Compute a negative communications channel based on prim UUID
149 gChan = 0x80000000 | (integer) ( "0x" + (string) llGetKey() );
150 state ready;
151 }
152 }
153 state ready
154 {
155 touch_start(integer total_number)
156 {
157 gUser = llDetectedKey(0);
158 llSensor("","",AGENT,25.0,TWO_PI); // seek out a person
159 }
160
162 {
163 integer i;
164 gListKeys = [];
165 gListActions = [];
166
167 for ( i = 0; i < n; i++)
168 {
169 gListActions += llDetectedName(i);
170 gListKeys += llDetectedKey(i);
171 }
172 state busy;
173 // Changing state sets the application to a busy condition while one user is selecting from the dialogs
174 // In the event of multiple 'simultaneous' touches, only one user will get a dialog
175 }
176
177 no_sensor()
178 {
179 llOwnerSay("No one is near you, range is set at max of 25 meters");
180 }
181 }
182
183 state busy
184 {
186 {
187 llListen(gChan, "", gUser, ""); // This listener will be used throughout this state
188 gPage = 0;
189 BuildDialogPage(gUser); // Show Page 0 dialog to current user
190 }
191 listen (integer chan, string name, key id, string msg)
192 {
193 if(msg == "<<" || msg == ">>") // Page change ...
194 {
195 if(msg == "<<") --gPage; // Page back
196 if(msg == ">>") ++gPage; // Page forward
197 if(gPage < 0) gPage = gMaxPage; // cycle around pages
198 if(gPage > gMaxPage) gPage = 0;
199 BuildDialogPage(id);
200 return;
201 }
202 if(msg != " ") // no action on blank menu button
203 {
204 // User has selected a person from the menu
205 integer idx = llListFindList(gListActions,[msg]) ;
206 if( idx > -1)
207 {
208 key aviKey = llList2Key(gListKeys,idx); // get the corresponding key
209 updateParticles(aviKey);
210 llOwnerSay("Sending particles to " + msg + " key: " + (string) aviKey);
211 }
212 }
213 state ready; // changing state will release ANY and ALL open listeners
214 }
215 timer()
216 {
217 llOwnerSay("Too slow, menu cancelled");
218 state ready;
219 }
221 {
222 llSetTimerEvent(0); // would be dangerous to leave a dormant timer
223 }
224 }

Back to the Best Free Tools in Second Life and OpenSim.