Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rez an Object into hand ?

Jarkheld Desmoulins
Registered User
Join date: 13 Sep 2005
Posts: 3
09-18-2005 12:26
I am trying to get one object to rez another object that would already be attached to a hand.


For the main object I tried this:
integer add = FALSE; // Allows only owner inventory rights


default
{
state_entry()
{
//Allows for items to be dropped into inventory
llAllowInventoryDrop(add);

}

touch_start(integer total_number)
{
llRezObject("Wolf's Fang",llGetPos() + <1, 0, 0>, ZERO_VECTOR, ZERO_ROTATION, 42);
}
}


While for the object to be rezzed i tried this:

default
{
state_entry()
{

}

on_rez(integer start_param)
{
llAttachToAvatar(ATTACH_RHAND); // Should make Wolf's Fang rez into avatar's hand
}
}



It doesn't seem to work, the object that is rezzed jsut rezzes several feet away from me not attached at all.

Is there a way to get this to work ?
Ushuaia Tokugawa
Nobody of Consequence
Join date: 22 Mar 2005
Posts: 268
09-18-2005 13:31
The llAttachToAvatar function requires you to grant permissions for that object to attach to you.

CODE

// how long after rez do i die if owner doesn't grant permission
float timeOut = 20.0;

default {
on_rez(integer start) {
llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);

llSetTimerEvent(timeOut); // set a timeout
}

run_time_permissions(integer perm) {
// if we got permission attach, if not die
if (perm & PERMISSION_ATTACH) {
llAttachToAvatar(ATTACH_RHAND);

llSetTimerEvent(0.0); // unset the timeout
} else {
llDie(); // didn't want to attach so die
}
}

timer() {
// timeout reached so die
llDie();
}
}
_____________________
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
09-18-2005 13:48
This wont work over no-build of course.

Another possibility I've seen used (such as a drawable sword) is to have the item attached already but use llSetLinkAlpha to turn the item on or off. (and make the holstered item disappear)

l8r,
UU
_____________________