|
Fenix Eldritch
Mostly harmless
Join date: 30 Jan 2005
Posts: 201
|
07-09-2006 19:49
I'm having problems with avatars getting caught in my build when they stand up from a chair. I'm currently trying to use llPushObject to give them a bump backwards, but it doesn't seem to be working at all. I'm really new to scripting, but could anyone tell me what's wrong with this?
Here's the code I'm using - it's basically cut out of the common vehicle scripts that eject non-owners from dirving it.
|
|
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
|
07-10-2006 01:57
ummm - here is your code default { state_entry() { llSetSitText("Sit"); llSitTarget(<0.1, 0.0, -1.0>, ZERO_ROTATION); } changed(integer change) { key agent = llAvatarOnSitTarget() ; if ((change & CHANGED_LINK) && llAvatarOnSitTarget() == NULL_KEY) { llPushObject(agent, <-10,0,0>, ZERO_VECTOR, FALSE); } } } the problem is... your if says if there has been a seating event, and the person now sitting is NOBODY, then push NOBODY backwards. when an agent stands up, the llAvatarOnSitTarget() call returns NULL_KEY, which you are checking for. the fix would bo to store the key of the sitter, earlier.... something like... key sitter = NULL_KEY;
default { state_entry() { llSetSitText("Sit"); llSitTarget(<0.1, 0.0, -1.0>, ZERO_ROTATION); } changed(integer change) { key agent = llAvatarOnSitTarget() ; if (change & CHANGED_LINK) { if (agent == NULL_KEY) { llPushObject(sitter, <-10,0,0>, ZERO_VECTOR, FALSE); sitter = NULL_KEY; } else { sitter = agent; } } } }
|
|
Fenix Eldritch
Mostly harmless
Join date: 30 Jan 2005
Posts: 201
|
07-10-2006 20:14
Ah.. that would explain a few things.... Thanks for responding Bitzer!
I did some adjusting, so now I'm positive that the script saves the key of the avatar who just sat on it - llWhisper commands confirm it when I stand up. However the push still isn't firing. Does it matter that the chair I'm using is one of those bucket seats? Basically a sphere hollowed out and cut in such a way as to form a crescent shape in which the avatar sits. Will the push command be able to force the avatar through the “back” of the prim/chair?
|
|
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
|
07-10-2006 20:43
put it in a cube to see 
|
|
Kokiri Saarinen
Quoted for truth
Join date: 7 Jan 2006
Posts: 44
|
07-11-2006 12:46
The wierd sit thing your noticing is that part of the avatar is "inside" the chair with the sit target you have set, which can cause some strange effects when you try to stand. If pushing is giving you problems, perhaps you just need to make the chair phantom for 5 seconds or so, and give the user time to walk away (or try pushing when the chair is phantom  ) -Kokiri
|