Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

trying to use llFrand for adjusting tajectory

RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
03-01-2005 15:28
why does'nt this seem to be producing a random
direction they all seem to be going south west never north east or any other direction ?
probably a quadrangle thing but anyone got the simple fix for this?

CODE


vector pos;

default
{
state_entry()
{
// set the die point for the thing to go to before it dies so it doesnt ghost
pos =(llGetLocalPos() +<0,0,400> );
}
on_rez(integer start_param)
{
llSetPos(llGetLocalPos() -<0,0,0.1> );
llSleep(1);
float randm;
float rand;
randm = -0.3+llFrand(0.15);
llSleep(0.2);
rand = -0.3+llFrand(0.15);
llSleep(0.2);
llSetPos(llGetLocalPos() +<randm,rand,0.5> );
randm = -0.3+llFrand(0.15);
llSleep(0.2);
rand = -0.3+llFrand(0.15);
llSleep(0.2);
llSetPos(llGetLocalPos() +<randm,rand,0.5> );
randm = -0.3+llFrand(0.15);
llSleep(0.2);
rand = -0.3+llFrand(0.15);
llSleep(0.2);
llSetPos(llGetLocalPos() +<randm,rand,0.5> );
randm = -0.3+llFrand(0.15);
llSleep(0.2);
rand = -0.3+llFrand(0.15);
llSleep(0.2);
llSetPos(llGetLocalPos() +<randm,rand,0.5> );
randm = -0.3+llFrand(0.15);
llSleep(0.2);
rand = -0.3+llFrand(0.15);
llSleep(0.2);
llSetPos(llGetLocalPos() +<randm,rand,0.5> );
randm = -0.3+llFrand(0.15);
llSleep(0.2);
rand = -0.3+llFrand(0.15);
llSleep(0.2);
llSetPos(llGetLocalPos() +<randm,rand,0.5> );
llSleep(6);
llParticleSystem([]);
llSleep(1);
llSetAlpha(0,ALL_SIDES);
do{llSetPos(pos);}while(llGetPos() != pos);
llSleep(5);
llSleep(1);
llDie();
llSleep(3);
llDie();
}

}



also if anyone could show me a smoother way to do the same thing that'd be cool
basicallt rezzing things that go up 3 or 4 meters and rez another thing then vanish.
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
03-01-2005 15:37
I suspect your problem is this:

llFrand produces only positive values.

<+x,+y,+z> will only move in one direction. You need negatives too.

-Adam
_____________________
Co-Founder / Lead Developer
GigasSecondServer
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
03-01-2005 17:35
CODE
index =llRound(llFrand(5));
posnegindex =2.5-index;
divedbyten =posnegindex/5;
randm=divedbyten;
index =llRound(llFrand(5));
posnegindex =2.5-index;
divedbyten =posnegindex/5;
rand=divedbyten;
llSetPos(llGetLocalPos() +<randm,rand,0.5> );

ok thanks ya tinkerd a while longer and came up wity this seems to
do pos and neg numbers