• Announcements

    • Xiola Linden

      The New Community Platform   03/21/2017

      We are still working on making adjustments and changes to the new platform. Thanks  to everyone who has been sending in feedback and filing any bugs you've encountered! 
Sign in to follow this  
Followers 0
LuckyCreations1488303085

Fish wander script?

4 posts in this topic

I have searched and searched but have had no luck finding this kind of script. I was wondering if someone could point me in the direction of a preferably free script that will allow a flexible prim with a fish texture applied to it randomly wander around a fish tank?

Share this post


Link to post
Share on other sites

I have a great collection of animal scripts that ive created. Find me in-world for specifics or check out the bulk package here on the marketplace:  https://marketplace.secondlife.com/p/First-Class-Developer-Pack-Advanced-Creature-Code/1917547

 

For a free version, try:

 

 

integer random=5;//swim timer//global vectors  -  wanders within these pointslist points = [<84,61,50>,<83,62,50>,<82,63,50>,<81,64,50>];swim(){ vector swimpoint=llList2Vector(points,(integer)llFrand(llGetListLength(points))); llLookAt(swimpoint,0.6,4.7); llSleep(1.2); llMoveToTarget(swimpoint,8.0); llSetTimerEvent(llFrand(random));}default{state_entry(){llSetStatus(STATUS_PHYSICS,TRUE);swim();}timer(){swim();}}

 



 

 

Share this post


Link to post
Share on other sites

 


Dev Khaos wrote:

I have a great collection of animal scripts that ive created. Find me in-world for specifics or check out the bulk package here on the marketplace: 

 

For a free version, try:

 

 
integer random=5;//swim timer//global vectors  -  wanders within these pointslist points = [<84,61,50>,<83,62,50>,<82,63,50>,<81,64,50>];swim(){ vector swimpoint=llList2Vector(points,(integer)llFrand(llGetListLength(points))); llLookAt(swimpoint,0.6,4.7); llSleep(1.2); llMoveToTarget(swimpoint,8.0); llSetTimerEvent(llFrand(random));}default{state_entry(){llSetStatus(STATUS_PHYSICS,TRUE);swim();}timer(){swim();}}

 



 

 

 

Would setting a range for random coordinates also work for the waypoints? Using the coordinates you have listed, x= a random number between 80 and 85, y= a random numer between 60 and 65, z= a random number between 5 and 19 (that's to keep teh fish underwater :) )

Then, as the fish reaches a generated waypoint, a new set of coordinates are generated. I'm not a scritper, but it should go something like;

get the rezzed position;

start loop

x = random number

y = random number

z = random number

waypoint = (x,y,z)

travel to waypoint

go back to start loop

 

Share this post


Link to post
Share on other sites



That would look something like this:

*additionally, you could add a little something to randomize positive AND negative distances 

 

integer random=5;//swim timerinteger totalpoints =5;//number of random save points
integer distance = 5;
list points =[];swim(){ vector swimpoint=llList2Vector(points,(integer)llFrand(llGetListLength(points))); llLookAt(swimpoint,0.6,4.7); llSleep(1.2); llMoveToTarget(swimpoint,8.0); llSetTimerEvent(llFrand(random));}

getpoints(){integer i;
for(i=0;i<totalpoints;i++){
vector pos=llGetPos();
points+=<pos.x+llFrand(distance),pos.y+llFrand(distance),pos.z+llFrand(distance)>;
}
}default{on_rez(integer p){llResetScript();}
state_entry(){getpoints();llSetStatus(STATUS_PHYSICS,TRUE);swim();}timer(){swim();}}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0