Nicholas Zeritonga
Registered User
Join date: 22 Jan 2010
Posts: 5
|
01-29-2010 17:31
Hi. So I have created my own chair (big achievement for me  ) Now, I have to change the sitting script so that it sits better. At the same time, I also wanted to play a song when the avatar sits. This is what I have default { state_entry() { llSitTarget(<0,0,1>, ZERO_ROTATION); llSetSitText("SIT!"  ; } touch_start(integer total_number) { llLoopSound(llGetInventoryName(INVENTORY_SOUND,0),1); } } I have a couple of problems so far. Firstly, with the above, the avatar can sit anywhere on the chair, not just on the bum piece. Is there anyway of sorting this out? My second issue is I did not know how to play a sound on the avata sitting down, just when they touch it. How do I get it to play when they sit? And lastly, with the sound I want played, do I just place it into my inventory? And is the above code ok to look for this sound or should i specifically say "mySound.mpg"? Thanks for any advice cheers
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-29-2010 19:06
the sound goes in prim inventory (that script plays the alphabetically sorted first sound in the prims inventory.)
to test for when an avatar actually is sitting in the expected spot, used the changed event (check for CHANGED_LINK) and then test llAvatarOnSitTarget (which incidentally will tell you exactly who is on the sit target)
you can't stop people from right clicking and choosing a specific prim to sit on (which would keep the music from playing in the above suggestion) but you can check to see if you've got more links in your prim set (avatars count as links when sitting) and unsit any that aren't the avatar reported by llAvatarOnSitTarget (you use llGetLinkKey, on link numbers above your chairs prim count, and use unsit on any that don't match your sitter)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|