Jump to content

How Does Playing Sound Files work?


pRoJect45yt

Recommended Posts

I'm trying to play sound files when the player presses something or walks over a linedef. I've tried using the wiki and seeing what other people have done in their maps but I'm just not getting it. If someone could help me understand how the play sound function works, I would really appreciate it!

 

(and if you could throw in a lesson on scripting that sound to play when a door opens (poly object) then that would be a ton of help too)

Screenshot 2024-02-22 154549.png

Edited by pRoJect45yt

Share this post


Link to post

Hope this helps!

As https://www.youtube.com/user/chubzdoomer ChubzDoomer tells us when learning scripting always keep this site up as a reference if you dont already!

https://zdoom.org/wiki/Main_Page

 

I havent had alot of success with that PlaySound function myself either XD idk what i was doing wrong with it. ActivatorSound has worked almost everytime for me.

 

If youre just trying to call sounds from the original game. check this list out and call them like they did.

https://github.com/ZDoom/gzdoom/blob/master/wadsrc/static/filter/game-doomchex/sndinfo.txt

 

this worked for me by making a linedef call a function on player use. It should work regardless of the action that calls the script? but im just learning all this myself

EXAMPLE

script "floorlowerswitch01"(void)
{
    setlinetexture(1,SIDE_FRONT,TEXTURE_BOTTOM, "SW2SKIN");
    Floor_LowerByValue (1,6,24);

    //this is a classic sound as called from the link above.
    ActivatorSound("imp/pain", 100);

}

 

For custom sounds

things like this have worked for me. 

but this requires you to go and add a SNDINFO to your WAD or PK3. not a ton of work, but useful knowledge. 

this one worked for me because i added it as an ambient sound, then called it from there. 

 

Spoiler

Capture.JPG.3b77829cb7d98a06d08a02718b1bdec8.JPG

 

EXAMPLE

//basic polyobj door open sequence.

script "floor_elevator_big"(void)
{
    setlinetexture(0, SIDE_FRONT,TEXTURE_BOTTOM, "SW2COMM");
    Polyobj_DoorSlide (5,4,128,48,105 );
    Polyobj_DoorSlide (6,4,0,48,105);

    // I call 2 sounds here, one ingame, and one custom.
    ActivatorSound("switches/normbutn", 15);
    LocalAmbientSound("ELEVDING",127);

}

 

EXAMPLE

//linedef player walk over, plays dog barking custom sound. 

script "dogbark_snd"(void)
{
    LocalAmbientSound("DOGBARK",127);
}

 

idk if other modders have used this site, but ive been playing with the sounds from here in my current map.
https://pixabay.com/sound-effects/

make sure to save the links of the files you download and convert and credit them in your WAD or PK3 as always :D

 

The videos below will show you how thats done in detail. 

Also https://www.youtube.com/@signaltome LazyGamer on youtube has some good tutorials as well. 


Most likely going to have to get SLADE and follow some tutorials 

 

Heres a good one

Spoiler

 

 

 

 

Edited by Chameeleoh

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
Reply to this topic...

×   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...