Jump to content
  • 0

How Do I Add Custom SFX?


Ghost_Ellis

Question

Can anyone explain how to add custom sfx, that can be called by acs scripts?

I have some button textures that don't play sound when used, however, I want to be able to script each instance of these buttons to play sounds I made, but I cant seem to make mine play unless I use Local Set Music, but that one loops, and I don't want that. Also an explanation of the play sound vs playactorsound scripts and what needs to be put in those would be really helpful.

image.png.88f11b58ad382fbb0e33657351c2c06a.png

image.png.92d5db22864a4e8e0d1bfb1cfebdbf9d.png

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 0

Usually, when you try to play a sound you have to use the logical name and not the lump name, so in your case:

PlaySound(34, "world/dooropen");

 

The use of "world" is pointless in this situation (unless you're just using it to better organize your file) because you're not defining it as an ambient sound. 

Share this post


Link to post
  • 0
Posted (edited)
14 hours ago, Ghost_Ellis said:

I have some button textures that don't play sound when used

 

You can use ANIMDEFS to directly attach sounds to particular switch button textures: 

A simple toggle switch:

switch SW_1_UP on sound Switch1 pic SW_1_DN tics 0
switch SW_1_DN off sound Switch2 pic SW_1_UP tics 0

A switch that plays an animation when it is toggled, but is filtered to only be active if the game is 'Doom':

switch doom sw1nj15 
on sound switches/lever2 
pic sw1nj15b tics 8 
pic sw1nj15c tics 8 
pic sw2nj15 tics 8 

off sound switches/lever2 
pic sw1nj15c tics 8 
pic sw1nj15b tics 8 
pic sw1nj15 tics 0

Use SNDINFO to define the sound names. Or you can replace every switch sound in (a Doom) game by replacing the Doom original sounds:

 

DSSWTCHN (on)
DSSWTCHX (off)

Edited by redEYE
turned html format off from code sample

Share this post


Link to post
  • 0
On 4/27/2024 at 10:44 PM, Ghost_Ellis said:

an explanation of the play sound vs playactorsound scripts and what needs to be put in those would be really helpful.

 

I want to call tgem w acs scripts

 

The SNDINFO definition can be deceiving. So: https://zdoom.org/wiki/PlaySound

PlaySound (int tid, str sound);

If the tid in script is 0, the sound will be played from the activator itself. If the player's or a monsters tid is 0 and if the sound is long enough it'll travel with you or the monster and keep playing even if you teleport miles away from the switch.

 

If the tid in script is not 0, add a mapspot (9001/9013) with the tid next to your switch button and it'll be the origin of the sound.

 

If the sound name is WOOT or WOOT.wav/WOOT.mp3/... SNDINFO should have:

yippiee/ki-yay    WOOT

And ACS script should have :

PlaySound (12, "yippiee/ki-yay");

 

Share this post


Link to post
  • 0
On 4/29/2024 at 10:57 AM, redEYE said:

What do I need to put in Decorate? Zscript isnt working for me, idky. But I cant find how to define a sfx actor on the gzdoom guide page

 

Share this post


Link to post
  • 0
On 4/30/2024 at 8:47 PM, Ghost_Ellis said:

What do I need to put in Decorate? Zscript isnt working for me, idky. But I cant find how to define a sfx actor on the gzdoom guide page

 

If the only target is to play sounds in one location with ACS script you won't need a new zscript or decorate thing for that. You can use a Map spot thing. It's a native (G)ZDoom actor mostly used for spawning things: 

 

nYJkSyr.jpg

 

You'll find it straight from UDB/GZDB/DB by it's number 9001. Just make sure it has a correct tag. The ZDoom wiki talks about "TID" (= Thing ID). In UDB/GZDB/DB it's called a "Tag". :)

 

RlBQSRt.jpg

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...