Angelique Rich
Registered User
Join date: 14 Apr 2006
Posts: 21
|
05-27-2006 01:36
Hi all
I made a hugging animation for a couple. One animaton for the woman, one for the man and placed them each in one poseball.
Problem: The animation starts, as soon as the avatar sits on the poseball. As two persons never sit on a ball at the same time, the animation of the two persons is out of sync now.
I look for a way to wait with the animation, until both balls are occupied and then start them both at the same time.
Any idea (I'll post that question also at the scripting forum)
Thanks, your Angel
|
Yukio Nolan
Registered User
Join date: 25 Mar 2006
Posts: 8
|
06-02-2006 17:11
I think there are some scripts in the scripting forum which can do this. Maybe mine works, too, I'm just not sure, if I digged out the correct one  // Simple script to start animations in multiple linked poseballs at the same time -- encoded in human unreadable code by Yukio Nolan -- use any way you feel appropriate ;-)
// CHANGE ACCORDING TO YOUR NEEDS: string TITLE="Yukio's poseball script"; //floating text string ANIMATION="sit"; //name of animation that should be played string PREANIMATION="sit"; // 1-frame animation played while waiting for animation to start - "sit" may do vector OFFSET=<0.0,-0.5,0.1>; //Adjust pose offset <X,Y,Z> X,Y,Z=float (e.g. -1.0 or 3.65) -- NEVER SET ALL TO ZERO, then the ball doesn't work! integer LISTENCHANNEL = 1; //channel to listen to for hide/show
list LINK_IDS = [2]; //IDs of the other links that need having avatars sit on for the animation to start - you get the IDs from each ball when you set TELL_LINK_NAMES to true... just place the link IDs of all other links in this script and this ID in all other ball's scripts integer TELL_LINK_NAMES=TRUE; //set to TRUE if you want the poseballs to tell which link number they are, FALSE otherwise
// NO changes needed after this line
vector offset; list links_seated; // all links with an avatar on
show() { llSetAlpha(1.0, ALL_SIDES); llSetText(TITLE, <1.0,1.0,1.0>, 1.0); }
hide() { llSetAlpha(0.0, ALL_SIDES); llSetText("", <1.0,1.0,1.0>, 0.0); }
seated(){ key avatar = llAvatarOnSitTarget(); if(avatar != NULL_KEY) { llMessageLinked(-2, llGetLinkNumber(), "seated", ""); hide(); llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION); llStopAnimation("sit"); llStartAnimation(PREANIMATION); } else { //llStopAnimation(ANIMATION); llMessageLinked(-2, llGetLinkNumber(), "unseated", ""); show(); if (0!=1) { state default; } } } try2animate(){ integer canAnimate=TRUE; integer i; for (i=1; i<llGetListLength(links_seated); i=i+2){ canAnimate=canAnimate&llList2Integer(links_seated, i); } if (canAnimate) startAnimate(); else stopAnimate(); } startAnimate(){ key avatar = llAvatarOnSitTarget(); if(avatar != NULL_KEY) { llStopAnimation(PREANIMATION); llStartAnimation(ANIMATION); } } stopAnimate(){ key avatar = llAvatarOnSitTarget(); if(avatar != NULL_KEY) { llStopAnimation(ANIMATION); llStartAnimation(PREANIMATION); } }
default { state_entry() { offset=OFFSET; llListen(LISTENCHANNEL, "", NULL_KEY, ""); llSitTarget(offset,ZERO_ROTATION); integer i; for (i=0; i<llGetListLength(LINK_IDS); i++){ links_seated+=llList2Integer(LINK_IDS, i); links_seated+=[FALSE]; } }
touch_start(integer total_number) { if (TELL_LINK_NAMES) llOwnerSay("I'm link #"+(string)llGetLinkNumber()); string prefix=""; if (LISTENCHANNEL!=0) prefix= "/"+(string)LISTENCHANNEL; llWhisper(0, "Say \""+prefix+"hide\" and \""+prefix+"show\" to hide/show the poseball"); } changed(integer change) { if (change & CHANGED_LINK) { seated(); } } listen(integer channel, string name, key id, string message){ if (llToLower(message)=="hide"){ hide(); } else if (llToLower(message)=="show"){ show(); } } link_message(integer sender_num, integer num, string str, key id){
if (str=="seated"){ integer i; for (i=0; i<llGetListLength(links_seated); i=i+2){ if (llList2Integer(links_seated, i)==num){ links_seated=llListReplaceList(links_seated, [TRUE],i+1, i+1); } } try2animate(); } else if (str=="unseated"){ integer i; for (i=0; i<llGetListLength(links_seated); i=i+2){ if (llList2Integer(links_seated, i)==num){ links_seated=llListReplaceList(links_seated, [FALSE],i+1, i+1); } } try2animate(); } } }
|