llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 0.01); // default rotation of local frame llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0,0,0,1>); // remove these flags llRemoveVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP | VEHICLE_FLAG_HOVER_WATER_ONLY | VEHICLE_FLAG_LIMIT_ROLL_ONLY | VEHICLE_FLAG_HOVER_TERRAIN_ONLY | VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT | VEHICLE_FLAG_HOVER_UP_ONLY | VEHICLE_FLAG_LIMIT_MOTOR_UP ); } on_rez(integer num) { llSetStatus(STATUS_PHYSICS, FALSE); pilot = llGetOwner(); llSetTimerEvent(60); // beacon timer for 1 min intervals } listen(integer channel, string name, key id, string message) { message == llToLower(message); if (message == "help") { help(); } if (message == "stop") { brake = TRUE; llWhisper(0,"We are stopped, O Master of the Carpet. You may say START to resume flight."); llSetStatus(STATUS_PHYSICS, FALSE); } else if (message == "start") { brake = FALSE; llWhisper(0,"I hear and obey, O Master of the Carpet. We now begin flight."); llSetStatus(STATUS_PHYSICS, TRUE); } } // DETECT AV SITTING/UNSITTING AND GIVE PERMISSIONS changed(integer change) { agent = llAvatarOnSitTarget(); if(change & CHANGED_LINK) { if((agent == NULL_KEY) && (sit)) { // // Avatar gets off vehicle // llSetStatus(STATUS_PHYSICS, FALSE); llStopAnimation("sit_ground"); llMessageLinked(LINK_SET, 0, "unseated", ""); llStopSound(); llReleaseControls(); sit = FALSE; listenState(FALSE); } else if ((agent != NULL_KEY) && (!sit)) { // // Avatar gets on vehicle // pilot = llAvatarOnSitTarget(); sit = TRUE; llRequestPermissions(pilot, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION); listenState(TRUE); llWhisper(0,"O Master of the Carpet, "+llKey2Name(pilot)+", command me as you will. Should you need assistance, please speak the word HELP."); llMessageLinked(LINK_SET, 0, "seated", ""); } } } //CHECK PERMISSIONS AND TAKE CONTROLS run_time_permissions(integer perm) { if (perm & (PERMISSION_TAKE_CONTROLS)) { llTakeControls(CONTROL_UP | CONTROL_DOWN | CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE); } if (perm & PERMISSION_TRIGGER_ANIMATION) { // Admittedly, animations are bugged. I'll let you figure it out. :) -CT llStartAnimation("sit_ground"); llStopAnimation("sit"); } } //FLIGHT CONTROLS control(key id, integer level, integer edge) { vector angular_motor; integer motor_changed; if ((level & CONTROL_FWD) || (level & CONTROL_BACK)) { if (edge & CONTROL_FWD) xMotor = X_THRUST; if (edge & CONTROL_BACK) xMotor = -X_THRUST; } else { xMotor = 0; } if ((level & CONTROL_UP) || (level & CONTROL_DOWN)) { if (level & CONTROL_UP) { zMotor = Z_THRUST; } if (level & CONTROL_DOWN) { zMotor = -Z_THRUST; } } else { zMotor = 0; } llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, ); if (level & CONTROL_RIGHT) { angular_motor.x = TWO_PI; angular_motor.y /= 8; } if (level & CONTROL_LEFT) { angular_motor.x = -TWO_PI; angular_motor.y /= 8; } if (level & CONTROL_ROT_RIGHT) { angular_motor.x = TWO_PI; angular_motor.y /= 8; } if (level & CONTROL_ROT_LEFT) { angular_motor.x = -TWO_PI; angular_motor.y /= 8; } llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor); } timer() { //This is a beacon. Vehicles that are not keyed to owner will often get stolen. // To avoid leaving vehicle litter all over the world, this beacon notifies the owner of it's location. if (beaconMins < BEACON_INT) { beaconMins += 1; } else { beaconMins = 0; vector pos = llGetPos(); llInstantMessage(llGetOwner(), "O Master of the Carpet, I have been left unattended in "+llGetRegionName()+" "+(string)((integer)pos.x)+", "+(string)((integer)pos.y)+", at an altitude of "+(string)((integer)pos.z)+" meters."); } }}