Frictional Games Forum (read-only)

Full Version: Random Sounds while playing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, since I absolutely have no idea how to do this I'd like to ask for help instead of bashing my skull on Notepad++.

Basically, during the gameplay, random timers activate random sounds throughout the whole map, not just an "area".

An idea would be using the PlayGuiSounds and put a "far" volume value, like 0.2-0.4 but I don't know what to do.
You need help with the random timers too or just the random sounds?

I don't really get what you're asking. Though, for PlayGuiSound, you can try experimenting with values.
(10-05-2012, 03:00 PM)Nemet Robert (Robby) Wrote: [ -> ]You need help with the random timers too or just the random sounds?

I don't really get what you're asking. Though, for PlayGuiSound, you can try experimenting with values.
Sorry, kind of a rough day, ill try to rephrase.

While playing Amnesia (Prison level) you sometimes hear sounds that are randomly created by the engine. Is it possible somehow to recreate that same effect using a simple script and lots of timers? If so, please give me some guidelines because I have no clue what to do with random values. Thank you
I'll tell you the basic idea of how I do this. If you need something more in-depth with actual script, let me know, and I'll cook some up.

Use a timer which will generate a random localint whenever it ticks. In the exact same timer script, use a "switch" script to determine which localint was generated, and play an according sound. At the end of all this, don't forget to recall the same timer so the random sound can happen again.
The sound part is easy.

Here's an example of how a sound file (.snt) with multiple sounds look like.
Code:
<SOUNDENTITY>  
<SOUNDS>      
<Main>          
<Sound File="02_vent_amb1" />        
<Sound File="02_vent_amb2" />        
<Sound File="02_vent_amb3" />        
<Sound File="02_vent_amb4" />        
<Sound File="02_vent_amb5" />        
<Sound File="02_vent_amb6" />      
</Main>  
</SOUNDS>  
<PROPERTIES Volume="0.7" MinDistance="1" MaxDistance="5" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="True" Blockable="True" BlockVolumeMul="0.7" Priority="0" />
</SOUNDENTITY>

I used ^ as an example.

And, the timer's don't really need to be random, since the game checks the .snt file, and if it has a similar architecture like the example, it will choose from either sounds listed in it. Randomly.
Thank you for the replies, so basically all I need to do is to create a custom snt file with all the sounds I want, then call it using a Timer. That's easy, and I think I can get the random timer from the lightning script I saw not long ago. Thanks, I'll try it out and maybe post it for the others.

Edit: Found it, AddTimer("TimerName", RandInt(3,7), "TimerCategory");

Thanks guys!