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
Playing sequences of sounds
iTIMMEH Offline
Junior Member

Posts: 40
Threads: 2
Joined: Sep 2010
Reputation: 0
#1
Playing sequences of sounds

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
09-16-2010, 12:01 AM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#2
RE: Playing sequences of sounds

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:

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:
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.
09-16-2010, 05:58 AM
Website Find
iTIMMEH Offline
Junior Member

Posts: 40
Threads: 2
Joined: Sep 2010
Reputation: 0
#3
RE: Playing sequences of sounds

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!
09-16-2010, 09:22 AM
Find




Users browsing this thread: 1 Guest(s)