making new sounds

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

making new sounds

Postby TIIKKETMASTER » Thu Jul 29, 2021 2:30 pm

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
TIIKKETMASTER
 
Joined: 29 Jul 2021

Re: making new sounds

Postby Jarewill » Thu Jul 29, 2021 2:57 pm

There's A_StartSound you can use with any SNDINFO-defined sounds.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: making new sounds

Postby Gez » Thu Jul 29, 2021 2:58 pm

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.
Gez
 
 
 
Joined: 06 Jul 2007


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest