How you could do it is like this. Your fishing rod is set to alpha and linked in position to the stool, with an alpha poseball containing the fishing animation.
When the avatar sits on the visible stool, he would be in a fishing pose, while the scripts make the rod appear in his hand. When he jumps up the rod dissapears again!
Put this in each prim of the fishing rod
Code:
default
{
state_entry()
{
}
on_rez(integer start_param)
{
llResetScript();
}
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "showfishingrod")
{
llSetAlpha(1,ALL_SIDES);
}
if (str == "hidefishingrod")
{
llSetAlpha(0,ALL_SIDES);
}
}
}
And put this in a poseball containing animation and link together with fishing rod and stool
Code:
//Anxiousness Chair v.1
//By: Kaneda Akenbono
//Enjoy, and I'd appreciate it if you left this on the script. :)
//
//Add the animations you want to your object.
//I pulled the stuff below into globals so you can easily modify this script without understanding any of the code. :)
vector Angle = <0,0,0>; //Enter a vector rotation for the sit...
vector SitLoc = <0,0,0.1>; //This is the sitTarget positioning... CANNOT EQUAL 0
//string LoadText = "Anxiousnes Chair v.1 - Comment this out or change if you want..."; // The text you want to show when the object loads...
string Context = "Sit"; //The text you want in the context menu...
//Globals!! WOOO!!
key user;
key sitAgent = NULL_KEY;
list animations;
integer animNum;
integer nextAnim = 1;
integer curAnim = 0;
integer counter = 0;
//This part dynamically gathers all of the animations you've placed in the object for usage later...
initialize()
{
integer x;
list oldAnim;
animNum = llGetInventoryNumber(INVENTORY_ANIMATION);
for (x = 0; x < animNum; x++)
{
animations = oldAnim + [x];
oldAnim = animations;
}
llMessageLinked(LINK_SET, 0, "showfishingrod", NULL_KEY);
llMessageLinked(LINK_SET, 0, "hidefishingrod", NULL_KEY);
}
default
{
state_entry()
{
initialize();
//For easy rotation in the llSitTarger enter the vector rotation below..
vector eul = Angle; //45 degrees around the z-axis, in Euler form..
eul *= DEG_TO_RAD; //convert to radians...
rotation quat = llEuler2Rot( eul ); //convert to quaternion...
// llSay(0, LoadText);
//Text it says under the context menu...
llSetSitText(Context);
//Adjust the positioning of the user while siting... also need for llAvatarOnSit... if this value is equal to 0, it doesn't work, so set it to make it look right for your object
llSitTarget(SitLoc, quat);
llMessageLinked(LINK_SET, 0, "showfishingrod", NULL_KEY);
llMessageLinked(LINK_SET, 0, "hidefishingrod", NULL_KEY);
}
changed(integer change)
{
//If the user sits on the object...
if (change & CHANGED_LINK)
{
user = llAvatarOnSitTarget();
if (llAvatarOnSitTarget() != NULL_KEY )
{
llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION);
llMessageLinked(LINK_SET, 0, "showfishingrod", NULL_KEY);
llMessageLinked(LINK_SET, 0, "hidefishingrod", NULL_KEY);
}
else
{
// llSay(0, "getting up");
llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, 0));
llMessageLinked(LINK_SET, 0, "showfishingrod", NULL_KEY);
llMessageLinked(LINK_SET, 0, "hidefishingrod", NULL_KEY);
}
}
}
run_time_permissions(integer perm)
{
if (perm)
{
//This starts the first animation...
llStopAnimation("sit");
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, 0));
curAnim = 0;
}
}
}