Doom2 Chaingun SFX Replacement?

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
AmberOnline
Posts: 8
Joined: Fri Apr 30, 2021 12:24 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Earth
Contact:

Doom2 Chaingun SFX Replacement?

Post by AmberOnline »

Heya! So, I'm making a WAD and I wanted to replace the Chaingun sound specifically. I already replaced the pistol SFX but I would like to replace the chaingun SFX to a different one.
Yes, I am well aware I need a DECORATE script to do that, I have made multiple different weapons before. But, I have not replaced the SFX. I have already made a .ogg for the sound file, and specified it in SNDINFO, but I cannot find a way to replace the Chaingun SFX. This is what my SNDINFO looks like; "weapon/chaingunfire CGUNFIRE" and this is what my DECORATE file looks like for my previous weapon, I want to modify this in the chaingun files. "CTRL F 0 A_Playsound("weapon/firecontrol",CHAN_WEAPON, 0.6)" Is that possible?
Ac!d
Posts: 348
Joined: Tue Apr 02, 2019 5:13 am

Re: Doom2 Chaingun SFX Replacement?

Post by Ac!d »

I'm not sure if I correctly understand your request, but here's my suggestions :

Code: Select all

// SNDINFO

weapons/pistol			dspistol

weapons/chngun			dspistol // replace "dspistol" with the name of your custom sound.
$limit weapons/chngun  0
Look also for SNDINFO and A_PlaySound and/or A_StartSound
User avatar
AmberOnline
Posts: 8
Joined: Fri Apr 30, 2021 12:24 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Earth
Contact:

Re: Doom2 Chaingun SFX Replacement?

Post by AmberOnline »

Hello again, I tried adding that to my SNDINFO but it didn't work. This is what i want to do but for the chaingun.

Code: Select all

		ControlFire:
		CTRL F 0 A_Playsound("weapon/firecontrol",CHAN_WEAPON, 0.6) // this is what i would like to change
		CTRL F 0 A_Recoil(15)
		CTRL F 5 A_FireCustomMissile("IncendiaryRocket",0,2,0,-8)
		CTRL E 5
		CTRL E 0 A_Refire("ControlFire")
		Goto Ready
In Doom 2 there is no SNDINFO. (to my knowledge that is) How would I do that?
Along with this, I would like to modify the fire speed. I did it once in a DEHACKED patch around 2 years ago but I don't remember how. Thank you and have a nice day/night/evening/whatever time it is for you as of reading this.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Doom2 Chaingun SFX Replacement?

Post by Jarewill »

You have to replace "weapon/firecontrol" with "weapon/chaingunfire", as that's what you specified in the SNDINFO.
Doom 2 doesn't have a SNDINFO, because it's a GZDoom addition and it's located in gzdoom.pk3.
To modify fire speed, you have to replace the number "CTRL F 5" with a lower number to increase it and a higher number to decrease it.
In my calculations 1 is 2100RPM, 2 is 1050RPM, 3 is 700RPM and 5 is 525RPM, but they might be wrong.

I frankly don't quite understand the problem here, so it might be helpful to upload the mod file here so we can take a look at it.
User avatar
AmberOnline
Posts: 8
Joined: Fri Apr 30, 2021 12:24 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Earth
Contact:

Re: Doom2 Chaingun SFX Replacement?

Post by AmberOnline »

Here, ill upload a quick Google Drive link to the mod file. The reason the size is so big is because I added custom music, but here's the link.
https://drive.google.com/file/d/109UXiy ... sp=sharing
A couple things to know:
1. I am pretty bad at coding (I'm barely even used to Ultimate Doom Builder due to me switching versions left and right) and Slade 3 definitely isn't my thing, but that's why ZDoom tutorials exist.
2. I don't want to modify my pre-existing DECORATE lumps. I would like to create a new batch of code to change the chaingun. All the sounds are in the game and specified in SNDINFO but the problem is I have no clue what code to write. Do I make the same code as I previously did in my custom weapon? Or do I copy-paste that code and replace the weapon name with the chaingun's?
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Doom2 Chaingun SFX Replacement?

Post by ramon.dexter »

So, the easiest way is to find out how are the sounds you want to replace named, and just name your sound file the same as the stock. BAM! You're done.
More specific way is through SNDINFO. You really don't need any coding for it, you just have to understand how sound definition in sndinfo works.
And SNDINFO is quite easy to understand.

So, loook here, part of my sndinfo:

Code: Select all

sounds/eat			CHEWSND
"sounds/eat" is just how engine will recognize the sound. So, everytime you want to use this sound anywhere, you put in "sounds/eat".

"CHEWSND" is the name of the sound file in the wad/pk3.

Anything else? Just forget that you are bad at coding. Everybody was bad when he was starting. Thats completely normal and usual.
User avatar
AmberOnline
Posts: 8
Joined: Fri Apr 30, 2021 12:24 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Earth
Contact:

Re: Doom2 Chaingun SFX Replacement?

Post by AmberOnline »

I have an issue with that first thing actually, I already replaced DSPISTOL for the pistol fire sound. Also "Everybody was bad when he was starting" I don't understand really who "he" is as I'm not a guy.
Anyway, I already did that. The thing I need to do is change the speed of the frames on the chaingun, which isn't that important to me, but my main goal is to replace the fire sound so this is what I need to do.
I need to find where the Chaingun sounds are specified and replace that sound with my own custom sound, that's all i need to do but I don't know where it is located.

Update: I figured out how to increase the fire speed by going into the DEHACKED patch in WhackEd 4 and modifying the chaingun fire state and light state to increase or decrease the speed.
User avatar
AmberOnline
Posts: 8
Joined: Fri Apr 30, 2021 12:24 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Earth
Contact:

Re: Doom2 Chaingun SFX Replacement?

Post by AmberOnline »

If anyone is having an issue with the same thing, I found a fix.
https://zdoom.org/wiki/Classes:Chaingun
Just modify the code in A_FireCGun so "A_PlaySound" is set to your custom sound.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Doom2 Chaingun SFX Replacement?

Post by wildweasel »

A_FireCGun already uses its own unique SNDINFO entry. It's just that this SNDINFO entry, by default, points at DSPISTOL:

Code: Select all

weapons/chngun dspistol

You need only include a SNDINFO of your own that defines it with the sound lump of your choice. No need to redefine the function entirely.
Post Reply

Return to “Scripting”