Jump to content

Multi Sit boat?


amarock Amat
 Share

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

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

Recommended Posts

This help? 

I was thinking of setting the Linkset postions of 

 

If Linkset,1  balh balhb albah controls

 

else just sit

 

float forward_power = 10; //Power used to go forward (1 to 30)float reverse_power = -10; //Power ued to go reverse (-1 to -30)float turning_ratio = 5.0; //How sharply the vehicle turns. Less is more sharply. (.1 to 10)string sit_message = "Ride"; //Sit messagedefault{state_entry(){llSetSitText(sit_message);// forward-back,left-right,updownllLinkSitTarget(1,<0.2,0,0.45>,ZERO_ROTATION);llLinkSitTarget(2,<1,0,.45>,ZERO_ROTATION);llSetCameraEyeOffset(<-12, 0.0, 5.0>);llSetCameraAtOffset(<1.0, 0.0, 2.0>);llSetVehicleFlags(0);llSetVehicleType(VEHICLE_TYPE_BOAT);llSetVehicleFlags(VEHICLE_FLAG_HOVER_UP_ONLY | VEHICLE_FLAG_HOVER_WATER_ONLY);llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <1, 1, 1> );llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 2 );llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0>);llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1);llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.05);llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 1 );llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 5 );llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0.15);llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY,.5 );llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 2.0 );llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1 );llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5 );llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 3 );llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.5 );llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 10 );llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5 );llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 2 );llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1 );llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.1 );llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, .5 );llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, ZERO_ROTATION );}changed(integer change){if (change & CHANGED_LINK){key agent = llAvatarOnSitTarget();if (agent){ if (agent != llGetOwner()){llMessageLinked(LINK_ALL_CHILDREN , 0, "start", NULL_KEY);llSleep(.4);llSetStatus(STATUS_PHYSICS, TRUE);llSleep(.1);llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);}else{llMessageLinked(LINK_ALL_CHILDREN , 0, "start", NULL_KEY);llSleep(.4);llSetStatus(STATUS_PHYSICS, TRUE);llSleep(.1);llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);}}else{llSetStatus(STATUS_PHYSICS, FALSE);llSleep(.1);llMessageLinked(LINK_ALL_CHILDREN , 0, "stop", NULL_KEY);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 speedvector vel = llGetVel();float speed = llVecMag(vel);//car controlsif(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;angular_motor.x += 15;}if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT)){angular_motor.z += speed / turning_ratio * reverse;angular_motor.x -= 15;}llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);} //end control } //end default

 

 

 

Link to comment
Share on other sites

We'd really need to see how the thing is scripted.   Off the top of my head, I suspect you're asking for PERMISSION_TAKE_CONTROLS in the changed event whenever anyone sits down, which is going to make life very confusing.

While I'm not sure exactly what you mean by "the linksit method" (I think I know you probably mean, but I don't want to guess), I think you could probably fix the problem by saying something like:

changed(integer change)	{		if(change & CHANGED_LINK){			key k = llAvatarOnSitTarget();			if(k){				if(llGetNumberOfPrims()== llGetObjectPrimCount(llGetKey())+1){					llRequestPermissions(k,PERMISSION_TRIGGER_ANIMATION|PERMISSION_TAKE_CONTROLS);				}				else{					llRequestPermissions(k,PERMISSION_TRIGGER_ANIMATION);				}			}			else{				//someone's just got off			}		}	}

 Alternatively, and probably much better, you could use llLinkSitTarget and check, in the changed event, who llAvatarOnLinkSitTarget() for a particular prim is, and only take PERMISSION_TAKE_CONTROLS if they're sitting on the appropriate prim.

ETA -- you posted while I was writing.   I don't fully understand how the permissions work there.  If that's the only script that holds permissions, then it's going to have to switch PERMISSION_TAKE_CONTROLS round between people, because a script can only hold one set of permissions at a time.   Are there other other scripts in the boat to hold animation permissions for the passengers (if there are, then my first suggestion should work)?

Link to comment
Share on other sites

I think you're going to need two scripts.   In fact, I'm sure you are, because you need to hold two sets of permissions -- one PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION and one simply PERMISSION_TRIGGER_ANIMATION, because each time you call llRequestPermissions, that over-writes the previous ones you've taken.

So the simplest solution is to have two scripts, the main script you've just reproduced, which takes PERMISSION_TAKE_CONTROLS and PERMISSION_TRIGGER_ANIMATION when the first avatar sits down and then a second script that only takes PERMISSION_TRIGGER_ANIMATION from the second avatar to sit.

And then you can check what's happening, exactly, in the changed event, by seeing how llGetNumberOfPrims() (number of prims in object + number of seated avatars) compares with llGetObjectPrimCount() (ignores avatars) or by checking llAvatarOnLinkSitTarget if you've set separate ones.

Link to comment
Share on other sites

But the pose ball has to be linked to the boat, otherwise the passenger is going to be left behind.

The problem is that the changed event is going to fire in every script in the linkset when anyone sits down or gets up, and you need to keep careful track of what each script does, or doesn't do, and which avatar's uuid they use, when that happens.

Void Singer explained this to me ages ago in the old forum -- I'll try to find the thread, but that was before we had llAvatarOnLinkSitTarget() which makes it a lot easier to keep track of what's happening.

 

Link to comment
Share on other sites

If it helps, here's the note that I put in the LSL wiki last Fall when I was wrestling with multiple sit targets ....

If an object has multiple seats (each seat has a script that sets a sit target with llSitTarget, or the linkset has a script that assigns several llLinkSitTargets), the following method determines which sit target an avatar ends up at:

  • If the prim that is clicked on has a sit target and that sit target is not full, that sit target is used.
  • If the prim that is clicked on has no sit target, and one or more other linked prims have sit targets that are not full, the sit target of the prim with the lowest link number will be used.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3438 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...