Weapon firing sound plays twice - Decorate

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
Bael
Posts: 19
Joined: Sat Dec 02, 2017 3:15 pm

Weapon firing sound plays twice - Decorate

Post by Bael »

I need help to fix this problem I wanted to implement two bullet puffs, so I put two lines of A_FireBullets, one that shoots the bullet (with the spark puff) and another one that does not shoot (but make appear another bullet puff).

The problem is that the firing sound plays twice and i only want to play it once...any ideas on how to do fix it? here is the file if you want to check it out

File: http://www.mediafire.com/file/vf8v5wdbz ... kePuff.pk3
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Weapon firing sound plays twice - Decorate

Post by ramon.dexter »

You are using two iterations of a_firebullets, so it correctly plays the shooting sound twice.
Resolution is simple: spawn a invisible spawner, that will spawn the two types of puffs. That will allow you to use only one a_bulletattack.
Bael
Posts: 19
Joined: Sat Dec 02, 2017 3:15 pm

Re: Weapon firing sound plays twice - Decorate

Post by Bael »

ramon.dexter wrote:You are using two iterations of a_firebullets, so it correctly plays the shooting sound twice.
Resolution is simple: spawn a invisible spawner, that will spawn the two types of puffs. That will allow you to use only one a_bulletattack.
Could you show me how the lines would look?
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Weapon firing sound plays twice - Decorate

Post by ramon.dexter »

Simple.

Code: Select all

Spawn:
  TNT1 A 0 A_Spawnitemex("first puff")
  TNT1 A 0 A_spawnitemex("second puff")
  Stop
Spawn this in place of the puff and youre ok.

edit: Was writing from tablet, so short response.

You can spawn a "spawner" in place, where one spawn function is not enough.

Here is better example. Its zscript, but converting to decorate isnt that hard.

Code: Select all

class pistolCasingSpawner : GenericDebris
{
	Default
	{
		+NOINTERACTION
		
		Speed 15;
	}
	
	States
	{
	Spawn:
		TNT1 A 0;
		TNT1 A 1;
		TNT1 A 0 A_SpawnProjectile("Casing9mm", 0, 0, random(-100,-130),10, random(20,45));
		
		Stop;
	}
}
Also, it allows you to use some advanced spawn behaviour, like velocity, etc.
Post Reply

Return to “Scripting”