Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Constants
- string SOUND_UUID = "77eee9a2-edc7-dd16-8dd6-25ec286c1a00";
- float DETECTION_RANGE = 1.5; // in meters
- // Declare variables
- integer soundHandle;
- detached(key detached)
- {
- // Make sure the script only runs when detached from an avatar
- if (detached == llGetOwner())
- {
- // Hide the object when detached
- llSetAlpha(0.0, ALL_SIDES);
- }
- }
- default
- {
- state_entry()
- {
- // Start the looping sound when the object is attached
- llLoopSound(SOUND_UUID, 0.2); // Loop the sound with a volume of 1.0
- llSetSoundQueueing(TRUE); // Allow the sound to play even if not heard
- llSetSoundRadius(DETECTION_RANGE); // Set the sound radius for detection
- // Hide the object by making it transparent when attached
- llSetAlpha(0.0, ALL_SIDES);
- }
- attach(key attached)
- {
- // Make sure the script only runs when attached to an avatar
- if (attached == llGetOwner())
- {
- // Show the object again when attached
- llSetAlpha(1.0, ALL_SIDES);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement