Jump to content

can some one help with my car script


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

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

Recommended Posts

//Jonny Kyries Drag sciptlist        ForwardPowerGears = [2, 5, 100];float       ReversePower = -2;float       TurnPower = 2;float       TurnSpeedAdjust = 0.0;string      SitText = "PWN";string      not_owner_message = "Permissions not granted";string      IdleCommand = "Ignition";string      StopCommmand = "Killswitch";vector      SitTarget = <0,0,0>;vector      SitRotation = <0,0,0>;// driving animation if i chose to in the futurekey         Owner;string      OwnerName;float       ForwardPower;integer     NumGears;integer     Gear;integer     NewSound;string      Sound;integer     CurDir;integer     LastDir;integer     Forward;vector      SpeedVec;vector      Linear;vector      Angular;integer     Active;key         sitting;integer     Moving;string      SimName;default{        state_entry()    {        llSetVehicleType(VEHICLE_TYPE_CAR);          llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.80);        llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.10);                llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2);        llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.10);                llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);        llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.1);                llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.1);                llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000.0, 10.0, 1000.0> );        llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <500.0, 500.0, 1000.0> );                llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.50);        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.50);        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.50);     }    changed(integer change)    {                        if (change & CHANGED_LINK)        {                        key agent = llAvatarOnSitTarget();            if (agent)            {                                if (agent != llGetOwner())                {                    llSay(0, not_owner_message);                    llUnSit(agent);                    llPushObject(agent, <0,0,50>, ZERO_VECTOR, FALSE);                }                else                {                    llTriggerSound("car_start",1);                                                            llMessageLinked(LINK_ALL_CHILDREN , 0, "WHEEL_DRIVING", NULL_KEY);                    llSleep(.4);                    llSetStatus(STATUS_PHYSICS, TRUE);                    llSleep(.1);                    llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);                    llLoopSound("car_run",1);                }        }            else            {                llStopSound();                                llSetStatus(STATUS_PHYSICS, FALSE);                llSleep(.4);                llReleaseControls();                llTargetOmega(<0,0,0>,PI,0);                                llResetScript();            }        }            }        run_time_permissions(integer perm)    {        if (perm)        {            llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_DOWN | CONTROL_UP | CONTROL_RIGHT |                             CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);        }    }        control(key id, integer level, integer edge)    {        integer reverse=1;        vector angular_motor;                //get current speed        vector vel = llGetVel();        float speed = llVecMag(vel);        //car controls        if(level & CONTROL_FWD)        {            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <forward_power,0,0> );            reverse=1;        }        if(level & CONTROL_BACK)        {            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <reverse_power,0,0>);            reverse = -1;        }        if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))        {            angular_motor.z -= speed / turning_ratio * reverse;        }                if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))        {            angular_motor.z += speed / turning_ratio * reverse;        }        llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);    }            }       

 

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3193 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
×
×
  • Create New...