What I am trying to do is not so simple, and I'm not even sure possible. What I want is that after X seconds a random number will be selected, and a sound file, that corresponding to that number, will be played, along with another timer, that matches the length of the sound file, starting. Then I would like to have that number be disabled from being selected again.
For example;
Timer and sound 1 are 10 seconds long.
Timer and sound 2 are 15 seconds long.
Timer and sound 3 are 20 seconds long.
Timer and sound 4 are 25 seconds long.
Lets say that the first sound to be randomly trigged is sound 3. So after 20 seconds, the sound stops, and a new number, 1, is randomly selected. Now the numbers 1 and 3 are disabled from being selected. So after 10 seconds, the sound stops, and now number 4 is selected. So only number 2 is left to be randomly chosen.
What I'm asking for is this,
Is this even possible? And if so can someone tell me how or make a small example in a map and send it to me?
1
Re: Help with timed triggers and random numbers in map.
Posted by jpwanabe on Thu Apr 7th at 10:08pm 2011
Posted by jpwanabe on Thu Apr 7th at 10:08pm 2011
Re: Help with timed triggers and random numbers in map.
Posted by Riven on Fri Apr 8th at 3:51am 2011

Riven
super admin
1639 posts
802 snarkmarks
Registered: May 2nd 2005
Location: Austin, Texas, USA
Occupation: Architect
Posted by Riven on Fri Apr 8th at 3:51am 2011
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:
-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?
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
-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?
Riven
super admin
1639 posts
802 snarkmarks
Registered: May 2nd 2005
Location: Austin, Texas, USA

Occupation: Architect
Re: Help with timed triggers and random numbers in map.
Posted by jpwanabe on Fri Apr 8th at 5:27am 2011
Posted by jpwanabe on Fri Apr 8th at 5:27am 2011
It sorta helped, but some went over my head. I'll mess around with those and try to see what I can do on my own. But a .vmf would help me very much. I learn best from examining what has already been done.
Re: Help with timed triggers and random numbers in map.
Posted by omegaslayer on Thu Apr 14th at 6:03pm 2011
Did the problem get resolved? If so please mark Riven's answer correct

omegaslayer
member
2481 posts
401 snarkmarks
Registered: Jan 16th 2004
Location: Seattle, WA
Occupation: Sr. DevOPS Engineer
Posted by omegaslayer on Thu Apr 14th at 6:03pm 2011
Quoting jpwanabe
It sorta helped, but some went over my head. I'll mess around with those and try to see what I can do on my own. But a .vmf would help me very much. I learn best from examining what has already been done.
Did the problem get resolved? If so please mark Riven's answer correct
omegaslayer
member
2481 posts
401 snarkmarks
Registered: Jan 16th 2004
Location: Seattle, WA

Occupation: Sr. DevOPS Engineer
Re: Help with timed triggers and random numbers in map.
Posted by jpwanabe on Fri Apr 15th at 5:14am 2011
Posted by jpwanabe on Fri Apr 15th at 5:14am 2011
I'm not able to get it to work right. If I could get an example I would be able to do it better.
Re: Help with timed triggers and random numbers in map.
Posted by Riven on Sat Apr 23rd at 9:22am 2011

Riven
super admin
1639 posts
802 snarkmarks
Registered: May 2nd 2005
Location: Austin, Texas, USA
Occupation: Architect
Posted by Riven on Sat Apr 23rd at 9:22am 2011
Ok, here is the example map I created for you and anyone else looking for this kind of example. Mind you it's probably not exactly what you're looking for, but I imagine it's quite similar, and once you understand the way in which it was achieved, you'll be able to mutate it into doing exactly what you want it to.
Check out the discussion page here: http://www.snarkpit.net/index.php?s=forums&f=7&t=12115
Download page here: http://www.snarkpit.net/index.php?s=downloads&game=46&cat=1
I hope this helps, and enjoy!
Check out the discussion page here: http://www.snarkpit.net/index.php?s=forums&f=7&t=12115
Download page here: http://www.snarkpit.net/index.php?s=downloads&game=46&cat=1
I hope this helps, and enjoy!
Riven
super admin
1639 posts
802 snarkmarks
Registered: May 2nd 2005
Location: Austin, Texas, USA

Occupation: Architect
Re: Help with timed triggers and random numbers in map.
Posted by jpwanabe on Tue Apr 26th at 5:57pm 2011
Posted by jpwanabe on Tue Apr 26th at 5:57pm 2011
Well after a day and a half of examining the example and trying it on my own, I've discovered that this task, is beyond my skills. Sorry to have caused you problems.
Re: Help with timed triggers and random numbers in map.
Posted by Riven on Tue Apr 26th at 6:09pm 2011

Riven
super admin
1639 posts
802 snarkmarks
Registered: May 2nd 2005
Location: Austin, Texas, USA
Occupation: Architect
Posted by Riven on Tue Apr 26th at 6:09pm 2011
Not a problem, If it doesn't help you, I imagine it'll help someone else somewhere.
But basically if you want to do any kind of neat interactive or autonomous 'machinery' or connectivity in Source you'll need to learn the ropes of the I/O (Input/Output) system.
If you haven't already found this yet, here's a good primer:
http://developer.valvesoftware.com/wiki/I/O
Good luck in your mapping endeavors.
But basically if you want to do any kind of neat interactive or autonomous 'machinery' or connectivity in Source you'll need to learn the ropes of the I/O (Input/Output) system.
If you haven't already found this yet, here's a good primer:
http://developer.valvesoftware.com/wiki/I/O
Good luck in your mapping endeavors.
Riven
super admin
1639 posts
802 snarkmarks
Registered: May 2nd 2005
Location: Austin, Texas, USA

Occupation: Architect
1
© Snarkpit.net 2001 - 2023, about us, donate, contact
Snarkpit v6.1.0 created this page in 0.0119 seconds.

Snarkpit v6.1.0 created this page in 0.0119 seconds.

