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
OpenSim NPC OpenSim NPC Fish  

OpenSim NPC Fish

Swimming Fish script for NPC's

Category: OpenSim NPC
By : Ferd Frederix
Created: 2014-02-14 Edited: 2014-02-14
Worlds: Second Life

the Zip file

Download all files for OpenSim NPC Fish
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Script.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 <llsd>
2 <map>
3 <key>serial</key>
4 <integer>0</integer>
5 <key>height</key>
6 <real>2.2260611057281494</real>
7 <key>hashes</key>
8 <array>
9 <uuid>00000000-0000-0000-0000-000000000000</uuid>
10 <uuid>00000000-0000-0000-0000-000000000000</uuid>
11 <uuid>00000000-0000-0000-0000-000000000000</uuid>
12 <uuid>00000000-0000-0000-0000-000000000000</uuid>
13 <uuid>00000000-0000-0000-0000-000000000000</uuid>
14 <uuid>00000000-0000-0000-0000-000000000000</uuid>
15 <uuid>00000000-0000-0000-0000-000000000000</uuid>
16 <uuid>00000000-0000-0000-0000-000000000000</uuid>
17 <uuid>00000000-0000-0000-0000-000000000000</uuid>
18 <uuid>00000000-0000-0000-0000-000000000000</uuid>
19 <uuid>00000000-0000-0000-0000-000000000000</uuid>
20 <uuid>00000000-0000-0000-0000-000000000000</uuid>
21 <uuid>00000000-0000-0000-0000-000000000000</uuid>
22 <uuid>00000000-0000-0000-0000-000000000000</uuid>
23 <uuid>00000000-0000-0000-0000-000000000000</uuid>
24 <uuid>00000000-0000-0000-0000-000000000000</uuid>
25 <uuid>00000000-0000-0000-0000-000000000000</uuid>
26 <uuid>00000000-0000-0000-0000-000000000000</uuid>
27 <uuid>00000000-0000-0000-0000-000000000000</uuid>
28 <uuid>00000000-0000-0000-0000-000000000000</uuid>
29 <uuid>00000000-0000-0000-0000-000000000000</uuid>
30 </array>
31 <key>wearables</key>
32 <array>
33 <array>
34 <map>
35 <key>item</key>
36 <uuid>fa69b385-f96e-4910-b30c-60ce9f1d1b11</uuid>
37 <key>asset</key>
38 <uuid>205e1b00-9cf5-ff34-8007-04231e1ca3af</uuid>
39 </map>
40 </array>
41 <array>
42 <map>
43 <key>item</key>
44 <uuid>b909a99d-a9db-4410-b846-96fd49b84d41</uuid>
45 <key>asset</key>
46 <uuid>e793dcfb-42e7-cf96-3073-dd7734adc5a1</uuid>
47 </map>
48 </array>
49 <array>
50 <map>
51 <key>item</key>
52 <uuid>e5a4e6e4-b9b3-42d1-b6f1-94718901a8fd</uuid>
53 <key>asset</key>
54 <uuid>b7c68d74-4e2f-4570-baf2-e4eb96bb1e5c</uuid>
55 </map>
56 </array>
57 <array>
58 <map>
59 <key>item</key>
60 <uuid>f28ac7dd-dfff-498a-a080-cea625162861</uuid>
61 <key>asset</key>
62 <uuid>035b3910-4405-6850-db5a-c082f7a42ba4</uuid>
63 </map>
64 </array>
65 <array />
66 <array />
67 <array />
68 <array />
69 <array />
70 <array />
71 <array />
72 <array />
73 <array />
74 <array>
75 <map>
76 <key>item</key>
77 <uuid>1ae223ce-79c7-453e-9204-44b10b92bc7f</uuid>
78 <key>asset</key>
79 <uuid>72bfc02b-2d62-a581-6a82-3adac5ea0159</uuid>
80 </map>
81 </array>
82 <array />
83 </array>
84 <key>textures</key>
85 <array>
86 <uuid>46697265-7374-6f72-6d00-000000000000</uuid>
87 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
88 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
89 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
90 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
91 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
92 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
93 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
94 <uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
95 <uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
96 <uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
97 <uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
98 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
99 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
100 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
101 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
102 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
103 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
104 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
105 <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
106 <uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
107 </array>
108 <key>visualparams</key>
109 <binary encoding="base64">JREWnQByBVstGXCkIySYAH9bM38zf6p/P//jbXJm///LrRRoAACZAAB/AAAAf3J/Yz9/jH9/AAAAvwBWGQAAAAAAAAAAkdiFAC0AjnUAAGubUFV/f39YAGTY1szMzDMZWUzMABkeAJ65dX/qawB/h39/f447pUTY26FCAGb/uj8AAAAAf38AAAAAfwCfAACyf2ZVg1R/RIuZAACyGUx8ANbMxgAAugp14v/G////////////zAD//////////////wD//////wB/xP8ZZP////9UAAAAzkz///8=</binary>
110 <key>attachments</key>
111 <array>
112 <map>
113 <key>point</key>
114 <integer>5</integer>
115 <key>item</key>
116 <uuid>182bf0fd-8a47-4bd9-8651-aad35ad07eba</uuid>
117 <key>asset</key>
118 <uuid>2ab5446d-dabb-45be-8742-ded2bf9e15eb</uuid>
119 </map>
120 </array>
121 </map>
122 </llsd>

OpenSim NPC Fish

This is a fish NPC follower.
License: http://creativecommons.org/licenses/by-nc

Category: OpenSim NPC
By : Ferd Frederix
Created: 2014-02-14 Edited: 2014-02-14
Worlds: Second Life


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 // Redv 1.1 Added wait timer, adjustments for great white
3
4 integer debug = FALSE;
5
6 // tunables
7 float max_distance = 40; //distance for sensoring a real avatar, 96 is max
8 string fName = "Great";
9 string lName = "White";
10
11 float XY = 10;
12
13
14
15
16 float gTimer;
17 // stuff
18 integer nobody = FALSE;
19 integer iWaitCounter = 10;
20 integer channel; // dialog channel
21 integer listener; // holds the listener handle;
22 key npc; // npc key
23 integer npc_on = FALSE;
24 vector Dest;
25 string lastAnim;
26
27 Play(string anima)
28 {
29 if(anima == lastAnim)
30 return;
31
32
33 osNpcPlayAnimation(npc,anima);
34 osNpcStopAnimation(npc,lastAnim);
35 lastAnim = anima;
36 }
37
38
39
40
41 walk_to_master(vector myPos)
42 {
43 vector myVector = <randBetween(-XY,XY),randBetween(-XY,XY),-randBetween(1,3)> ;
44
45 iWaitCounter = 60;
46 Play("FishSlowSwim");
47
48
49 float water = llWater(<0,0,0>) - 0.5;
50 float z = myPos.z;
51 if(z > water) {
52 return;
53 }
54
55 osNpcMoveToTarget(npc, myPos + myVector, OS_NPC_FLY );
56 llSetTimerEvent(1.0);
57
58 Dest = myPos + myVector;
59
60 }
61
62 float randBetween(float min, float max)
63 {
64 return llFrand(max - min) + min ;
65 }
66 dialog(key avi)
67 {
68 channel = llCeil(llFrand(5000) + 5000);
69 listener = llListen(channel,"","","");
70 llDialog(avi, "Choose:",["Start","Remove","-"],channel);
71 }
72 Start()
73 {
74 vector npcPos = llGetPos() + <0,0.0,1.0>;
75 npc = osNpcCreate(fName,lName, npcPos, "Appearance", OS_NPC_NOT_OWNED);
76 llSetObjectDesc(npc);
77 npc_on = TRUE;
78 llSensorRepeat("", NULL_KEY, AGENT, max_distance, PI, 5);
79 }
80
81 default
82 {
83
85 {
86 llSetText(llGetObjectName(),<1,1,1>,1.0);
88 gTimer = llFrand(2) + 1;
90 }
91
92 changed (integer what)
93 {
94 if(what & CHANGED_REGION_START)
95 {
96 if(npc_on)
97 {
98 Start();
99 }
100 }
101 }
102
104 {
105 llSetText("",<1,1,1>,1.0);
107 }
108
110 {
111 if(llDetectedKey(0) == llGetOwner()) {
112 dialog(llDetectedKey(0));
113 }
114 }
115
116 listen(integer channel, string name, key id, string msg) {
117 llListenRemove(listener);
118 if(msg == "Start")
119 {
120 if( !npc_on ) {
121 Start();
122 } else {
123 llOwnerSay("Aready running");
124 }
125 } else if(msg == "Remove") {
126 npc_on = FALSE;
129 } else if(msg == "-") {
130 osAgentSaveAppearance(llGetOwner(), "Appearance");
131 llOwnerSay("Your appearance has been saved");
132 }
133
134 }
135
136 sensor(integer num)
137 {
138 llSetText("",<1,1,1>,1.0);
140
141 if(nobody)
142 {
143
144 Start();
145 nobody = FALSE;
146 return;
147 }
148
149 Dest = llDetectedPos( 0 );
150 if(debug) llOwnerSay((string) Dest);
151
152
153 walk_to_master(Dest);
154 }
155
156 no_sensor()
157 {
158 if(debug) llOwnerSay("nobody");
160
162 nobody = TRUE;
163 }
164
165 timer()
166 {
167 vector pos;
168 if(--iWaitCounter) {
169
170 list Poses = llGetObjectDetails(npc,[OBJECT_POS]);
171 pos = llList2Vector(Poses, 0);
172
173 if(llVecDist(pos, Dest ) > 4) {
174 if(debug) llOwnerSay("swimming");
175 return;
176 }
177 }
178
179 if(debug) llOwnerSay("arrived");
180
181 Play("FishStand");
182 gTimer = llFrand(2) + 1;
183 llSleep(gTimer);
185
186 }
187 }

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