Rapture
Posting Freak
Posts: 1,078
Threads: 79
Joined: May 2011
Reputation:
30
|
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 |
|