SHARE
TWEET

Alternating Pose Limblocker

Edie_Shoreland Feb 9th, 2019 (edited) 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //I had problems applying some of the early ankle lock scripts to
  2. //other joint and limb specific animations.  This limb locking script
  3. //allows you to alternate between two different "holding" poses
  4. //without constantly refreshing the same animation, and to work with
  5. //your AO timer instead of fighting against it.  You should use two
  6. //limb specific holding poses (poses that only affect the arm, wrist,
  7. //and shoulder) that are slightly different for subtle hand and
  8. //position changes while your AO animates the rest of your body.
  9.  
  10. string hold_anim = "YOUR_FIRST_ANIMATION"; //put the name of your first animation here
  11. string alt_anim = "YOUR_SECOND_ANIMATION"; //put the name of your second animation here
  12. //If you want to use this as an ankle lock, you'll need to spend $20L
  13. //uploading two copies of the same ankle locking pose. Even if the two
  14. //animations have different names, you'll need to make sure hold_anim
  15. //and alt_anim also have two different UUIDs, or bad things may happen.
  16.  
  17. float time2switch = 5.0; //seconds between first and second animations
  18. //time2switch should be adjusted to your personal tolerance between
  19. //your AO timer and the possible number of seconds you want to wait
  20. //before the limb locker kicks back in.  Try to keep time2switch above
  21. //3 seconds unless you plan on renaming the variable to time2twitch.
  22.  
  23. integer toggle;
  24.  
  25.  
  26. default
  27. {
  28.     state_entry()
  29.     {
  30.         llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
  31.         llSetTimerEvent(time2switch);
  32.         llStartAnimation(alt_anim);
  33.  
  34.     }
  35.  
  36.     on_rez(integer param)
  37.     {
  38.         llResetScript();
  39.     }
  40.    
  41.     changed(integer change) //The script needs to be reset to recognize the new owner
  42.     {
  43.         if(change & 128) llResetScript();
  44.     }    
  45.  
  46.     attach(key id)
  47.     {
  48.         integer perm = llGetPermissions();
  49.  
  50.         if (id != NULL_KEY)
  51.         {
  52.             if (! (perm & PERMISSION_TRIGGER_ANIMATION)) llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
  53.         }
  54.         else
  55.         {
  56.             if (perm & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(alt_anim);
  57.         }
  58.     }
  59.  
  60.     timer()
  61.     {
  62.         if (toggle)
  63.         {
  64.             llStartAnimation(alt_anim);
  65.             llStopAnimation(hold_anim);
  66.         }
  67.        
  68.         else
  69.         {
  70.             llStartAnimation(hold_anim);
  71.             llStopAnimation(alt_anim);
  72.         }
  73.         toggle = !toggle;
  74.     }
  75. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top