Frictional Games Forum (read-only)
[SCRIPT] Sounds at entity - 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] Sounds at entity (/thread-53742.html)



Sounds at entity - zulu52 - 05-14-2017

hello. It has been a while since I had used Suite, but with so much free time on my hands again, I thought I'd boot it back up - im enjoying it, but whats put me off from continuing is the zero scripts, so I thought I would try some simplistic things.


what im trying to achieve is a sound to play from an entity (namely a clock) - when the player walks up to it, it goes off - and it does, but its through the player, so even if I leave the proximity of the clock, the sound continues until it naturally stops. I have tried adding it to a couple objects - last one was a brick (which I hid behind the clock), which is down below, but no changes. either the sound plays via player, or it doesnt play at all.

surely I've made a dumb mistake somewhere, because I believe theres already a command to play sounds via player, and that is "PlayGuiSound".
-----------------------------------------

void OnStart()

{
PlayMusic("mansion.ogg", true, 0.8, 0, 10, true);
PreloadSound("clockscare.snt");
AddEntityCollideCallback("Player", "clockscarescript", "Sound", true, 1);
}



void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "clockscare.snt", "brick_1", 0.1, false);
}

--------------------------------


I've barely got anything in there right now, but I'd like to sort out my problems before moving on, instead of putting it off and returning later.


RE: Sounds at entity - FlawlessHappiness - 05-14-2017

It is possible that the clockscare.snt file does not use 3D sound, and thus just plays everywhere as long as you're in range.

I'm not sure what .snt you used to create clockscare.snt, but it is possible that you used a .snt file that does not use 3D sound.


RE: Sounds at entity - Mudbill - 05-14-2017

If you want 3D sound, your audio file must be using a mono channel, not stereo.


RE: Sounds at entity - zulu52 - 05-14-2017

thank you guys so much for the help - it was the file not being specified as 3D. it was a custom sound I had edited via audacity, but I overlooked the extra options when creating the SNT file for it.