func_tracktrain sound Created 11 months ago2023-05-08 18:21:41 UTC by Dynelars Dynelars

Created 11 months ago2023-05-08 18:21:41 UTC by Dynelars Dynelars

Posted 11 months ago2023-05-08 18:21:41 UTC Post #347503
Hey all, longtime lurker here who finally decided to sign up. I hope the fine minds on this site can help with a quite specific issue i'm having in the final stages of a long project of mine. Here is the situation:

I have a func_tracktrain that flies a specific path from A to B once every round, consisting of 7 path_tracks. This tracktrain is a helicopter, so of course it would only be natural to have it accompanied by the sound of the rotors spinning. At the moment this is done via multiple ambient_generic along the route, controlled by a multi_manager. As you can probably imagine, this is both janky and unreliable, not to mention super annoying to get it right.

func_tracktrain has the keyvalue for moving sound, however you're only able to choose between the few different rail sounds, none of which make sense for a helicopter. I've been trying to look for a workaround to incorporate the chopper soundfile, in this case apache/ap_rotor4.wav, into the dropdown list. So far, messing around with the .fgd doesn't seem to work, despite using the same format as the original choices on the list.
I recently learned that you could add a custom keyvalue noise with the value being ap_rotor4.wav to the entity itself, while also having to precache the file into the map in a seperate "disabled" ambient_generic. Unfortunately this doesn't seem to work either, so now i'm back where i started. Is there any feasable way to do this, or am i forced to use this janky setup of ambient_generics along the path?

Another small issue; the tracktrain block damage is set to 2000, so it should instantly vaporize anyone who blocks it's path. Instead what happens is it launches you at 1000+ units/second in a seemingly random direction without damage dealt.

Feedback is appreciated, thanks!
Posted 11 months ago2023-05-08 20:25:03 UTC Post #347504
The noise keyvalue trick sounds like one of those map based hacks for the original Quake, it sounds interesting though, where did you hear about it? I don't know if there is a way to make a moving sound entity. I am only aware of a few entity hacks for HL, like making entities emit dynamic light. Modifying the .fgd file is no different from adding a custom keyvalue in the editor. Doing it with multiple ambient_generic entities should work fine, just use a little bit of math to calculate the lengths between the path_tracks, Pythagoras theorem should work nicely. Your helicopter sound should fade in and fade out, and the next sound should start while the previous is in the middle of it's playing, then while the new one is fading in, the old one will be fading out, and it should sound really smooth!
Posted 11 months ago2023-05-09 14:42:21 UTC Post #347505
Hey mate, i posted this same question on /r/hammer a couple of days ago, and a friendly soul told me to try it out. He couldn't confirm that it worked since he never tried it himself though, and so far it seems that it doesn't, or perhaps i'm just missing something. Seems like i will have to go with the multiple ambient_generics along the path which isn't ideal and will probably take a while to get it right, but thanks for the tips regarding that solution!
Posted 11 months ago2023-05-10 17:50:43 UTC Post #347506
The game code overrides sounds of func_train (and similar moving entities like doors) when they spawn. In case you leave the sound keyvalues empty, it'll just default to sound/common/null.wav. So, ambient_generic is your only option.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 11 months ago2023-05-11 13:13:45 UTC Post #347508
My idea is to try have a second, invisible func_train shaped like a box, holding an invisible monster_generic that has an idle animation that emits the rotor sound (same thing that makes Barney go boop boop boop boop typing on those keypads.)
Posted 11 months ago2023-05-11 15:40:20 UTC Post #347509
Thanks for the info guys, that method with the monster_generic sounds very interesting, definitely gonna be trying that one out once the weekend comes around. Cheers!
You must be logged in to post a response.