Join us in Phaze Demesnes or follow us:

Home   Show All
Category: Contributor: Creator
Spells Wand_Script  

Wand_Script

Wand Script.lsl

Category: Spells
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life + OpenSim

the Zip file

Download all files for Wand_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Wand_Script_1.lsl
1
2 integer SWORD = 1;
3 integer PUNCH12 = 2;
4 integer PUNCHL = 3;
5 integer KICK = 4;
6 integer FLIP = 5;
7
8 integer strike_type;
9
10 default
11 {
13 {
15 }
17 {
18 if (perm)
19 {
21 }
22 }
23
25 {
26 if (on != NULL_KEY)
27 {
29
31 {
33 }
34 else
35 {
37 }
38
39 }
40 else
41 {
42 llSay(0, "releasing controls");
44 }
45 }
46
47 timer()
48 {
49 if ( (strike_type == FLIP)
50 || (strike_type == SWORD))
51 {
52 llSensor("", "", ACTIVE | AGENT, 4.0, PI_BY_TWO*0.5);
53 }
54 else
55 {
56 llSensor("", "", ACTIVE | AGENT, 3.0, PI_BY_TWO*0.5);
57 }
58 llSetTimerEvent(0.0);
59 }
60
61 control(key owner, integer level, integer edge)
62 {
63 if (level & (CONTROL_ML_LBUTTON | CONTROL_LBUTTON))
64 {
65 if (edge & CONTROL_UP)
66 {
67 llApplyImpulse(<0,0,3.5>,FALSE);
68 llStartAnimation("backflip");
69 llSetTimerEvent(0.25);
70 strike_type = FLIP;
71 }
72 if (edge & CONTROL_FWD)
73 {
74 llStartAnimation("sword_strike_R");
75 llSleep(0.5);
76 llSetTimerEvent(0.25);
77 strike_type = SWORD;
78 }
79 if (edge & (CONTROL_LEFT | CONTROL_ROT_LEFT))
80 {
81 llStartAnimation("punch_L");
82 llSetTimerEvent(0.25);
83 strike_type = PUNCHL;
84 }
85 if (edge & (CONTROL_RIGHT | CONTROL_ROT_RIGHT))
86 {
87 llStartAnimation("kick_roundhouse_R");
88 llSetTimerEvent(0.25);
89 strike_type = KICK;
90 }
91 if (edge & CONTROL_BACK)
92 {
93 llStartAnimation("punch_onetwo");
94 llSetTimerEvent(0.25);
95 strike_type = PUNCH12;
96 }
97 if (edge & CONTROL_DOWN)
98 {
99 llMoveToTarget(llGetPos(), 0.25);
100 llSleep(1.0);
102 }
103 }
104 }
105
107 {
109 dir.z = 0.0;
110 dir = llVecNorm(dir);
111 rotation rot = llGetRot();
112 if (strike_type == SWORD)
113 {
114 llTriggerSound("crunch", 0.5);
115 dir += llRot2Up(rot);
116 dir *= 200.0;
118 }
119 else if (strike_type == PUNCH12)
120 {
121 llTriggerSound("crunch", 0.2);
122 dir += dir;
123 dir *= 100.0;
125 }
126 else if (strike_type == PUNCHL)
127 {
128 llTriggerSound("crunch", 0.2);
129 dir -= llRot2Left(rot);
130 dir *= 100.0;
132 }
133 else if (strike_type == KICK)
134 {
135 llTriggerSound("crunch", 0.2);
136 dir += dir;
137 dir *= 100.0;
139 }
140 else if (strike_type == FLIP)
141 {
142 llTriggerSound("crunch", 0.2);
144 }
145 strike_type= 0;
146 }
147 }
148 // END //