|
Jules Cerveau
Je suis un newb
Join date: 2 Mar 2006
Posts: 4
|
04-09-2006 17:43
Hello all- newb to scripting and whatnot, need help, the usual story.
I've been fiddling around with freebie vehicles and scripts, and I've gotten to the point where I can mess with numbers with relative certainty with little fear of a total screw-up. Now, what I've mainly been messing with is the Terra DIY Plane 1.0 script, and I've gotten pretty good with it.
For while now, I've been entertaining the notion of making a seaplane. Looking at the DIY Plane script, as well as a freebie yacht script I found, I think the main functions that relate to the 'floatability' or whatever of a vehicle are
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 ); llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0 ); llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 10 ); llSetVehicleFloatParam( VEHICLE_BUOYANCY, .977 );
That's ripped directly from the plane script. Now I've fiddled with all those numbers, and all I've come up with are planes that either fall incredibly slowly or fall quickly to a point slightly above the waterline and stay there. What I think I might need is some sort of 'if' function, something that states "If the airplane is above Hover_Height (or 'float_height', a float I ripped from somewhere), then the airplane will use this set of parameters. Else, it will use this other set of parameters."
The one major problem I have scripting that statement is that I don't know what to put after the 'if' Should it be "IF (number > float height)"? I don't fully understand LSL enough yet to know what proper syntax and structure is required.
Any help or suggestions would be appreciated. Yes, I have read the Wiki. No, I probably didn't catch everything.
|
|
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
|
04-09-2006 18:10
this is from my IsSwiming to dectect when under water you could adjust the height of 0 for above water what ever your height is. and have it swtich the vehicle type/parameters pos = llGetPos(); altitude_sea = (pos.z - llWater(ZERO_VECTOR));
if(altitude_sea < 0 && !isSwiming ) { isSwiming = TRUE; }
else if( altitude_sea > 0 && isSwiming ) { isSwiming = FALSE; } -LW
|
|
Jules Cerveau
Je suis un newb
Join date: 2 Mar 2006
Posts: 4
|
04-11-2006 13:17
Hmm... alright. I looked at that snippet there, and with a bit of modifying, angst, and a few sacrifices to the Elder Sleeping God Cthulhu, I managed to come up with the following bit of scripting. vector pos llGetPos(); float alititude_sea = (pos.z - IlWater(ZERO_VECTOR)); if (alititude_sea > 0 ) { llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 ); llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0 ); llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 10 ); llSetVehicleFloatParam( VEHICLE_BUOYANCY, .977 ); } else if (alititude_sea < 0 ) { llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 ); llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.2 ); llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 0.4 ); llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1.0 ); }
I did it all yesterday, and got it to the point where it didn't crash on me. However, I forgot to save a copy of the plane and script I was working on so today I had to redo it from memory. When saving the script, the compiler said there's an error at IlGotPos(); although I don't know what. Like I said before, I am a complete newb at scripting.
|
|
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
|
04-11-2006 15:36
vector pos = llGetPos(); just a spelling/syntax error  I still do that after two years also i would put the iswiming back in the if and true false ones so it will set your things once -LW
|