Frictional Games Forum (read-only)
Playing sequences of sounds - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Playing sequences of sounds (/thread-4406.html)



Playing sequences of sounds - iTIMMEH - 09-16-2010

I want to have a sequence of sounds play (let's say, for example, hammering on a door) when the player steps into a script area. There are SNT files with sequences of sound files for this type of thing but I have no idea how to use them. So far I've managed to get one lonely bang to play using PlaySoundAtEntity but that won't quite do the job! All suggestions gratefully accepted Tongue


RE: Playing sequences of sounds - jens - 09-16-2010

First, the snt files do not have a sequence of sound files, they have a "pool of sounds" to randomly choose from. So if there is listed step_rock1, step_rock2, step_rock3 it means it will randomly pick one of those each time it plays the sound, not that it will play all three in sequence each time it plays the snt.

To play a sequence of sounds you should use a timer that calls itself for as many times as you like a sound to play. Or the easiest to begin with is making several timers, and name them as the sound you like to play, so for example in the collide with the area function:

Code:
AddTimer("swing_arm.snt", 0.5f, "TimerSoundSequence");
AddTimer("hammer_impact.snt", 1.0f, "TimerSoundSequence");
AddTimer("break_wall.snt", 1.2f, "TimerSoundSequence");

So this will create timers with the names of sound files (the .snt) and they call a function TimerSoundSequence at 0.5 seconds, 1 seconds and 1.2 seconds.

then add a new timer function like this:
Code:
void TimerSoundSequence(string &in asTimer)
{
    PlaySoundAtEntity("mysound", asTimer, "AreaSFX", 0, false);
}

And as the PlaySoundAtEntity says to play asTimer it means that will be the sound file for each timer, and it plays the sound at the area called AreaSFX.


RE: Playing sequences of sounds - iTIMMEH - 09-16-2010

Thanks a lot Jens! This is all quite different from the limited coding I've done i the past, looks like I was jumpping to the wrong conclusion.

Helping out the newbie modders must be almost as much work as making the actual game at the moment!