Advertisement
ZornTaov

Modified Flying v2

Jun 12th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //// "Flying v2" CONTROLLER TEMPLATE v1 - by Jopsy Pendragon - 5/15/2008
  2. //// You are free to use this script as you please, so long as you include this line:
  3. //** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//
  4.  
  5. // EFFECT: used in attachments, will ACTIVATE particles when avatar flies or is in the air and
  6. //            DEACTIVE particles when they land.
  7.  
  8. // SETUP:  Drop this CONTROLLER TEMPLATE script into any prim of the same
  9. // linked object as your PARTICLE TEMPLATE. It should be responsive immediately.
  10.  
  11.  
  12. string  CONTROLLER_ID = "A"; // see more about CONTROL TEMPLATES at end.
  13.  
  14. key user;
  15. integer activators;
  16. integer on=TRUE; // starting mode
  17.  
  18. default {
  19.     attach( key id ) { llResetScript();}
  20.    
  21.     on_rez(integer n) { llResetScript();}
  22.    
  23.     state_entry() {
  24.         activators = ( 0 // comment/uncomment to customize which actions to turn particles on for.
  25.                 | AGENT_ALWAYS_RUN    // has running ("Always Run") enabled, or is using tap-tap-hold
  26.                // | AGENT_ATTACHMENTS   // has attachments
  27.                // | AGENT_AWAY          // is in "away" mode
  28.                // | AGENT_BUSY          // is in "busy" mode
  29.                 | AGENT_CROUCHING     // is crouching
  30.                   | AGENT_FLYING        // is flying
  31.                   | AGENT_IN_AIR        // is in the air (hovering)
  32.                // | AGENT_MOUSELOOK     // is in mouselook
  33.                // | AGENT_ON_OBJECT     // is sitting on an object
  34.                // | AGENT_SCRIPTED      // has scripted attachments
  35.                // | AGENT_SITTING       // is sitting
  36.                // | AGENT_TYPING        // is typing
  37.                 | AGENT_WALKING       // is walking
  38.             );
  39.            
  40.         user = llGetOwner();
  41.         llSetTimerEvent( 1.0 );
  42.         llMessageLinked( LINK_SET, on, CONTROLLER_ID, ""); // set on or off as defined above to start with.
  43.     }
  44.     run_time_permissions(integer perm)
  45.     {
  46.         if (perm)
  47.         {
  48.             llStartAnimation("hold_R_bazooka");
  49.         }
  50.     }
  51.    
  52.     timer() {
  53.         if ( llGetAgentInfo(user) & activators ) {  // Agent is using one of the selected actions.
  54.        
  55.             if ( ! on ) { // start only if not already started.
  56.                 on=TRUE;
  57.                 llMessageLinked( LINK_SET, FALSE, CONTROLLER_ID, "");
  58.                 llStopAnimation("CFAH - Meditate Float");
  59.                 llSetLinkAlpha(LINK_SET, 0, ALL_SIDES);
  60.             }
  61.            
  62.         } else  {  // user is NOT using one of the selected actions.
  63.        
  64.             if ( on ) { // stop only if already started.
  65.                 on=FALSE;
  66.                 llMessageLinked( LINK_SET, TRUE, CONTROLLER_ID, "");
  67.                 integer perm = llGetPermissions();
  68.            
  69.             if (perm != ( PERMISSION_TRIGGER_ANIMATION))
  70.             {
  71.                 llRequestPermissions(user,  PERMISSION_TRIGGER_ANIMATION);
  72.             }
  73.             else
  74.             {
  75.                 llSetLinkAlpha(LINK_SET, 1, ALL_SIDES);
  76.                 llStartAnimation("CFAH - Meditate Float");
  77.             }
  78.             }
  79.            
  80.         }
  81.     }
  82. }
  83.  
  84.  
  85. //========================================================================
  86. //======================== USING CONTROL TEMPLATES =======================
  87. //
  88. // By default one CONTROLLER TEMPLATE will activate and deactivate all the
  89. // PARTICLE TEMPLATES that are in the same linked object.
  90. //
  91. // However, the templates will only obey or affect each other if they share
  92. // identical CONTROLLER_ID's.
  93. //
  94. // If you want templates to operate independently, change the value for
  95. // CONTROLLER_ID so that it is the same for all templates that work together.
  96. // (and different from all the templates that it should ignore or be ignored by)
  97.  
  98. //==================================== END ===============================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement