Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Particles to appear at height

Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
11-29-2008 09:48
Hi

I have made a rudimentary helicopter with some scripts i have found about the forums and slwiki

however i am struggling with getting the particles to appear at a certain height

like when you come into land say about 10 meters from the ground i would like dusty effect - i can do the particles part but they are on all the time i want them just from ground level or sea level until say 10 metres up then stop until i get to land again and they reappear - thats it really

i have got bogged down with the height code like i put the

llMessageLinked(LINK_ALL_CHILDREN, 0, "startdust", NULL_KEY);

and yeah it starts but i want some sort of more than less than height command in with that

like

if(height<15) ..... start particles
if(height>15) ... stop them - and thats about it really

the number 15 is meaningless and just used as an example in this instance ;) thanks 8)

any help would be appreciated

JJ
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
11-29-2008 10:22
Something like

vpos = llGetPos();
fgound = llGround(<0.0,0.0,0.0>;);

if((vpos.z - fground) < 15 && ison != TRUE) turnon();
else if((vpos.z - fground) > 15 && ison != FALSE) turnoff();


?
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
11-30-2008 01:12
dont know will try it later

turn on turn off will the message linked understand that do i put this in the particles script object or in the main vehicle script
Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
11-30-2008 03:29
nah says syntax error on

vpos

how would i implement this or similar into the particles or vehicle script
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
11-30-2008 06:17
This is what is called a "code snippet". it isn't complete enough to compile.

BTW, when you have a compile error, it might be a good idea to tell us what it is.

Anyway, in this case, I am guessing that you need to declare vpos to be of type vector. You'll probably need to declare fgound, too.
_____________________
So many monkeys, so little Shakespeare.
Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
11-30-2008 07:10
a basic particle script found almost anywhere in sl

if you use the message linked command 'start'

as above it will run particles but all the time - this is fine if its an engine but i want those same particles to trigger on and off based on their height

not based on the messagelinked

---------
vectors
integers

default
{
state_entry()
{
llParticleSystem([]);
}

link_message(integer sender_num, integer num, string str, key id)
{
if(str=="start";)
{
llParticleSystem([

...blah blah blah


PSYS_SRC_BURST_RADIUS, radius

]);
}
else if(str=="stop";)
{
llParticleSystem([]);
}


}
}
--------------

this runs well when the main script tells this to start

but no good for height

when the vehicle is over a certain height i want the particles to stop and start when below a certain height thats it really
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
11-30-2008 08:49
Yes, I was providing you only with a code snippet, showing you the portion of code you needed in order to make the whole thing happen. If you want an entire script, we can talk pricing. If you have a script that you're building and need to know where to put the snippet into it, paste that code here and I'll show you how to integrate it.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
11-30-2008 09:01
Well thats the bones of the script there

the blah and integer part is just particle info and not important

where would you place it on that

i dont think your snippet works even with a basic 'if height is .... say hello' world 'if height is lower say goodbye world' script

even with a few lines

lets put it like this

a basic hello world script

when the height of the object it is in is raised manually by dragging it to a 10 ft above sea level or ground level sea level is about 19 i think

the object says - hello world
when you drag it lower it says goodbye world

thats it - those snippets wont work with something as basic as that even dropping a physical object 20 ft

from that basic idea i can get all i need and adapt it

i am a newbie scripter and looking to learn - if i could afford to pay for it i wouldnt be here :)
Galena Qi
Registered User
Join date: 9 Sep 2006
Posts: 249
11-30-2008 09:25
Use a timer to check position at an interval (e.g., 0.5 sec), then trigger the particle effect when the (height < 15.

So the basic program sequence (not correct programming - add your own syntax) would be something like:

Define variables

Default

State entry()

llSetTimerEvent(0.5);


turnon()

llParticleSystem[ yadayada]

turnoff()

llParticleSystem[ ]

Timer()
vpos = llGetPos();
fground = llGround(<0.0,0.0,0.0>;);

if((vpos.z - fground) < 15 && ison != TRUE) turnon();
else if((vpos.z - fground) > 15 && ison != FALSE) turnoff();

The reason you aren't getting full solutions to your request is that the script you were using needs a lot of modification to work as you intend. There isn't much middle ground between giving pointers (which we're doing) and writing it for you (which some posters here will do but many won't). It isn't a matter of getting paid, but wanting you to learn scripting. Good luck on your script, and keep coming back if you get stuck.
Taff Nouvelle
Virtual Business Owners
Join date: 4 Sep 2006
Posts: 216
11-30-2008 09:34
default
{
state_entry()
{
}
touch_start(integer total_number)
{
vector vpos = llGetPos();
float fground = llGround(<0.0,0.0,0.0>;);
float Pos =(vpos.z - fground);
if (Pos >= 15)
{
llSay(0, "above";);
llSay(0, (string)Pos);
}
else
{
llSay(0, "below";);
llSay(0, (string)Pos);
}
}
}

that in a prim will show the position above ground when touched, and with the hints in the other posts should be enough to do what you need :-)
Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
11-30-2008 10:15
the one by taff works a bit

the problem is if you remove the touch start - for a vehicle - it doesnt keep checking the height so it only does it the once and then thats it

it needs to keep checking height all the time so when the vehicle falls below a certain height it triggers particles :)

and reset script just makes it go nuts with that swirling pattern so need another solution really \:)
Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
11-30-2008 10:46
Here is taffs with a timer

default {
state_entry() {
llSetTimerEvent(15.0); // generate a timer event every 1 second
}

timer() {
vector vpos = llGetPos();
float fground = llGround(<0.0,0.0,0.0>;);
float Pos =(vpos.z - fground);
if (Pos >= 15)
{
llSay(0, "above";);
llSay(0, (string)Pos);

}
else
{
llSay(0, "below";);
llSay(0, (string)Pos);

}
}}


seems to work - thanks for your help
Galena Qi
Registered User
Join date: 9 Sep 2006
Posts: 249
11-30-2008 11:36
Happy to help.

After you've got it working the way you want, take out the llSay lines. That will get rid of the swirlies. It's a good idea to use llOwnerSay instead of llSay for debugging, so everyone in the sim doesn't have to listen to your object. Also, you might want to add an onrez event to initialize your script.
Junglejim Jonson
Registered User
Join date: 4 Feb 2008
Posts: 52
12-25-2008 09:28
hehehe thanks for all your help so far

i notice that the particles also appear over land mass - this can be irritating as its a water effect over land - any terraformed land at any height will trigger them

when i just want them to appear on the water only

or ideally i would like to have a separate rule for land maybe with a different dust or something

the other problem is i can't turn them off on the water - they just keep playing all the time - when i try message linked commands they keep throwing back syntax errors - the only thing i can do is take the vehicle back then rerez it then they stop

anyone got any ideas on how i can fix these two issues

apart from that the height thing works fine :)
Vivito Volare
meddler
Join date: 10 Nov 2006
Posts: 41
12-30-2008 09:38
One idea might be to get the water height in the region(llWater), check the land elevation (llGround) under the copter, and if land elevation < water height, then activate particle.