Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Random numbers across multiple objects

Christif Vaher
Registered User
Join date: 24 Jun 2008
Posts: 51
07-25-2008 16:40
Ok here is the thought process :

Start
Object pops up and stays up for 5 seconds
Then pops down
It stays down for a period of seconds decided by
CODE
llFrand

Then pops back up and the process repeats

This works fine when I have 1 object but when I copy that object say 5 times, all 5 objects pop back up at the same "random" time. How do I get a different random number in each object? Here is the code I currently have for my random number generation:

CODE

state_entry()
{
rand_res = (integer) llFrand (5.0)+1;
llSetTimerEvent(rand_res);
}
timer ()
{
state pop_up;
}
Urrong Urnst
Registered User
Join date: 12 Jul 2008
Posts: 49
07-25-2008 17:34
Can u paste in the whole script because i see u use more than one state.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
07-25-2008 18:04
the problem is when you copy the object the script is still running with the same time as defined in state entry, the variable is set

i bet if you reset all the scripts so they all called different random numbers it would work (or just call a new random number in the timer event)