Zombie Panic! Source

Zombie Panic! Source

View Stats:
Trouble with ambient_generic entity
It seems that the ambient_generic entity is having trouble playing and/or looping sounds. The sounds I'm using seem to play properly when I test them in Hammer and, initially, these used to work in 3.0 when it first was released. However, in game, they do not seem to play and/or loop.

Has there been any changes to this entity in particular since 2.4.1 up until now or a change in how they are used? I want to make sure I'm not missing anything, like another entity or output, that could be blocking them from playing appropriately.
< >
Showing 1-7 of 7 comments
Feb 26, 2018 @ 2:40am 
AFAIK, we haven't touched that entity's code.

Perhaps it's a SDK 2013 bug?
Originally posted by Shepard:
AFAIK, we haven't touched that entity's code.

Perhaps it's a SDK 2013 bug?

It could be. The kind of sounds this entity controls are sounds like the arcade noises that you would hear in zpo_biotec. Unless something is wrong with my game install, I don't hear those noises in the arcade room in zpo_biotec anymore either.
It's probably a bug. I've noticed ambient sounds popping in an out randomly on various maps. On thrillvile, two teacup tracks play at the same time, one a second or so behind the othe, when you're around Pigs on Sticks. Very strange!
So I figured out what needed to be done. In Source 2007, these entities all used to automatically start and loop unless specified. However, in Source 2013 that does not seem to be the case. Entities hooked up to buttons and set to play sounds will work, but none of the ones that were added the map without any input/outputs will play automatically. I tried using things like logic_auto to start sounds, but it only worked for players who joined the game initially, but not for spectators, zombies, or survivors. Instead, I had to use a trigger_once entity and start the sounds as soon as players touched the entity, then it would play for zombies and survivors for the whole round.

Other maps will probably need this (including official ones), so these are the steps I took to get them to work:

  1. Create a trigger_once entity that anyone (player/zombie) can trigger and set it in your map (like the first spawn points on the map or something similar).
  2. Create/Find all all ambient_generic entities in your map that are not hooked up to buttons or anything else, give them a name (you can use the same name on all of them to make it easier on yourself).
  3. Set the ambient_generic's entity flag to "Start Silent".
  4. Go to your trigger_once's properties and head to the "Outputs" tab. Click "Add" to add a new output with "OnTrigger" in My Outputs, the name you used for your ambient_generic in the Target Entity, and select "PlaySound" in the Target Input. Click "Apply".
  5. If you haven't already, make sure you've set your ambient_generic's Volume/Start Volume values to however loud you need them to be and be sure the audible distance is set. Do not use "Play everywhere" as it will play the sound through every ambient_generic entity on the map, instead set the distance to something really large so that it emits sounds from the entity.
  6. Compile the map, check to see if sounds work. If done correctly, the sounds should play as soon as you go zombie/survivor and go over the trigger. They should also be looping, assuming that "Is NOT Lopped" remains unchecked in ambient_generic.

The above solution is not the most elegant, but it gets the job done. I'm sure there is a better way to do this. In either case, this is how I got sounds that were supposed to loop/play at the start of the round working in my maps again.
I'm glad I'm not alone to have struggle with ambient_generics. Now I'm sure it's not related to my map/hammer, I will stop chasing ambient_generics with this suspicious (but harmless) "IDHammer" info :d

I haven't found other solution(s) than the one you're describing above (but hey ! It works).
https://steamcommunity.com/app/17500/discussions/7/1618346571421897995/

Not 100% sure but I advice to not give the same name to a huge number of ambient_generics or you might get issues.
Originally posted by Parasol:
I'm glad I'm not alone to have struggle with ambient_generics. Now I'm sure it's not related to my map/hammer, I will stop chasing ambient_generics with this suspicious (but harmless) "IDHammer" info :d

I haven't found other solution(s) than the one you're describing above (but hey ! It works).
https://steamcommunity.com/app/17500/discussions/7/1618346571421897995/

Not 100% sure but I advice to not give the same name to a huge number of ambient_generics or you might get issues.

Ah I didn't see that thread when I went searching. It seems we both reached the same conclusion that ambient_generic entities need to be triggered in order to get them working though, so lets hope this helps someone else who might be having trouble with them in their maps.

I also agree with your advice. In general, named entities are slightly more costly in terms of optimization, so using naming wisely for any entities is a good idea. Naming every ambient_generic the same name, especially if you have a lot of them in your map, isn't good practice either since it can be troublesome to manage/troubleshoot. In my maps, I've been naming them the same based on the kind of sounds that they are (arcade sounds, water sounds, outdoors sounds, etc.) so that it is easier to identify the type of sounds and easier to add them all to the trigger brush, but that is just my preference since I'm sort of lazy. :p
I do the same regarding the entities names to not get too confused. Laziness is the key sometimes. I try to make most of them really short ("t" for torches, etc...) to make them less heavy optimization wise.
< >
Showing 1-7 of 7 comments
Per page: 1530 50