|
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
|
10-14-2006 10:03
I am trying to make a balloon type vehicle and having a lot of problems. I tried using the script on the Wiki tutorial and I also tried editing scripts I got for free. I can't figure out how to get them to work. When they work at all sometimes I can move forward but usually just rotate and I can never go up or down. I was trying to attempt a script on my own, but it just isn't working. I need serious help.
|
|
Justin Bamboo
Registered User
Join date: 5 Oct 2006
Posts: 2
|
some help for you
10-14-2006 11:25
Hey this is justin bamboo and if you IM me in second life i will help you with your problem bc i think that your just trying to edit a regular car script so i can edit u a nice pretty slow airplane script if you IM me aslong if i get a copy of the object.
|
|
Vares Solvang
It's all Relative
Join date: 26 Jan 2005
Posts: 2,235
|
10-14-2006 12:01
I wrote a script that would work for this, though it's pretty basic. I used the llSetBuoyancy command to make the object neutrally buoyant, and then I have a voice activated llApplyImpulse routine set up to make it change directions.
I only use it in a cube to goof around, but I have always thought it would work great for a balloon, although you would have to watch make sure your total mass didn't get too high. (Make all the prims hollow and out of plastic if need be to reduce mass.)
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
10-14-2006 12:22
The following is a script based on a flying saucer script that I found some place in world. It works but is based on using a physical object rather than a vehicle script. I've meant to rewrite it for the past 6 months but never have time.... // Hot Air Balloon Script // Modified version of the flying Saucer script // // float LINEAR_TAU = 0.75; float TARGET_INCREMENT = 0.5; float ANGULAR_TAU = 1.5; float ANGULAR_DAMPING = 0.85; float THETA_INCREMENT = 10;
integer KEYMASK = 0; vector pos; vector face; float brake = 0.5; key gOwnerKey; string gOwnerName; key Driver; integer gFLYING = 0; integer nudge = FALSE; integer auto=FALSE; integer CHANNEL = 6; //--------------------------------------------------------------- help() { string chan = (string)CHANNEL; llWhisper(0,"Commands:"); llWhisper(0,"Left click craft = Start "); llWhisper(0,"Left click craft = Stop and release contol"); llWhisper(0,"/" + chan + " 1! through" + " /" + chan + " 9!," + " /" + chan + " slow = Set power"); llWhisper(0,"/" + chan + " menu = Display this list"); llWhisper(0,"PgUp or PgDn = Gain or lose altitude"); llWhisper(0,"Arrow keys = Left, right, Forwards and Back"); llWhisper(0,"Shift + Left or Right arrow = Rotate but maintain view"); llWhisper(0,"PgUp + PgDn or combination similar = Set cruise on or off"); } //--------------------------------------------------------------- SetPhysics() { llSetStatus(STATUS_PHYSICS, FALSE); llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, TRUE); llSleep(0.1); llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE); llSetStatus(STATUS_PHYSICS, FALSE); llMoveToTarget(llGetPos(), 0); llRotLookAt(llGetRot(), 0, 0); llSetStatus(STATUS_PHYSICS, FALSE); } //--------------------------------------------------------------- SetPilotPosition() { llSetSitText("Pilot"); llSitTarget(<0.4, 0.0, 0.4>, ZERO_ROTATION); } //--------------------------------------------------------------- SetCamera() { llSetCameraEyeOffset(<-10.0, 0.0, 4.0>); llSetCameraAtOffset(<0, 0.0, 0>); } //--------------------------------------------------------------- SetSpeed(float speed) { TARGET_INCREMENT = speed; llWhisper(0,"Power: " + llGetSubString((string)(TARGET_INCREMENT * 10.0),0,3) + "%"); } //--------------------------------------------------------------- handleKeys() { } //--------------------------------------------------------------- Move() { pos *= brake; // Update position, effectively decays away 'speed' if (pos.x < 0) { pos.x=0; } // Dont allow negative X values else { pos.x += TARGET_INCREMENT; } // Speed increment vector world_target = pos * llGetRot(); // Rotate into world co-ordinate system llMoveToTarget(llGetPos() + world_target, LINEAR_TAU); // Move the vehicle } //--------------------------------------------------------------- CruiseMode() { if (auto) { auto=FALSE; llWhisper(0,"Cruise off"); llSetTimerEvent(0.0); } else { auto=TRUE; llWhisper(0,"Cruise on"); llSetTimerEvent(0.5); } llSleep(0.5); } //--------------------------------------------------------------- default { state_entry() { gOwnerKey = llGetOwner(); // The Owner gOwnerName = llKey2Name(llGetOwner()); // The Owners name (WHY, Never Used) SetPilotPosition(); // Position of pilot's seat SetCamera(); // Position camera llSetTimerEvent(0.0); SetPhysics(); // Which Keys we are interested in KEYMASK = CONTROL_FWD | CONTROL_BACK | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT | CONTROL_UP | CONTROL_DOWN | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ML_LBUTTON;
TARGET_INCREMENT = 0.5; state Listening; } } //--------------------------------------------------------------- state Listening { state_entry() { llWhisper(0,"Type /" + (string)CHANNEL + " menu for a list of options."); llListen(CHANNEL, "", "", ""); // Listen to anyoen saying anything } on_rez(integer number) { llResetScript(); } // Reset The script if we rez, this ensures a good start up touch_start(integer total_number) { if (gFLYING == 0) { gFLYING = 1; llSetStatus(STATUS_PHYSICS, TRUE); llSetSitText("Ride"); Driver=llDetectedKey(total_number - 1); state StateDriving; } } // Here is the Listen callback listen(integer channel, string name, key id, string msg) { //if (llSameGroup(id)==1) // This is meant to only allow same group control but it fails //{ string message = llToLower(msg); if (message == "menu") { help(); } //} } } //--------------------------------------------------------------- state StateDriving { state_entry() { llRequestPermissions(Driver, PERMISSION_TAKE_CONTROLS); llMoveToTarget(llGetPos(), LINEAR_TAU); llRotLookAt(llGetRot(), ANGULAR_TAU, 1.0); llListen(CHANNEL, "", Driver, ""); llMessageLinked(LINK_ALL_CHILDREN, 0, "light", gOwnerKey); } touch_start(integer total_number) { key id = llDetectedKey(0); if (id == Driver) { llWhisper(0,"Thank You for flying!"); gFLYING = 0; auto=FALSE; llSleep(1.5); llSetSitText("Pilot"); llSetStatus(STATUS_PHYSICS, FALSE); llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", gOwnerKey); llSetTimerEvent(0.0); llReleaseControls(); llResetScript(); } } link_message(integer sender_num, integer num, string msg, key id) { } listen(integer channel, string name, key id, string msg) { string message = llToLower(msg); if (message == "menu") { help(); } if (id==Driver) { if (message == "slow") { SetSpeed(0.5); } if (message == "1!") { SetSpeed(0.75); } if (message == "2!") { SetSpeed(1.0); } if (message == "3!") { SetSpeed(1.5); } if (message == "4!") { SetSpeed(2.0); } if (message == "5!") { SetSpeed(3.0); } if (message == "6!") { SetSpeed(4.0); } if (message == "7!") { SetSpeed(5.0); } if (message == "8!") { SetSpeed(6.0); } if (message == "9!") { SetSpeed(7.0); } } }
run_time_permissions(integer perm) { if (perm == PERMISSION_TAKE_CONTROLS) { llTakeControls(KEYMASK, TRUE, FALSE);
} else { llWhisper(0,"Stopped"); llSetTimerEvent(0.0); gFLYING = 0; llSleep(1.5); llResetScript(); } } // Handles Key press events control(key driver, integer keys, integer edges) { pos *= brake; face.x *= brake; face.z *= brake; nudge = FALSE;
if (keys & CONTROL_FWD) { if (pos.x < 0) { pos.x=0; } else { pos.x += TARGET_INCREMENT; } nudge = TRUE; } if (keys & CONTROL_BACK) { if (pos.x > 0) { pos.x=0; } else { pos.x -= TARGET_INCREMENT; } nudge = TRUE; } if (keys & CONTROL_UP) { llMessageLinked(LINK_ALL_CHILDREN, 0, "fast", driver); if(pos.z<0) { pos.z=0; } else { pos.z += TARGET_INCREMENT; } face.x=0; nudge = TRUE; } if (keys & CONTROL_DOWN) { llMessageLinked(LINK_ALL_CHILDREN, 0, "fast", driver); if(pos.z>0) { pos.z=0; } else { pos.z -= TARGET_INCREMENT; } face.x=0; nudge = TRUE; } if ((keys) & (CONTROL_LEFT|CONTROL_ROT_LEFT)) { if (face.z < 0) { face.z=0; } else { face.z += THETA_INCREMENT; } nudge = TRUE; } if ((keys) & (CONTROL_RIGHT|CONTROL_ROT_RIGHT)) { if (face.z > 0) { face.z=0; } else { face.z -= THETA_INCREMENT; } nudge = TRUE; } if ((keys & CONTROL_UP) && (keys & CONTROL_DOWN)) { CruiseMode(); } if (nudge) { vector world_target = pos * llGetRot(); llMoveToTarget(llGetPos() + world_target, LINEAR_TAU); vector eul = face; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot( eul ); rotation rot = quat * llGetRot(); llRotLookAt(rot, ANGULAR_TAU, ANGULAR_DAMPING); } } timer() { Move(); } }
|