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 dart_throw  

dart_throw

add a "sink" script into the arrow for it to stick

Category: Weapons
By : Martin
Created: 2010-06-23 Edited: 2010-06-23
Worlds: Second Life

the Zip file

Download all files for dart_throw
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. dart_throw_1.lsl
1 //
2 // This basic script acts as a gun, by doing the following:
3 //
4 // Attach gun to right hand so that aiming animation is correct.
5 //
6 // prim's coordinate system.
7 string object = "object"; // Name of object in inventory
8 vector relativePosOffset = <2.0, 0.0, 1.0>; // "Forward" and a little "above" this prim
9 vector relativeVel = <30.0, 0.0, 0.0>; // Traveling in this prim's "forward" direction at 1m/s
10 rotation relativeRot = <-0.07107, -0.707107, 0.0, 0.707107>; // Rotated 90 degrees on the x-axis compared to this prim
11 integer startParam = 10;
12
13 default
14 {
16 {
17 if(perm)
18 {
21 llStartAnimation("hold_R_bazooka");
22 }
23 }
24
26 {
27
29 key on = llDetectedKey(0);
30 key avatar = llDetectedKey(0);
31 key owner = llGetOwner();
32 if(owner == avatar)
33 {
34 llWhisper(0, "Attach me to your right hand, and enter mouselook to fire!");
36 // {
38 // }
39 // else
40 // {
43 // llStartAnimation("hold_R_handgun");
44 // }
45 }
46 else
47 {
48 llWhisper(0, "Buy a copy and rez from your inventory and attach to your right hand to use.");
49 }
50 }
51
52 attach(key on)
53 {
54 if(on != NULL_KEY)
55 {
57
59 {
61 }
62 else
63 {
65 llStartAnimation("hold_R_bazooka");
66 }
67
68 }
69 else
70 {
72 llStopAnimation("hold_R_bazooka");
73 }
74 }
75
76 control(key owner, integer level, integer edge)
77 {
79 {
80 // Mouse down
82 {
83 // First Press - start sound loop and point
84 //llSay(0, "Start");
85 ;
86 vector myPos = llGetPos();
87 rotation myRot = llGetRot();
88
89 vector rezPos = myPos+relativePosOffset*myRot;
90 vector rezVel = relativeVel*myRot;
91 rotation rezRot = relativeRot*myRot;
92
93 llRezObject(object, rezPos, rezVel, rezRot, startParam);
94 llStartAnimation("avatar_throw_R");
95
96
97 }
98 else
99 {
101 {
102 // Stopped
103 //llSay(0, "Stop");
104
106 }
107 }
108
109 }
110 }}

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