Short answer: this is totally achievable!
Quick Answer: I have done it before and could maybe wrap it up in a .vmf for you to check out.
Long Answer: I appreciate you having abstracted the idea into inputs and outputs. My example incorporates a radio playing 3 different barks until the player "communicates" with the other end.
The three 'barks' play randomly, but they don't repeat until all the barks are played. So what that means is it makes sure you don't hear the same bark twice in a row, or even after two are played. Keeps it a little interesting.
The entites you'll want to use are a:
- logic_timer
- logic_case
- logic_relay
The
logic_case will link all your sounds as outputs. That is, use the first four case values each to link to one of your sounds. And set their value to:
-OnCase01| sound 1 | play sound
-OnCase02| sound 2 | play sound
ETC...
Use the
logic_timer to use the random time option and give it a min and max value to pick within. When it fires, have it output towards the
logic_case to 'PickRandomShuffle" this is the feature that makes sure it will not repeat that case until all cases have been picked.
After all four triggers from the
logic_timer have been fired, then you can simply disable the timer after the last one so it doesn't pick any cases any more.
To prevent another sound playing while one is still playing, be sure to toggle the timer off for the specified amount of time (the duration of that particular sound) and then re-enable it after the sound is done. The best way I've found to do this, is use the |delay| field in the I/O system of your
logic_case to make a trigger that hits the same time as the sound, but is delayed the length of the sound before actually triggering.
You can use a
logic_relay to help keep things organized. it would be optional though.
I may not be able to upload a file for another day or two until I can get it out of the current map.
Does that help any?
Blog:
www.playingarchitecture.net
LinkedIn:
Eric Lancon
Twitter:
@Riven202