Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Random Sounds while playing
Vic7im Offline
Junior Member

Posts: 44
Threads: 9
Joined: Sep 2012
Reputation: 3
#1
Random Sounds while playing

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.
10-05-2012, 02:55 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#2
RE: Random Sounds while playing

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.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
10-05-2012, 03:00 PM
Website Find
Vic7im Offline
Junior Member

Posts: 44
Threads: 9
Joined: Sep 2012
Reputation: 3
#3
RE: Random Sounds while playing

(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
10-05-2012, 03:23 PM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#4
RE: Random Sounds while playing

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.

[Image: Tv0YgQb.gif]
Image by BandyGrass
10-05-2012, 03:37 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#5
RE: Random Sounds while playing

The sound part is easy.

Here's an example of how a sound file (.snt) with multiple sounds look like.
<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.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 10-05-2012, 03:39 PM by Robby.)
10-05-2012, 03:39 PM
Website Find
Vic7im Offline
Junior Member

Posts: 44
Threads: 9
Joined: Sep 2012
Reputation: 3
#6
RE: Random Sounds while playing

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!
(This post was last modified: 10-05-2012, 03:56 PM by Vic7im.)
10-05-2012, 03:54 PM
Find




Users browsing this thread: 1 Guest(s)