Jump to content

Rez a random object


scriptina
 Share

You are about to reply to a thread that has been inactive for 3337 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I want to mod the following rezer script in that way, that it rezes random objects instead of the same one all the time. Will that be possible somehow? Do I need to change only this script or the script in one of the 5 target objects I want to be rezed too? 

default
{
    touch_start(integer total_number)
    {
        vector Pos = llDetectedPos(0);
        if (llVecDist(Pos,llGetPos()) < 10.0)
        {
             rotation Rot = llDetectedRot(0);
             vector NewPos = Pos + <-0.5,0,0>*Rot;
                     llRezAtRoot("object",NewPos,ZERO_VECTOR, Rot,1);
             llInstantMessage(llDetectedKey(0),"Please sit down.");
        }
        else
        {
             llInstantMessage(llDetectedKey(0),"Sorry you are too far away.");
        }
    }
}
Link to comment
Share on other sites

An alternative way to choose random objects -- not a better way, just an alternative -- is to build a list of inventory objects in state_entry() and then, at run time, say something like 

string whichObject = llList2String(llListRandomize(ObjectList,1),0);

 That is, tell LSL to randomise the order of the elements in your list each time you want to rez something, and then pick the first one of the new, randomised, list.

Link to comment
Share on other sites

That worked fine! I am so happy:) I get all my objects in random order now. Now I just need to know where in the script I can change the postition of the rezed object because it always rezes sideways and a little bit to high. I want it to be rezed on ground and with 90° rotation compared to now. Do I need to set this position in rezzer script or in the object itself or in both?

You'd make my day and weekend even if I could work this out ;)

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3337 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...