Jump to content

Rez on touch script


Naiman Broome
 Share

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

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

Recommended Posts

Hello , I am looking for a script that allows me to rez poseballs in front of avatar when touch a weared object, can someone help me find one?

I found this script in another thread

 

default
{
    touch_start(integer rand) // the interger doesn't matter at all, you can call it whatever you want, it's not used here
    {
        float number = (float) llFrand(llGetInventoryNumber(INVENTORY_OBJECT)); // determine the amount of the content and make a random float
        string name = llGetInventoryName(INVENTORY_OBJECT,(integer) number); //getting the name. the float number becomes integer for that
        llRezObject(name, llGetPos() + < 0, 0, 1 >, ZERO_VECTOR,ZERO_ROTATION, 0); //rezz the object, I just let it rezz 1m above the object
    }
}

 

It works for rezzing the objects, but I would like it to work when I am wearing the item , can it be done?

Edited by Naiman Broome
Link to comment
Share on other sites

I tried it, too, and it did work.

So, obvious questions first: are you on land where you're allowed to rez things, and does the land allow scripts to run?

Is there something invisible getting in the way? Try right-clicking it and selecting "touch" from the menu.

Put an extra line inside the touch_start event: llOwnerSay ("Touched"); (between the "{" and the "float"). Does that respond when you click?

Oh, and is the script set to "running"?

 

Link to comment
Share on other sites

Ah, is the object rigged mesh clothing? As far as I know you can't instatouch worn rigged objects, and have to go through the menu.

I think you're going to have to use a transparent unrigged prim or mesh, shaped to match (roughly) the rigged clothing, and linked to it. The unrigged prim should react to instatouches. You'll wear the link set on an attachment point where you can get the linked unrigged prim into a position that matches the rigged item.

An item can detach itself automatically using the function llDetachFromAvatar. For that to work the script needs to get permission using the function llRequestPermissions with the parameter PERMISSION_ATTACH beforehand.

default
{
    state_entry ()
    {
        llRequestPermissions (llGetOwner (), PERMISSION_ATTACH); //dialog if not worn, automatic if worn
    }

    touch_end (integer count)
    {
        //Rezzing stuff here
        llDetachFromAvatar ();
    }
}

(I've used the touch_end event here because touch_start was being a bit unreliable.)

When you link the rigged item with the unrigged prim you should make the rigged item the root, and the script should go in the root. (At least, that's what worked for me when I tried it out just now.)

  • Thanks 1
Link to comment
Share on other sites

I did this :


default
{
    state_entry ()
    {
        llRequestPermissions (llGetOwner (), PERMISSION_ATTACH); //dialog if not worn, automatic if worn
    }

    touch_end (integer count)
    {
        //Rezzing stuff here
       {
   
        float number = (float) llFrand(llGetInventoryNumber(INVENTORY_OBJECT)); // determine the amount of the content and make a random float
        string name = llGetInventoryName(INVENTORY_OBJECT,(integer) number); //getting the name. the float number becomes integer for that
        llRezObject(name, llGetPos() + < 2, 0, -1 >, ZERO_VECTOR,ZERO_ROTATION, 0); //rezz the object, I just let it rezz 1m above the object
    }

        llDetachFromAvatar ();
    }
}

but it gives me syntax error.

Edited by Naiman Broome
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1163 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...