Page 1 of 1

making new sounds

PostPosted: Thu Jul 29, 2021 2:30 pm
by TIIKKETMASTER
PAIN G 6
PAIN G 7 A_Pain

is there any way i can create my own A_Pain to play more sounds for monsters?

an example would be me importing a sound file and creating something like "A_Pain2" then connecting them somehow.
i use Slade 3 if that makes any difference to answers

Re: making new sounds

PostPosted: Thu Jul 29, 2021 2:57 pm
by Jarewill
There's A_StartSound you can use with any SNDINFO-defined sounds.

Re: making new sounds

PostPosted: Thu Jul 29, 2021 2:58 pm
by Gez
Well, sounds in ZDoom are organized on a two-step scheme, with a "logical" identifier used in code that is then resolved to an actual sound resource. Read SNDINFO for details.

Then there's another layer of indirection when you use functions like A_Pain. Each actor has a certain number of sound properties, so in this case when A_Pain is called, what happens is a three-step process:
  1. Look for the monster's PainSound
  2. Resolve this PainSound to an actual resource
  3. Finally play the sound resource

The advantage of this method is that it already allows to easily expand the number of sounds used in the game. Notably, in SNDINFO you can make a logical sound that will actually be several different sounds, with one being randomly chosen. This is used in Doom, ever notice the zombies and imps don't always make the same noises?


Now if you want more control over the logic used to choose which sound to play, besides randomness, then you can actually define new functions, using ZScript. But I stress it's not necessary if you just want more sounds to play, SNDINFO is sufficient for that.