Posted 3 years ago2021-02-20 13:14:13 UTCPost #345359
Greetings, can someone help me, I need to set the duration of the sound,I press the button, it plays for 10 seconds then turns off, until I press the button again. how to do it?
Posted 3 years ago2021-02-21 00:02:31 UTCPost #345360
Use a multi_manager to trigger your sound, and then trigger it again after a 10 second delay. Be sure you don't have 'Not Toggled' set on your ambient_generic (it's off by default - leave it off). See Tutorial: Multi manager for more info on using multi_managers.
Posted 3 years ago2021-02-21 16:37:00 UTCPost #345361
Probably I wrote something not correct before. I just want to set a playback time of a looping alarm sound without turning it off manually. I.e, player press a button, alarm starts playing, it sounds for a ten seconds and then turns off.
Posted 3 years ago2021-02-21 20:37:02 UTCPost #345362
That's what Penguinboy meant. Your button should turn on the multi_manager. multi_manager can act like a timer to perform multiple tasks, first it turns on your ambient_generic immediately and then it turns it off after 10 seconds. If your ambient_generic is named "coolsound", then keyvalue pairs on your multimanager should look like this:
coolsound 0 coolsound#1 10
The #1 should appear by itself when you use a name more than once. Read the tutorial to learn more.