Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request Level editor sounds tutorial
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Level editor sounds tutorial

For your random soundscape, use a simple switch function. In your OnStart() put this:

AddTimer("soundscape_start", RandInt(10,20), "SoundScape");

Add any number of areas around your map and index them, meaning name them soundarea_1, soundarea_2, soundarea_3, etc. Now you create your SoundScape function.

void SoundScape(string &in asTimer)
{
    switch(RandInt(1,4)) {
        case 1:
            PlaySoundAtEntity("", "soundfile1.snt", "soundarea_"+RandInt(1,10), 0, false);
        break;
        case 2:
            PlaySoundAtEntity("", "soundfile2.snt", "soundarea_"+RandInt(1,10), 0, false);
        break;
        case 3:
            PlaySoundAtEntity("", "soundfile3.snt", "soundarea_"+RandInt(1,10), 0, false);
        break;
        case 4:
            PlaySoundAtEntity("", "soundfile4.snt", "soundarea_"+RandInt(1,10), 0, false);
        break;
    }
    AddTimer("soundscape_reloop", RandInt(10,20), "SoundScape");
}

//change the RandInt(1,10) to however many areas you have. If you have 10 areas make it 1,10; if you have 20 make it 1,20 etc. You can change the frequency of the sounds by altering the timer duration under each case.

06-16-2011, 10:28 AM
Find


Messages In This Thread
Level editor sounds tutorial - by Doctorcheese - 06-16-2011, 07:18 AM
RE: Level editor sounds tutorial - by palistov - 06-16-2011, 10:28 AM



Users browsing this thread: 1 Guest(s)