Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Control of Particle Emission Upon Sit/Unsit

Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
08-28-2007 08:10
Hi All, I am looking for info on the commands that will start particles emitting when an AV sits on an object then stop the particles when the AV unsits. I am familiar with "touch_start" using if/else to start and stop particle emissions ( ParticleStart()/ParticleSystem([]) ). Looking for something like that for AV sitting. If someone can point me in the right direction, I would greatly appreciate it!
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
08-28-2007 08:17
The event that's triggered when an AV sits/unsits on an object is «changed»...

Here's the wiki-link:

http://www.lslwiki.net/lslwiki/wakka.php?wakka=changed
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
08-28-2007 08:25
Take a look at any of the sit scripts around.
The basic process is
1) Set a sit target
llSitTarget( Target, r );
2) A changed event is triggered with an av sits
changed(integer change)
{
//this checks to see if anyone has sat/gotten off the stand
if (change & CHANGED_LINK)
{

agent = llAvatarOnSitTarget();

//insert call to particles here

if ( mkLoungingAgentKey == NULL_KEY && agent != NULL_KEY )
{

//changed user
//cache new user key and request their permissions
mkLoungingAgentKey = agent;


}
else if ( mkLoungingAgentKey != NULL_KEY && agent == NULL_KEY)

//user is getting up
{

//stop particles

}


II) An alternate method that I use is llGetNumberOfPrims(). Get the number on_rez and if the number increases I assume it's a because an av sat on it and if the number decreases I assume a av got up. (It helps with teleporting av's who didn't stand first).
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-28-2007 08:58
From: Destiny Niles
An alternate method that I use is llGetNumberOfPrims(). Get the number on_rez and if the number increases I assume it's a because an av sat on it and if the number decreases I assume a av got up. (It helps with teleporting av's who didn't stand first).
That's very interesting. But I'm not sure why it's different--wouldn't a CHANGED_LINK event get triggered on TP? Or, if that's the event where the decreased link count is found, does llAvatarOnSitTarget() not always get nulled when the agent TPs?
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
08-28-2007 09:29
From: Qie Niangao
That's very interesting. But I'm not sure why it's different--wouldn't a CHANGED_LINK event get triggered on TP? Or, if that's the event where the decreased link count is found, does llAvatarOnSitTarget() not always get nulled when the agent TPs?

I first start using the prim count when I wanted a function to start when two avs sat on a multiprim object and stop if one of them left (either stood up/tp/crashed). The regular sit checking functions did not work (or I didn't understand it properly).
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-28-2007 11:06
From: Destiny Niles
I first start using the prim count when I wanted a function to start when two avs sat on a multiprim object and stop if one of them left (either stood up/tp/crashed). The regular sit checking functions did not work (or I didn't understand it properly).
Thanks. That makes perfect sense: llAvatarOnSitTarget won't work if there's no sit target, and there can't be if more than one AV is to sit on the prim. Now that I think about it, I've used something similar where the script in another linked prim--not the one with a sit target--needed to know if somebody sat or stood. (As I recall, I walked the linkset looking for "prims" for which llGetAgentInfo looked like an agent, but that's the difficult way to do it. ;) )
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
Thanks for the Help!
08-28-2007 14:02
Thanks Destiny and Haruki! I even went a step further and included and animation. So much to learn... lol :-)