Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

flight enhancement simple script help

Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
10-29-2007 19:55
so i'm trying to write a script that keeps you from falling down above 80m off the ground... but it isn't working. for some reason I set the llOwnerSay to confirm the distance from the ground and all it returns is 25.7... blah blah blah. no matter how high or low I am. wtf is wrong? :)
From: someone

default
{
on_rez(integer sp)
{
llResetScript();
}
state_entry()
{
llSetTimerEvent(.5);
}
timer()
{
float grounddist = llGround(ZERO_VECTOR);
llOwnerSay((string)grounddist);
if ( grounddist > 80 )
{
llApplyImpulse(llGetMass()*<0,0,10>,FALSE);
}
}
}

_____________________
From: someone

Don't worry, Aniam is here!
- Noob
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
10-29-2007 20:08
llGround returns the z axis of the ground, not your object

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetPos
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
10-30-2007 01:36
Instead of re-inventing the wheel I'd suggest you go and get yourself a thing called "flight feather".

Should be a freebie toy that does exactly what you want.
Chas Connolly
Registered User
Join date: 24 Jan 2007
Posts: 1,433
10-30-2007 03:09
Or the flight band - this also allows you to fly in no-fly zones, not that I would do such a thing. PM me if you want one and I'll send one over when I'm next online.
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
10-30-2007 06:39
I highly recommend the flighfeather. It is now up to version 1.4 and offers a menu control system for setting the options you want. The script that powers it is Cyberflight 1.4 which is open source so can be used in any of your projects. It is also well commented so you get a good understanding of what it's doing.
_____________________
Tread softly upon the Earth for you walk on my face.
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
10-30-2007 06:40
Try working out your own script, then compare it to those open source scripts once you think it's working how you like. WAY TO ENCOURAGE CREATIVITY, GUYS. :(
_____________________
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
10-30-2007 09:25
To add za little detail to what Osgeld said.

llGround() is the height of the ground itself.

llGetPos is the position of the object containing the script, or the avatar if it is attached (I think).

llVecDist( llGround( <0,0,0> ), llGetPos() ) would be the height above the ground.
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
10-30-2007 15:51
Thanks for the recommendations to the flight enhancers, but the whole deal is that I learn to write that sort of script myself =p

Lee, wouldn't llVecDist(llGround(<0,0,0>;) , llGetPos()); not compile since llGround is a FLOAT not a VECTOR, and llVecDist finds the distance between vectors?
_____________________
From: someone

Don't worry, Aniam is here!
- Noob
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-30-2007 16:10
Keep on re-inventing the feather Aniam. Fresh perspective is always good.

I use ground like this:

CODE

default
{
touch_start(integer total_number)
{
vector pos = llGetPos();
float ground = llGround(ZERO_VECTOR);
if(pos.z > (ground + 50))
{
}
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum