Jump to content

Script for toy car


sophy7777
 Share

You are about to reply to a thread that has been inactive for 399 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey all, first of all hope your well!

im having a lil bother scripting a toy car. i cant seem to find a script that when attached it plays a idle animation but when walking plays another. im thinking attached is the best way? im not very sure im not a scripted at all. i have tried some car scripts but couldnt find any instructions or easy to use ones so if anyone knows of any simpler ones please link 

 

thanks all and stay safe ❤️ 

included a picture to help explain what im scripting! 

 

7690a2cf59ee6dd43538fe7a9cfdc026-png.jpg 

Link to comment
Share on other sites

here is a very simplified example, with a few events, of the logic flow?

state_entry()
    {    
         if(llGetAttached() )
         {  llRequestPermissions(llGetOwner(), PERMISSION_OVERRIDE_ANIMATIONS | PERMISSION_TAKE_CONTROLS );            
         }
    }   
attach( key k )
   {   
        if ( k != NULL_KEY )
          {  llRequestPermissions(llGetOwner(), PERMISSION_OVERRIDE_ANIMATIONS | PERMISSION_TAKE_CONTROLS );             
          }
   }
 run_time_permissions(integer perm)
    {
        if( perm &  PERMISSION_TAKE_CONTROLS ) {
            llTakeControls( CONTROL_DOWN|CONTROL_UP|CONTROL_FWD|CONTROL_BACK|CONTROL_LEFT|CONTROL_RIGHT
                            |CONTROL_ROT_LEFT|CONTROL_ROT_RIGHT, TRUE, TRUE);           
        }
        if ( perm & PERMISSION_OVERRIDE_ANIMATIONS )
        {   // replace normal anims with your car anims .... i.e. ... car_going_fast, car_idle, car_normal_speed
            llSetAnimationOverride( "Running", car_going_fast);
            llSetAnimationOverride( "Standing", car_idle);
            llSetAnimationOverride( "Walking", car_normal_speed);
        }  
    } 
 control( key _id, integer _level, integer _edge )
    {   float speed = 5.0;  
        if( _level & CONTROL_FWD)
        {  
           if( llGetAgentInfo(llGetOwner() ) & AGENT_ALWAYS_RUN )
            { llApplyImpulse(< speed,0,0>,TRUE);  
            }
        }      
    }

 

Edited by Xiija
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 399 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...