(SOLVED) AUDIO: Projectile sometimes just doesn't play audio properly.

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
CaptainNurbles
Posts: 280
Joined: Sat Jan 27, 2018 9:12 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: The Deepest Reaches of Space
Contact:

(SOLVED) AUDIO: Projectile sometimes just doesn't play audio properly.

Post by CaptainNurbles »

EDIT: Turns out I'm a fucking idiot and forgot to add the new explosion sounds to my SNDINFO lump. Ignore this.

Simple as. For the longest time the explosives in my mod would just sometimes not play, I suspected because of sound channel buggery.

Lately been editing the explosives so that they'd play three sounds: A loud boom for when you're close by, a moderately loud distant-sounding boom for when you're farther away, and a very distant boom that plays universally across the map. I've tried a few different combinations of code, different solutions to make it play all three and not clip anything out, but right now it's just baffling me why my explosion sounds aren't playing properly.

I have projectiles in ZScript and DECORATE, both have the same issues. I'll copy my 20mm shell down for example.

Code: Select all

class Rocklet20mm : FastProjectile
{
	Default
	{
	Decal "Scorch";
	Radius 9;
	Height 6;
	MissileHeight 8;
	Scale 0.5;
	Speed 120;
	DamageFunction (180*GetCVAR("SC_PlayerDamageDealt"));
	Projectile;
	ReactionTime 35;
	DamageType "Shaped";
	+RANDOMIZE
	+ZDOOMTRANS
	+NOEXTREMEDEATH
	-PIERCEARMOR
	}
	States
  {
	Spawn:
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.01*vel.x)/-35.0,-(0.01*vel.y)/-35.0,0+(0.01*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION); // Visual tracer so that you can more easily see incoming gunfire.
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.1*vel.x)/-35.0,-(0.1*vel.y)/-35.0,0+(0.1*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.2*vel.x)/-35.0,-(0.2*vel.y)/-35.0,0+(0.2*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.3*vel.x)/-35.0,-(0.3*vel.y)/-35.0,0+(0.3*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.4*vel.x)/-35.0,-(0.4*vel.y)/-35.0,0+(0.4*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.5*vel.x)/-35.0,-(0.5*vel.y)/-35.0,0+(0.5*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.6*vel.x)/-35.0,-(0.6*vel.y)/-35.0,0+(0.6*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.7*vel.x)/-35.0,-(0.7*vel.y)/-35.0,0+(0.7*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.8*vel.x)/-35.0,-(0.8*vel.y)/-35.0,0+(0.8*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(0.9*vel.x)/-35.0,-(0.9*vel.y)/-35.0,0+(0.9*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(1.0*vel.x)/-35.0,-(1.0*vel.y)/-35.0,0+(1.0*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(1.1*vel.x)/-35.0,-(1.1*vel.y)/-35.0,0+(1.1*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(1.2*vel.x)/-35.0,-(1.2*vel.y)/-35.0,0+(1.2*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(1.3*vel.x)/-35.0,-(1.3*vel.y)/-35.0,0+(1.3*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(1.4*vel.x)/-35.0,-(1.4*vel.y)/-35.0,0+(1.4*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 Bright A_SpawnItemEx("BulletTracer",(1.5*vel.x)/-35.0,-(1.5*vel.y)/-35.0,0+(1.5*vel.z)/-35.0,0,0,0,0,SXF_ABSOLUTEANGLE|SXF_NOCHECKPOSITION);
	  TNT1 A 0 A_GiveInventory("BulletDropCounter",1); //This gives the bullet a Counter for every tic that it displays tracers.
	  Goto BulletDropper;
	BulletDropper:
	  40MM A 1 Bright A_SpawnItemEx("GunSmoke");
	  40MM A 0 A_CountDown;
	  BULT A 0 A_JumpIfInventory("BulletDropCounter",8,1); //If the projectile has 8 units of this Counter token, skip ahead and drop the projectile a touch. Simulates bullet drop.
	  Goto Spawn;
	  BULT A 0 Bright ThrustThingZ(0,1,1,1); //Pushes the projectile down a touch.
	  Goto Spawn;
	Death:
	  TNT1 A 0 {A_PlaySound ("weapons/boomshaped",CHAN_AUTO,1.0,0,0.75);A_PlaySound ("distance/boommedium",CHAN_AUTO,1.0,0,0.35);A_PlaySound ("distance/boomfar",CHAN_AUTO,1.0,0,0.1);} //In order, Close Boom, Distant Boom, Far Away Boom
	  MISL B 8 Bright A_Explode (64*GetCVAR("SC_PlayerDamageDealt"),32);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30),frandom(-360.0,360.0),0,25); //Just a bunch of shrapnel.
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel1", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel2", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  TNT1 A 0 A_SpawnItemEx ("Shrapnel3", 0, 0, 0, frandom(-30,30), frandom(-30,30), frandom(-30,30), frandom(0.0,360.0),0,25);
	  MISL C 6 Bright;
	  MISL D 4 Bright;
	  Stop;
  }
}
Post Reply

Return to “Scripting”