Game Development Community

How do I stop the 'fire' sound from a weapon?

by Nicolai Dutka · in Torque Game Engine Advanced · 07/28/2009 (12:18 pm) · 5 replies

I have a somewhat long 'firing' sound for a weapon (3.5 seconds due to a 'trailing' effect). How can I stop the initial 'fire' sound when the projectile collides with something? Currently, if you fire at close range, it plays and explosion sound, but the firing sound continues trailing after the explosion has stopped...

#1
07/28/2009 (12:30 pm)
Why not give the projectile itself a "trail" sound (looping)? Then when it (the projectile) is removed the sound is stopped. Isn't this already in the projectile code?

Hacking the weaponImage sounds to stop a firing sound after removal of a projectile isn't the best solution in my opinion.
#2
07/28/2009 (9:07 pm)
I don't see anything in the projectile code for audio... I suppose I could write an 'onAdd' function... can I make 3D Audio mount to a projectile?
#3
07/28/2009 (9:59 pm)
Oh, but there is! You didn't look hard enough ;)

I've just added projectile "whiz" sounds into my project. I had thought that functionality still remained from the Tribes days.

Just add a sound profile
datablock SFXProfile(ProjectileWhizSound)
{
   filename = "art/sound/orc_death";
   //filename = "art/sound/weapons/steampistol/empty";
   description = AudioDefault3D;
   preload = true;
};
And in the projectile datablock
sound = ProjectileWhizSound;
The sound will travel with your projectile, it repeats automatically, and stops when it collides/explods.
#4
07/28/2009 (10:06 pm)
This is what I was looking for:

sound = ProjectileWhizSound;


THANKS!!

(I searched through ALL the demo games that came with my TGEA 1.8.1 SDK and could not find that. Also did forum searches and TDN searches and could not find anything...)
#5
07/28/2009 (10:25 pm)
Yeah, that's not something being used by any of the projects. If I'm ever curious about functionality like this I always refer back to the source code.

The old documentation used to have a complete listing of datablocks and a description of each field that was very useful for finding this type of information. If you can actually get the "Console Objects" pages on TDN to open up that can be a handy reference too.