Frictional Games Forum (read-only)
sound loop script help - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: sound loop script help (/thread-12262.html)



sound loop script help - Mine Turtle - 01-02-2012

yo, umm. im making a script, where you wake up (taken care of) but then you are freezing, and have to find clothes. now, i need to make a sound loop, and every time the sound is gonna be played, the script has to choose randomly between a selection of 6 sounds to be played. the loop has to play the sounds randomly every 2 seconds

(ive looked in the wiki, but im very new to scripting, and a friend of mine told me this was a very complicated thing to do)

thanks in advance! ^^



RE: sound loop script help - Statyk - 01-02-2012

Sounds can be told to loop and chosen randomly through the .snt... For example, here is one from a breaking glass bottle:

//___________________________________


<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="break_glass_bottle1" />
<Sound File="break_glass_bottle2" />
<Sound File="break_glass_bottle3" />
<Sound File="break_glass_bottle4" />
<Sound File="break_glass_bottle5" />
</Main>
</SOUNDS>
<PROPERTIES Volume="1" MinDistance="4" MaxDistance="20" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="True" Blockable="True" BlockVolumeMul="0.5" Priority="0" />
</SOUNDENTITY>


//___________________________________

As you can see, the different sound files are stacked in the <Main> section. The snt will choose any of the 5 listed randomly on its own. You just have to tell the snt what sounds to look for (.ogg), as well choose between loop (bolded), true or false. (warning: setting it to TRUE will have the sound play repeatedly, with no pause in between. I suggest setting it to false and have it loop through a scripted timer)