Jump to content

Hold a bouquet animation


AlexandriteGem
 Share

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

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

Recommended Posts

Please help me again, I am totally dumb with scripts.

I want to have an avi hold a bridal bouquet of flowers when i is attached. So I put these two in the object:
Animate on attach
 

string HOLD_ANIM = "animation name";

// --------------------------------------------------------

default
{
    on_rez(integer rezzed)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }
    
    attach(key attached)
    {
        if(attached != llGetOwner())
            if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
                llStopAnimation(HOLD_ANIM);
    }
    
    run_time_permissions(integer perms)
    {
        if(perms & PERMISSION_TRIGGER_ANIMATION)
            llStartAnimation(HOLD_ANIM);
        else
            llDetachFromAvatar();
    }
}

And holdbouquet animation which I bought in the market, and

Animate when attached 

 

string gAnimation;
string gCurrentAnimationState;
key gOwner;

default
{
    state_entry()
    {
        if(llGetInventoryName(INVENTORY_ANIMATION, 0) != "")
        {
            gOwner = llGetOwner();
            gCurrentAnimationState = llGetAnimation(gOwner);
            gAnimation = llGetInventoryName(INVENTORY_ANIMATION, 0);
            llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
        }

    }
    changed(integer change)
    {
        if(change & CHANGED_OWNER)
        {
            llResetScript();
        }
       
    }
    attach(key id)
    {
        if(id != NULL_KEY)
        {
            llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
        }
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation(gAnimation);
            llSetTimerEvent(0.5);
        }
        if(perm & PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(1, 0, 1);//This takes no controls.
                                    //It only exists to operate the script in no script zones.
        }
    }
    timer()
    {
        if(llGetAttached() != 0)
        {
            if(llGetAnimation(gOwner) != gCurrentAnimationState)
            {
                gCurrentAnimationState = llGetAnimation(gOwner);
                llStopAnimation(gAnimation);
                llSleep(0.1);
                llStartAnimation(gAnimation);
            }
        }
    }
}
 


The three are in the content tab in the object. The window asking for permission comes out but I get a message saying it could not find the animation. Could you please help me determine where it should be? Thank you!!

Link to comment
Share on other sites

10 hours ago, Rolig Loon said:

I'm not sure why you think you need two animation scripts.  Get rid of the second one and put the name of your animation in the first one, in place of "animation name". It's kind of a clunky script, but it should be enough to do what you want.

One reason to use two scripts would be to run two animations simultaniously... like running the "express_smile" morph on top.. but for holding a bouquet one script is enough... the second one looks better for folks without scripting knowledge... it fetches anim name from inventory itself...

Link to comment
Share on other sites

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