The second problem is the llRezObject command. What I want is to rez an object in mid-air that immediately falls directly down to the ground. What I have now is an object that rezzes and bounces up and away.
All help is appreciated. Here's the script:
key agent = NULL_KEY;
integer i; //A simple counter.
default
{
state_entry()
{
llSetSitText("Chop!"
;//Set the Pie Menu text.//Set the sitting position and rotation.
vector sittingPosition = <0.0,0.85,-0.25>;
vector sittingRotation = <90, 180, 90>;
llSitTarget(ZERO_VECTOR,ZERO_ROTATION); //Clear the sit target.
llSitTarget(sittingPosition,llEuler2Rot(sittingRotation * DEG_TO_RAD));// Needed for llAvatarOnSitTarget to work
llSetCameraEyeOffset(<4, 4, 3>
; //Position the camera.llSetCameraAtOffset(<2, 0, 1>
;}
changed(integer change)
{
if(change & CHANGED_LINK) //Is someone sitting?
{
key current_agent = llAvatarOnSitTarget();
if(current_agent != NULL_KEY) //Yes, someone is sitting.
{
llRequestPermissions(current_agent, PERMISSION_TRIGGER_ANIMATION); //This does NOT spawn a dialog, as it's used in conjunction with run_time_permissions! You still need to include it, however.
}
else //No one is sitting.
{
llSetStatus(STATUS_PHANTOM, TRUE);
llPushObject(current_agent, (<10, 0, 7> * llGetRot()), ZERO_VECTOR, FALSE);
llSetStatus(STATUS_PHANTOM, FALSE);
llStopAnimation("HeadChop"
;agent = NULL_KEY;
//reset the script to release permissions
llResetScript();
}
}
}
run_time_permissions(integer perm)
{
agent = llAvatarOnSitTarget();
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit"
; //Stop the default sit animation - it looks stupid here.llStartAnimation("LayDown"
;llSleep(1); //Pause for effect.
llPlaySound("door_open", 1);
llMessageLinked(LINK_SET,0,"t1",NULL_KEY); //Send a message to other scripts in other linked child prims.
llStopAnimation("LayDown"
;llStartAnimation("HeadChop"
;rotation rot = llGetRot();
vector aim = llRot2Fwd(rot);
llRezObject("Smiley", llGetPos() + <0, 1.5, 0>, <4.0,4.0,4.0> *llGetRot(), llGetRot(), 1);
llPlaySound("diescream", 1);
llMessageLinked(LINK_SET,0,"reset",NULL_KEY);
}
}
on_rez(integer start_param)
{
llResetScript();
}
}
