Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Random Object Rezzer

TXGorilla Falcone
KWKAT Planetfurry DJ
Join date: 4 May 2004
Posts: 176
02-13-2006 16:29
Hi all and appoligies in advance

I am currently workin on an airport and need a lil help
I am needing a script to rezz random objects at a set rate

Basicly it will be dropping luggage thats phys/temp rez down a chute every so often
_____________________
Drunken Monkeys danceing on the tables.
Falling from the sky just like in a fable.
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
02-13-2006 16:31
From: TXGorilla Falcone
Hi all and appoligies in advance

I am currently workin on an airport and need a lil help
I am needing a script to rezz random objects at a set rate

Basicly it will be dropping luggage thats phys/temp rez down a chute every so often


I have the almost exact script, but it has some issues, mainly to do with not being able to find an object to rez.
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
02-13-2006 16:33
Ok, it works on attach at the moment because it was an attachment, and its probably really messy coz I've been messing with it, but..

CODE
default
{



attach(key attached)
{
if (attached != NULL_KEY) // object has been //attached//
{
llWhisper(0, "Embarrassment Briefcase V1.1");
llWhisper(0, "Say /1 start to start dropping items");
llWhisper(0, "Say /1 stop to stop dropping items.");
llListen(1,"",llGetOwner(),"");
}
else // object has been detached
{
llWhisper(0, "Detaching.. Embarrassment Bag V1.1");
// etc.
}
}

state_entry()
{
llWhisper(0, "Embarrassment Briefcase V1.1");
llWhisper(0, "Say /1 start to start dropping items");
llWhisper(0, "Say /1 stop to stop dropping items.");
llListen(1,"",llGetOwner(),"");
}




touch_start(integer total_number)
{

}


listen( integer channel, string name, key id, string message )
{
if ( message == "start" )
{
llWhisper(0, "Started.");
llWhisper(0, "Say /1 stop to stop dropping items.");

state open;

}


}
}
state open
{
state_entry()
{

llSetTimerEvent(10);
llListen(1,"",llGetOwner(),"");


}

listen( integer channel, string name, key id, string message )
{
if ( message == "stop" )
{
llWhisper(0, "Stopped.");

state default;

}



}



timer()
{

llRezObject(llGetInventoryName(INVENTORY_OBJECT, (integer)llFrand(llGetInventoryNumber(INVENTORY_OBJECT)) - 1), llGetPos() + <-0.7,-0.2,-0.5>, ZERO_VECTOR, ZERO_ROTATION, 0);

}




}
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
02-13-2006 16:46
CODE

// This is how often it will rez an object, in seconds. You can change it.
float rate = 3.0;

// This is where the object will rez (relative to the rezzer).
vector rez_position = ZERO_VECTOR;

// This is the rotation the objects will rez at (also relative to the rezzer's rotation).
rotation rez_rotation = ZERO_ROTATION;

// This is how fast the objects will be moving when they are rezzed (velocity relative to the rezzor).
vector rez_velocity = ZERO_VECTOR;

// This is the start parameter that will be passed to the rezzed objects on_rez(integer sparam) event.
integer rez_sparam = 1;


integer on = FALSE;

default
{
touch_start(integer n)
{
if (llDetectedKey(0) == llGetOwner()) {
on = !on;
llSetTimerEvent(rate * (float)on);
if (on) {
llOwnerSay("Rezzing Objects.");
} else {
llOwnerSay("Stopped Rezzing Objects.");
}
}
}

timer()
{
float num_objects = (float)llGetInventoryNumber(INVENTORY_OBJECT);

if (num_objects == 0.0) {
on = FALSE;
llSetTimerEvent(0.0);
llOwnerSay("Oops, no objects in the contents!");
} else {
llRezObject(llGetInventoryName(INVENTORY_OBJECT, llFloor(llFrand(num_objects - 0.001))), llGetPos() + (rez_position * llGetRot()), llGetVel() + (rez_velocity * llGetRot()), llGetRot() * rez_rotation, rez_sparam);
}
}
}


Please note that the forums seem to ocassionally add a space for no reason. In the llRezObject Function there's "llFrand(num _objects - 0.001)" which should be llFrand(num_objects - 0.001)".
_____________________