(SOLVED) AUDIO: Projectile sometimes just doesn't play audio properly.
Posted: Sat Feb 03, 2024 11:43 am
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.
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;
}
}