Jump to content

need simple melee weapon script...


Walter Fanwood
 Share

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

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

Recommended Posts

As the title says, i just need a simple(r) weapon script which should work like this :3

 

-play one special animation

-shots/places a "dmg" dealing prim

 

all i got so far is something like this but it doenst "shoot"/"place" one of this dmg dealing prims. I know it gives such systems outthere and it would be nice if someone could send me maybe here a copy or add/fix this script a bit, would be nice. Thank you all in advance.

 

integer pointersound = 0;
integer pointeranim = 0;

list animations = [ ];

list sounds = [ ];

string anim;

default
{
    state_entry()
    {
        if(llGetAttached())
            llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS |
                PERMISSION_TRIGGER_ANIMATION);
        integer i;
        integer m = llGetInventoryNumber(INVENTORY_SOUND);
        for(i=0; i<m; i++)
        {
            sounds += [llGetInventoryName(INVENTORY_SOUND,i)];
        }
        m = llGetInventoryNumber(INVENTORY_ANIMATION);
        for(i=0; i<m; i++)
        {
            animations += [llGetInventoryName(INVENTORY_ANIMATION,i)];
        }
    }

    on_rez(integer sp)
    {
        llResetScript();
    }
    
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(CONTROL_LBUTTON,TRUE,TRUE);
        }
    }
    
    changed(integer change)
    {
        if(change & CHANGED_INVENTORY)
            llResetScript();
    }
    
    control(key id,integer level,integer edge)
    {
        if(edge & level & CONTROL_LBUTTON)
        {
            if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
            {
                anim = llList2String(animations,pointeranim);
                if(anim != "")
                {
                    llStartAnimation(anim);
                    llSetTimerEvent(2.0);
                }
                if(pointeranim < llGetListLength(animations))
                    pointeranim++;
                else
                    pointeranim=0;
            }
            string name = llList2String(sounds,pointersound);
            if(name != "")
                llTriggerSound(name,1.0);
            if(pointersound < llGetListLength(sounds))
                pointersound++;
            else
                pointersound=0;
        }
    }
    timer()
    {
        llSetTimerEvent(0.0);
        llStopAnimation(anim);
    }
}
Link to comment
Share on other sites

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