Untitled

 avatar
unknown
plain_text
2 years ago
998 B
5
Indexable
// CATEGORY:Sound
// DESCRIPTION:Plays one of 3 random sounds when collided with
// ARCHIVED BY:Ferd Frederix

string sound1 = "female wake up 1";
string sound2 = "female wake up 2";
string sound3 = "female wake up 3";
string sound4 = "female wake up 4";
string sound5 = "female wake up 5";
string sound6 = "snore";
string sound7 = "snore2";
string sound8 = "snore3";

list sounds;

default
{
    state_entry()
    {
        // initialize a list with all the sounds available
        sounds = [sound1, sound2, sound3, sound4, sound5, sound6, sound7, sound8];
    }

    collision_start(integer chargeval)
    {
       // randomize the list 
       list shuffled = llListRandomize(sounds, 1);
       
       // the list is randomized at every collision. 
       // so we cant predict what will be the 1st element (element at pos 0)
       string sound_choosed = llList2String(shuffled, 0);
       llSay (0, "play this song: " + sound_choosed);
    }
}
// END //

Editor is loading...