aniamtion - How do I get it to work on sit?
|
|
Sky Goodnight
Registered User
Join date: 28 Apr 2006
Posts: 16
|
09-13-2006 22:46
ok...I have made my first 'sitting' animation and have put it into a prim. Do I need a script to animate my avatar when I select 'sit' on this prim, if so where can a get a script that will do this? Thanks in advance...
_____________________
Sky Goodnight www.slexlife.com
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
09-14-2006 00:15
From: Sky Goodnight ok...I have made my first 'sitting' animation and have put it into a prim. Do I need a script to animate my avatar when I select 'sit' on this prim, if so where can a get a script that will do this? Thanks in advance... You basically need to swap the default sit animation with your new one. Lots of free versions of them around in SL but this is a script I picked up from somewhere a while ago. No idea who wrote it! //put one and only one animation in this poseball, then reset the script
key avatar = NULL_KEY; // ID of person sitting on us vector pos = <-0.25,0,0.2>; //adjust the position to fit object -must be //nonzero in at least one direction or script will not work! rotation rot = <0,0,0,1>; //adjust rotation (1 in any vector gives 90 deg)
string strText = "Site Here"; // Text to display string animation;
Show(integer show) { if(show == 1) { llSetText(strText,<1,1,1>,1); llSetAlpha(1,ALL_SIDES); } else { llSetAlpha(0,ALL_SIDES); llSetText("",<1,1,1>,1); } }
default { on_rez(integer num) { llResetScript(); }
state_entry() { Show(1); llListen(0,"",NULL_KEY,""); llSetSitText(strText); animation = llGetInventoryName(INVENTORY_ANIMATION,0); llSetObjectDesc(animation); llSitTarget(pos, rot); } changed(integer change) { avatar = llAvatarOnSitTarget(); if(change & CHANGED_LINK) { if(avatar == NULL_KEY) { // You have gotten off llStopAnimation(animation); llReleaseControls(); Show(1); } else if(avatar == llAvatarOnSitTarget()) { // You have gotten on llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION ); } } } listen(integer channel, string name, key id, string msg) { if(llToLower(msg) == "show") Show(1); if(llToLower(msg) == "hide") Show(0); } run_time_permissions(integer perms) { if(perms) { Show(0); llStopAnimation("sit"); llStartAnimation(animation); } else { llUnSit(avatar); Show(1); llResetScript(); } } }
Its not the greatest script in the world but should do what you need.
|
|
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
|
09-14-2006 00:16
Hi, yes - you need what is called a "poseball" script for that. If you did your animation right and do not mind fiddling a bit you not need an additional prim for this, although, in some instances, it is easier to use an additional prim, have the avatar sit on it, then move the prim into position and link the whole set once the avatar has gotten up again. Attached is a simple poseball script that will *need* an additional prim (use a small ball) - unless you want your chair to become invisible when being sat upon. If you want to use it without the extra ball, just uncomment the lines with llSetAlpha(). The adjustment is done in the top part of the script where you can set the position of the avatar and the pose rotation. Please note that the default ball/sphere (should you use one) *is* rotated by 90°. Make sure you make all rotations 0 before you use it - much less work this way. // ================================================= // HtF's Poseball (simple, non speaking // (c) 2006 by HtF // free to use, suports only one animation // =================================================
// // global variables //
key avatar = NULL_KEY; vector pos = <0,0,0.20>; //adjust the (x,y,z) position to fit object
string sittext = "Sit"; // Adjust this to your needs but keep it short!
string animation; // The first animation in object will be used
default { state_entry() { animation = llGetInventoryName(INVENTORY_ANIMATION,0); llSitTarget(pos, ZERO_ROTATION); llSetSitText(sittext); } changed(integer change) { avatar = llAvatarOnSitTarget(); if(change & CHANGED_LINK) { if(avatar == NULL_KEY) { // // Avatar has stood up // llStopAnimation(animation); llSetAlpha(1.0,ALL_SIDES); } else if(avatar == llAvatarOnSitTarget()) { // // Avatar just sat // llSetAlpha(0.0,ALL_SIDES); llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION ); } } if (change & CHANGED_INVENTORY) { // // reset scrit if inventory changes // llResetScript(); } } on_rez(integer num){ llResetScript(); } run_time_permissions(integer perms) { if(perms) { llStopAnimation("sit"); llStartAnimation(animation); } else { llUnSit(avatar); llResetScript(); } } }
|
|
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
|
09-14-2006 00:18
From: Newgate Ludd Its not the greatest script in the world but should do what you need. Open channel listener .... shudder .... major lag producer. 
|
|
Sky Goodnight
Registered User
Join date: 28 Apr 2006
Posts: 16
|
Thanks to HtF & Newgate
09-14-2006 00:38
Scripts work great... cheers!
_____________________
Sky Goodnight www.slexlife.com
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
09-14-2006 00:54
From: HtF Visconti Open channel listener .... shudder .... major lag producer.  I know, like I said not the greatest script in the world, but does allow you to hide them when you are not using them.
|
|
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
|
09-14-2006 03:35
That is, of course, right and also adds to the ambiente of a place - so many places are messed up with tons of those poseballs. I still prefer, however, if the owner of a mod-able poseballscript takes the precaution and uses a channel different to "0". It is only a small change in the script but reduces overall sim load. Also the listener filter could be updated to listen only to the owner speaking 
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
09-14-2006 05:18
From: HtF Visconti That is, of course, right and also adds to the ambiente of a place - so many places are messed up with tons of those poseballs. I still prefer, however, if the owner of a mod-able poseballscript takes the precaution and uses a channel different to "0". It is only a small change in the script but reduces overall sim load. Also the listener filter could be updated to listen only to the owner speaking I agree, this was just dragged as a quick example. I didnt bother checking the actual content other than it was a poseball script. My apologies. i disagree with the owner only listen idea, quite often you want others to be able to find it but thats a personal choice. Noticed about 4 or 5 other reoccurances of this subject / thread in the last few days, may be LL should include tutorial for building poseballs with an example script in the standard library?
|