Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

falling then floating script

stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
07-29-2006 06:11
does anyone know how to script something that will fall once launched from a base then hit water then float. after that it will also need to explode(destroy) itself. this script will go towards building lifeboat rafts and also boats dropped from planes. it will also be here for other peoples future references
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
07-29-2006 07:58
Falling... make it physical.

Floating... have a check for the height component of llGetPos() and compare to llWater(). When it gets to the height of the water you'll probably want to look at the vehicle code for a boat. If you just want it to float there, make it non-physical.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
07-29-2006 08:08
ok then so physical thing is in where?

and please provide the full script for the float.

also i want to launch it from a base on my plane then it drops.

or do i put a script that creates it?
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
07-29-2006 08:13
also i want want it to fall then float not do 2 seperate things
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
07-29-2006 08:16
also if it is the same object if you set it as physical it will fall but if you set it as non physical it wont but i don't know how to script so it changes them
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
07-30-2006 00:30
Provide full scripts, sure for a reasonable fee, and a complete spec. Although you should be asking in products wanted not here.

Scripting tips gives people the chance to ask for help with their scripting problems, and advice on how to script better. Sometimes that results in full scripts, sometimes not.

The functions you're after are llSetStatus() to toggle physical on and off, using the STATUS_PHYSICS and TRUE and FALSE parameters.

CODE
vector pos=llGetPos();
float height = pos.z;


will let you get the object's current height. Something like a fast timer - llSetTimerEvent(0.05) - say, and then

CODE
timer()
{
float water = llWater(ZERO_VECTOR);
if(height<water)
{
llSetTimerEvent(0.0);
llSetStatus(STATUS_PHYSICS, FALSE);
pos = llGetPos();
pos.z = water;
llSetPos(pos);
}
}


will let you splash down and then bob back up (approximately) to the surface. Fast timers are heavy on the sim, but this one won't be on for that long, so it's not too dire. NB, I'd declare the float water as a global and grab it up in an on_rez event or similar, since it's never going to change, so you might as well grab it only the once.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
07-30-2006 02:30
script is a little bit wrong because it says sintax error on the top part that you have given me
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
07-30-2006 04:57
No, it's not wrong, it's an incomplete script fragment.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
stuarttank4 Stuart
Registered User
Join date: 8 Jul 2006
Posts: 21
07-30-2006 09:43
then please could you put the full script down
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
07-30-2006 22:56
From: stuarttank4 Stuart
then please could you put the full script down

If you want a full, working script, you can pay me or another scripter a fee to write it for you. I doubt that busy scripters will write you a full and complete script for free.