[SCRIPT] Random sounds - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] Random sounds (/thread-47757.html) |
Random sounds - serbusfish - 05-20-2016 I'm trying to get random sounds to play but I must be doing something wrong because they wont. Before trying this I didnt even know you could do random sounds, so I started by simply copying the script from the Prison map from the base game and changed the sound file and script area names to match, but nothing plays. Here is what I have: Quote: /*creaks In the map I have script areas named AreaCreaks_1, AreaCreaks_2, etc up to 8. What did I do wrong? RE: Random sounds - Mudbill - 05-20-2016 First off, the way you've set it up makes so that after a random time between 18 and 40 seconds after starting the map for the first time, it will play a sound ONCE. Do you want random sounds to keep playing? If so you gotta change a few things. Most importantly create a looping timer. The AreaCreaks_x should be fine. Your afx_mansion_gallery_creak sound... can you confirm it works? I think this one is from AMFP, is it not? Also, I don't remember if you need to include .snt in there, but perhaps not. RE: Random sounds - serbusfish - 05-20-2016 (05-20-2016, 09:44 AM)Mudbill Wrote: First off, the way you've set it up makes so that after a random time between 18 and 40 seconds after starting the map for the first time, it will play a sound ONCE. Do you want random sounds to keep playing? If so you gotta change a few things. Most importantly create a looping timer. Yes I want the sound to keep looping randomly. That sound is from AMFP and does play fine, in fact using the inspector mode I just found that the game is loading and playing the file once, but obviously if im not near the script area the game decided to play it at I wont hear it. Now I know that the sound is playing what would I need to do to make it loop randomly? I was under the impression the script I had would work as this is the same one Frictional used and theirs loops? RE: Random sounds - Mudbill - 05-21-2016 Ah, right, didn't see that recall you had. Yes it should loop. Maybe... Remember that the parameters of AddTimer uses a float, not an int. So use RandFloat instead. Also, try adding 'f' behind your 0.0 values, so that they look like 0.0f. This is a best practise for floats. But your timer only loops every 10 to 20 seconds. RE: Random sounds - Daemian - 05-21-2016 For testing purposes I would change those RandInt(x,x) for a plain RandInt(1,1), so you can note in-game how it loops and how it sounds. When you're done with that part you can then adjust the frequency (RandInt). |