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


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playing Sounds Randomly through a whole map.
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#3
RE: Playing Sounds Randomly through a whole map.

Here is a simple example if you wanted a infinite loop and plays different random sounds at the players location.
Spoiler below!
int ASound;
      
void OnStart()
{
ASound = 0;

AddTimer("TimerName_RandomSounds_0", 10, "Timer_RandomSounds_0");
}
void Intro()
{

}
void OnEnter()
{

}
//******************************************************************************************************
void Timer_RandomSounds_0(string &in asTimer)
{
ASound = RandFloat(1, 3);

if(ASound == 1)
{  
  PlaySoundAtEntity("Sound 1", "ExampleSound1.snt", "Player", 2, true);
}

if(ASound == 2)
{  
  PlaySoundAtEntity("Sound 2", "ExampleSound2.snt", "Player", 2, true);
}

if(ASound == 3)
{  
  PlaySoundAtEntity("Sound 2", "ExampleSound3.snt", "Player", 2, true);
}

AddTimer("TimerName_RandomSounds_0", RandFloat(5, 10);,  "Timer_RandomSounds_0");
}

(This post was last modified: 03-01-2013, 09:04 PM by Rapture.)
03-01-2013, 09:04 PM
Find


Messages In This Thread
RE: Playing Sounds Randomly through a whole map. - by Rapture - 03-01-2013, 09:04 PM



Users browsing this thread: 1 Guest(s)