Advertisement
Strixursus

TreeHouse Sound Emitter

Oct 14th, 2018
1,075
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. list daySounds = ["wren", "thrush", "blackbird", "robin_w", "Hsparrow", "Bluetit"];
  2. list nightSounds = ["Tawny Owl", "shortear owl","42917__inchadney__Owl"];
  3.  
  4. list nightAmbient = ["wind"];
  5.  
  6. default {
  7.     state_entry() {
  8.         llStopSound();
  9.         llSetTimerEvent(0.5);
  10.     }
  11.  
  12.     timer() {
  13.         vector time = llGetSunDirection();
  14.         list myList;
  15.         float density = 0.9;
  16.  
  17.         if (time.z > 0.0) {
  18.             myList = llListRandomize(daySounds, 1);
  19.         } else {
  20.             myList = llListRandomize(nightSounds, 1);
  21.             density = 0.98;
  22.            
  23.             // Ambient nighttime sound
  24.             if (llFrand(1.0) > 0.85) {
  25.                 llStopSound();
  26.             } else {
  27.                 llLoopSound(llList2String(nightAmbient, 0), 1.0);
  28.             }
  29.         }
  30.        
  31.         if (llFrand(1.0) > density) {
  32.             llTriggerSound(llList2String(myList, 0), 1.0);
  33.         }
  34.     }
  35. }
Advertisement
RAW Paste Data Copied
Advertisement