Recently I made a shotgun, mainly for looks. I've tweaked a couple scripts to get it to fit the gun. It's a pump action shotgun, fires buckshot which bursts into a cloud of smoke on impact and ejects a shell.
I have this gun all figured out, except one thing...how do I change the default Hold/Aim animations? I have two animations bought and ready to be used for the gun. An aiming and standing animation. I've replaced the names of a few different animations in the script, but I always end up with my avatar stuck in my aiming animation, so I switched back to the default until I've found out how to correctly replace said animations. Here is the script:
//
// Semi Auto Script
//
float SPEED = 75.0;
integer LIFETIME = 10;
float DELAY = 0.2;
vector vel;
vector pos;
rotation rot;
integer have_permissions = FALSE;
integer armed = TRUE;
string instruction_not_held =
"Choose 'Acquire->attach->left hand' from my menu to wear and use me.";
fire()
{
if (armed)
{
armed = FALSE;
rot = llGetRot();
vel = llRot2Fwd(rot);
pos = llGetPos();
pos = pos + vel;
pos.z += 0.75;
vel = vel * SPEED;
llTriggerSound("Report", 1.0);
llRezObject("Bullet", pos, vel, rot, LIFETIME);
rot.z = rot.z *-PI ;
llRezObject("Shotgun Shell",pos+<-0.0,-0.0,-0.0>,-llRot2Left(rot),rot,0);
llSetTimerEvent(DELAY);
}
}
default
{
state_entry()
{
if (!have_permissions)
{
llRequestPermissions(llGetOwner(),
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS);
}
}
on_rez(integer param)
{
llPreloadSound("Report"
; }
run_time_permissions(integer permissions)
{
if (permissions == PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS)
{
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
llStartAnimation("hold_R_rifle"
;have_permissions = TRUE;
}
}
attach(key attachedAgent)
{
if (attachedAgent != NULL_KEY)
{
llRequestPermissions(llGetOwner(),
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS);
}
else
{
if (have_permissions)
{
llStopAnimation("hold_R_rifle"
;llStopAnimation("aim_R_rifle"
;llReleaseControls();
llSetRot(<0,0,0,1>
;have_permissions = FALSE;
}
}
}
control(key name, integer levels, integer edges)
{
if ( ((edges & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON)
&&
(levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) ){
fire();
}
}
touch_end(integer num)
{
if (have_permissions)
{
; }
else
{
llWhisper(0, instruction_not_held);
}
}
timer()
{
llSetTimerEvent(0.0);
armed = TRUE;
}
}
Any help is GREATLY appreciated! I've searched everwhere but I've found nothing.
Thanks!
Nerolus Mosienko
(ps. I've made a version of the gun to be holstered on my back, if anyone could point me to a holster/unholster script, that would be VERY cool)
