Jump to content
MIVIMEX

bubble gum script :: rezzed version ::

Recommended Posts

Posted (edited)

Hello! I have a bubble gum script and I need to change it. I need to link the gum to the rezzed object, remove the animation for the avatar from it and leave only the effect of inflating the bubble and the sound of a pop. In general, so that the chewing gum worked for the rezzed object and not attached for the avatar. please tell me what needs to be changed! Thanks for help!

init() {
    llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    llPreloadSound("ff0600f0-d8f4-20f6-52ec-a03bc520fee3");
    llSetPos(<0,0,0>);
    llSetScale(<0,0,0>);
}
 
default
{
    on_rez(integer num) {
        if(llGetAttached()) init();
    }
    state_entry() {
        if(llGetAttached()) init();
    }
    attach(key id)
    {
        init();
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llSetTimerEvent(5 + (integer)llFrand(14));
        }
    }
 
    timer() 
    {
        llSetTimerEvent(0.0);
        llStartAnimation("express_kiss");
        float itra;
        for(itra=0.004; itra<0.06; itra+=0.004) { 
            llSetScale(<itra,itra,itra>);
            llSetPos(llGetLocalPos()+<0.0007,0.0,0.0>);
 
        }
        llPlaySound("ff0600f0-d8f4-20f6-52ec-a03bc520fee3", 1.0);
        llStopAnimation("express_kiss");
        llSetScale(<0,0,0>);
        llSetPos(<0,0,0>);
        llSetTimerEvent(5 + (integer)llFrand(14));
    }
}
 

Edited by MIVIMEX

Share this post


Link to post
Share on other sites

In general, such a script turned out. but I did not quite understand how. but it works. if someone explains I will be grateful.


default
{
    state_entry()
    {
        llSetTimerEvent(5.0); // timer 

    }
 

 
    timer()
    {

         float itra;
        for(itra=0.004; itra<0.06; itra+=0.004) { 
            llSetScale(<itra,itra,itra>);
            llSetPos(llGetLocalPos()+<0.0007,0.0,0.0>);
 
        }
 
 
         
         llSetScale(<0,0,0>);
         llPlaySound("ff0600f0-d8f4-20f6-52ec-a03bc520fee3", 1.0);

 
    }

}

 

Share this post


Link to post
Share on other sites

Every 5th second the timer is called.

The for-loop scales the bubblegum, making it bigger. Position of the bubblegum is moved upwards.

When the for-loop has finished, the bubble gum is scaled to zero, a sound is emitted.

Process repeats it self every 5th seconds.

Bug/missing in example: Remember to store initial bubblegum position and restore it, else the bubblegum will move over the head with time!

Happy chewing 😄

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...