Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

My First Script: Rocket, Need Help

Jiminy Roo
Registered User
Join date: 25 Dec 2004
Posts: 42
12-27-2004 10:00
I Have been playing Second life for 2 days, and have been experimenting with code. I decided to start on a life-size rocket to test my skills.

Here is the script:






launch()
{
llWhisper(0, "Take off in..";);
llSleep(0.5);
llWhisper(0, "5";);
llSleep(1);
llWhisper(0, "4";);
llSleep(1);
llWhisper(0, "3";);
llSleep(1);
llWhisper(0, "2";);
llSleep(1);
llWhisper(0, "1";);
llSleep(1);
llWhisper(0, "Lift off!";);

llSetStatus(STATUS_PHYSICS , TRUE);
llSetForce(<0,0,100000000000>, TRUE);
}


default
{
state_entry()
{

llWhisper(0, "Welcome to FireFlash v1.0, type /help for details";);
llListen( 0, "", llGetOwner(), "" );
}


listen( integer channel, string name, key id, string message )
{
if ( message == "/help" )
{
llWhisper( 0, "Help: Type '/launch' to launch, '/stop' for emergency shutdown. Align your FireFlash in launch direction before launching, with physics turned off. Have fun!" );
}

if (message == "/launch";)
{
launch();
}

if (message == "/reset";)
{
llSetStatus(STATUS_PHYSICS, FALSE);


vector eul = <0, 0, 0>;
eul *= DEG_TO_RAD;
rotation quat = llEuler2Rot( eul );
llSetRot( quat );
}


}


}





Everything runs fine, help, reset ect, but there is a problem with the launch. The countdown is fine, the physics is enabled, but the rocket just drops to the ground and tumbles over, as if no force has been acted upon it. I have tried up to 10e20 thrust with no avail. The rocket is almost solid metal, if that effects anything, but it still did not work when it was plastic.

Please help me out. I am really stuck
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
12-27-2004 10:11
Your probably getting hit with an invisible secret force called 'Energy' trying to use that much llSetForce, try using llApplyImpulse with a more normal value (30,000 or so should give you some serious lift) instead.

-Adam
_____________________
Co-Founder / Lead Developer
GigasSecondServer
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
12-27-2004 10:27
float frc = llGetMass() * 30;
vector force = <0,0,0>;
force.z = frc;
llSetForce(force, TRUE);

Unless your rocket is huge, this should do the trick.
If it IS huge, try hollowing out a few parts. Or all of them.
_____________________
CrazyMonkey Feaver
Monkey Guy
Join date: 1 Jul 2003
Posts: 201
12-27-2004 11:34
If there comments don't help then its most likely too heavy. Try to hollow out the pieces so its lighter. :) -- Also put the script in the largest prim. bigger prim = more power.
Jiminy Roo
Registered User
Join date: 25 Dec 2004
Posts: 42
12-27-2004 13:12
you mean make the parent prim in the link the big one? Also, I would like to add a door to my rocket, that closes on a text command, is that possible?
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
12-28-2004 06:36
Just put the anim on the rocket body so you can ride the outside like Slim Pickens in that classic Peter Sellers movie. Come to think of it, Slim Pickens was one of the few parts in that movie that weren't played by Peter Sellers... "Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb".... Ah the good old days when riding a bomb was easy! :D
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
12-28-2004 10:09
LL gives out a free rocket, you could check their code.
LL's scripted objects are always very well commented and examining them is a great way to teach yourself LSL.
Dakota Callahan
Feisty Irish Lass
Join date: 21 Jul 2004
Posts: 783
12-28-2004 10:53
From: Samhain Broom
Just put the anim on the rocket body so you can ride the outside like Slim Pickens in that classic Peter Sellers movie. Come to think of it, Slim Pickens was one of the few parts in that movie that weren't played by Peter Sellers... "Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb".... Ah the good old days when riding a bomb was easy! :D


Actually, Sellers was supposed to play that role as well, but was so exhausted from playing multiple roles that he tried to get Kubrick to recast it. When Kubrick refused, Sellers faked a broken leg (cast and all), and Kubrick was forced to cast Slim Pickins in the role. IMO, Pickins did a far better job than Seller's would have.
_____________________
Life is a Carnival

"...
every broken teleport makes a baby hippo cry." - Altruima Linden

"We're all pro wrestlers in the ring of Second Life." - Torley Linden

Dakota Callahan Designs
Callahans Isle (2,128, 502)