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
Weapons turret  

turret

turret.lsl

Category: Weapons
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for turret
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. turret_1.lsl
1
2 key toucher;
3 string toucherS;
4 float SPEED = 40.0;
5 integer LIFETIME = 7;
6 float DELAY = 0.2;
7 vector vel;
8 vector pos;
9 rotation rot;
10 integer in_use;
11 integer have_permissions = FALSE;
12 integer armed = TRUE;
13 fire()
14 {
15
16 rot = llGetRot();
17 vel = llRot2Fwd(rot);
18 pos = llGetPos();
19 pos = pos + vel;
20 pos.z += 0.0;
21 vel = vel * SPEED;
22 llTriggerSound("shoot", 1.0);
23 llRezObject("bullet", pos, vel, rot, 1);
24 }
25 default
26 {
28 {
29 in_use = FALSE;
30 }
31 touch_start(integer total_number)
32 {
33 if(in_use == FALSE)
34 {
35 toucher = llDetectedKey(0);
37 llSetText("Requesting Permissions", <1,1,1>, 1);
38 }
39 if(in_use == TRUE)
40 {
41 if(llDetectedKey(0) == toucher)
42 {
45 llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>);
46 llSetText("", <1,1,1>, 1);
47 in_use = FALSE;
48 }
49 }
50 }
51 sensor(integer sense)
52 {
54 llRotLookAt(k, .1, .1);
55 }
56 no_sensor()
57 {
60 llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>);
61 llSetText("", <1,1,1>, 1);
62 in_use = FALSE;
63 }
65 {
66 if(perm)
67 {
68 llSetText("", <1,1,1>, 1);
70 llSensorRepeat("", toucher, AGENT, 20, TWO_PI, .1);
71 llSetText("Current User: "+llKey2Name(toucher), <1,1,1>, 1);
72 in_use = TRUE;
73 }
74 else
75 {
76 in_use = FALSE;
77 llSetText("", <1,3,1>, 1);
78 }
79 }
80 control(key name, integer levels, integer edges)
81 {
83 {
84 fire();
85 }
86 }
87
88 }
89
90 // END //

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