Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

total noob on scripts. I need one to make my aircraft carrier move and float.

Ciera Spyker
Queen of SL
Join date: 25 Mar 2008
Posts: 424
05-07-2008 17:49
I built a aircraft carrier to hold my choppers, its big, but still under 18 prims. Problem is that I found some free ride? or drive scripts in a freebie warhouse, but actually, Im totally lost here.

When I jump on it and try to go, it does one of two things.
It A.-stops floating and nose dives to stand, ass up like the titanic sinking.
Or B.-sinks completely but then goes like hell zooming along underwater like a submarine until I hit something at which point it breaks teh surface and plows through anything in its way.

I somehow once, got it to lift out of the water completly but then it got stuck in some animation loop and I had to stand up which promplty sank it again to the bottom of the ocean.

I'd like to see this work, its freaking huge and once I know it works Ill detail it out a bit more. Maybe put in statesrooms and maybe more. Its my first ever "thing" Ive made.

Ill add a pic.
I'm going to widen the hull so it reflects a bigger stable foot print as it lists to the side of the command tower right now. Which I'd expect in real life so it works here?

My chopper seems to stay on board pretty good so far. lathough the ships not big enough yet to scale it.

any help would be nice.
its still rough, but I'll add a pic. Don't laugh.

Ciera Spyker
The Preggo Goddess
Crunch Underwood
Mr. Grown up, Go away sir
Join date: 25 Sep 2007
Posts: 624
05-07-2008 18:22
very cool ciera, sounds like you'll eventually make it very big? will it be over 32 prims? 32 prims is the limit for a physical linked object...unfortunatly. but to overcome this there are some scripts out there for larger vehicles multi-move is the most widely used but it's best to have your item fully built befor adding the scripts otherwise it tends to act funny, two other good things about multimove are 1. it's free and 2. you are able to attach anotehr smaller vehicle to it using one of the included scripts. that means you could add the script to one of your choppers and it'll move with your aircraft carrier, that'd be cool. anyway here is the SLEX URL for it

http://www.slexchange.com/modules.php?name=Marketplace&file=item&ItemID=407818

-Crunch
_____________________
----------------------------------------------

So your final Nimbus Score is 8.15, a quite remarkable achievement for a biped. Congratulations Crunch, you should be very proud. :-)
Ciera Spyker
Queen of SL
Join date: 25 Mar 2008
Posts: 424
05-07-2008 18:58
Id like to keep it under the 32 then. I didnt mean for it to fly but maybe thats more practical than say boating.

I wanted a boat script. forward back left right, nothing fancy.
this script you linked too is very neat, I'll install it tonite and see what happens.

and since its mine and full mod LOL, once I get it right I'll just stretch it some more. (I think I can?)
If its a sky carrier, I can work on making it rather mean looking with clear bubble blisters and so forth. Hmm this si fun.

TY
Ciera Spyker
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
05-07-2008 20:03
MRC TO THE RESCUE!!!!!

CODE

//Linden boating script
//may need slight tweeking

float speed;
vector angular_motor;

default
{
state_entry()
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY);
llSetSitText("Board");
llStopSound();
llSetTimerEvent(0.0);
speed=0;
llSitTarget(<0.5, -0.5, 0.55>, ZERO_ROTATION);
llSetCameraEyeOffset(<-5.0, 0.0, 2.0>);
llSetCameraAtOffset(<3.0, 0.0, 2.0>);
llSetVehicleType(VEHICLE_TYPE_BOAT);
llSetVehicleFlags(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, 2 );

// 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, 2 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 5 );

// hover / float
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0.3);
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY,.5 );
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 2.0 );
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0.5 );

// 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, 10 );

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

// weak negative damped banking
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1 );
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.1 );
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
{
// You sit and are owner so get controls
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, TRUE);
llRequestPermissions(agent,PERMISSION_TAKE_CONTROLS);
}
}
else
{
// You stand so boat stops
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
llReleaseControls();
llStopSound();
llSetTimerEvent(0.0);
}
}

}

run_time_permissions(integer perm)
{
if (perm)
{
// Take these controls and lets go
llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_UP | CONTROL_DOWN, TRUE, FALSE);
llMessageLinked(LINK_ALL_CHILDREN, 0, "start", NULL_KEY);
llLoopSound("car idle",0.3);
llSetTimerEvent(0.3);
}
}
control(key id, integer level, integer edge)
{

if(level & CONTROL_FWD)
{
// Set cruising speed faster
if(speed < 20)
{
speed +=1;
}
}
if(level & CONTROL_BACK)
{
// Set cruising speed slower
if(speed > -8)
{
speed -=1;
}
}
if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
// Turn right
angular_motor.x += 5;
angular_motor.z -= 1;
}
if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
// Turn left
angular_motor.x -= 5;
angular_motor.z += 1;
}
if(level & CONTROL_UP)
{
// add features for when you press up
}
if(level & CONTROL_DOWN)
{
// Added feature for when you press down
// Stops boat when down is pressed
speed=0;
}

}

timer()
{
// the timer actually moves vehicle
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <speed,0,0>);
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);
// reset turning angle or you would go around in circles
angular_motor=<0,0,0>;
}
}
Crunch Underwood
Mr. Grown up, Go away sir
Join date: 25 Sep 2007
Posts: 624
05-07-2008 20:09
on ya Mrc *thumbs up* :)

-Crunch
_____________________
----------------------------------------------

So your final Nimbus Score is 8.15, a quite remarkable achievement for a biped. Congratulations Crunch, you should be very proud. :-)
Ciera Spyker
Queen of SL
Join date: 25 Mar 2008
Posts: 424
05-07-2008 20:35
no that didnt work it does swing the camera around the ship nicley but now it doesnt move at all.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
05-08-2008 00:16
From: Ciera Spyker
no that didnt work it does swing the camera around the ship nicley but now it doesnt move at all.

You know that the root prim in all these vehicle scripts must be orientated: FWD, LEFT, UP?
If it is not the orientation must be corrected by: llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, rotation rotAdjust );
(the vehicle script of course is in the root)
When the orientation is not set right you will get all kinds of funny movements
Another thing:
Objects that are too heavy will not move, i.e llMoveToTarget() can not move objects heavier than 800kg
_____________________
From Studio Dora