Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problems understanding adding "seats" to cars etc..

Chris Widget
Widget Isles @ the Edge!
Join date: 22 Jan 2006
Posts: 67
01-28-2006 10:20
Ok this is a basic question that is just killing me. I have a box (default prim or whatever) and I want to have 4 "seats" . Each seat will have a little "ball" indicating where to click to sit down there. I understand how to apply the different scripts to the different balls (primary prim gets "driver" others get "pass";) but the question is how do I make the balls themselves clickable ? If I link them to the box then clicking anywhere causes the "driver" to come up and none of the "pass" selections...
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
01-28-2006 10:34
From: Chris Widget
Ok


Hey Chris! Welcome to Second Life! Sounds like you're working with a few scripts that are already written. Maybe we could get a better idea of how to help you if you post examples of the scripts you're working with? More info is a good thing. =D
Chris Widget
Widget Isles @ the Edge!
Join date: 22 Jan 2006
Posts: 67
01-28-2006 10:54
Here is the main script.

I want to have not only this one seat but 3 more.

default
{
state_entry()
{
llSetSitText("Ride";);
llSitTarget(<0.3, 0.0, 0.3>, ZERO_ROTATION);
llSetCameraEyeOffset(<-5.0, 0.0, 2.0>;);
llSetCameraAtOffset(<3.0, 0.0, 2.0>;);
llSetVehicleType(VEHICLE_TYPE_BOAT);
llSetVehicleFlags(VEHICLE_FLAG_NO_FLY_UP | VEHICLE_FLAG_HOVER_UP_ONLY | VEHICLE_FLAG_HOVER_WATER_ONLY);
// remove these flags
llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_TERRAIN_ONLY
| VEHICLE_FLAG_LIMIT_ROLL_ONLY
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT);

// least for forward-back, most friction for up-down
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <2, 3, 2> );

// uniform angular friction (setting it as a scalar rather than a vector)
llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 5 );

// linear motor wins after about five seconds, decays after about a minute

llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 5 );
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );

// agular motor wins after four seconds, decays in same amount of time

llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 4 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 4 );

// hover
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0.15);
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY,.5 );
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 2.0 );
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1 );

// halfway linear deflection with timescale of 3 seconds
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5 );
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 3 );

// angular deflection
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.5 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 5 );

// somewhat bounscy vertical attractor
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5 );
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 5 );

// weak negative damped banking
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 3 );
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.8 );
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, .75 );

// default rotation of local frame
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );


}

changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if (agent)
{
if (agent != llGetOwner())
{
llSay(0, "You aren't the owner";);
llUnSit(agent);
llPushObject(agent, <0,0,100>, ZERO_VECTOR, FALSE);
}
else
{
llSetStatus(STATUS_PHYSICS, TRUE);
llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
}
}
else
{
llSetStatus(STATUS_PHYSICS, FALSE);
llReleaseControls();
llStopAnimation("sit";);
}
}

}

run_time_permissions(integer perm)
{
if (perm)
{
llStartAnimation("sit";);
llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
}
}
control(key id, integer level, integer edge)
{
vector angular_motor;

if(level & CONTROL_FWD)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <20,0,0>;);
}
if(level & CONTROL_BACK)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <-10,0,0>;);
}
if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
angular_motor.x += 10;
angular_motor.z -= 10;
}
if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
angular_motor.x -= 10;
angular_motor.z += 10;
}
if(level & (CONTROL_UP))
{
angular_motor.y -= 50;
}

llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);
}

}
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
01-28-2006 12:06
So, for passengers, you might want to begin with a simple sit-target script, something along the lines of

CODE
default
{
state_entry()
{
llSitTarget(<0.1,0.01,.1>, ZERO_ROTATION);
}
}


In the prim with the highest linknumber, consider putting something like:

CODE
    
state_entry()
{
llSitTarget(<0, 0, 0.1>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
llSleep(0.5); // llUnSit works better with this delay
if (llAvatarOnSitTarget() != NULL_KEY)
{
llUnSit(llAvatarOnSitTarget());
}
}
}


which helps prevent unwanted extra passengers from getting a free ride. Make sure it goes in the prim with the link number. In general with this stuff, you'll be working a lot with the sit target way of handling sitting.
Chris Widget
Widget Isles @ the Edge!
Join date: 22 Jan 2006
Posts: 67
01-28-2006 13:10
Kage thank you very much for the script information, I will certainly use it. The question I really have those is with the "seats" themselves. How do I create multiple seating points on my base prim ?
Chris Widget
Widget Isles @ the Edge!
Join date: 22 Jan 2006
Posts: 67
01-28-2006 13:18
Never mind I figured it out. Thank you for all of your help.