Scare Sound? - 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: Scare Sound? (/thread-17078.html) |
Scare Sound? - zergling50 - 07-18-2012 So I have this code set up and I want it to play a sound when someone finished reading a note. I tried using this code: //////////////////////////// // Run when starting map void OnStart() { AddUseItemCallback("", "key_study_1", "mansion_3", "KeyOnDoor2", true); SetEntityPlayerInteractCallback("note_paper01_3", "ScareNoise1", true); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave() { } void ActivateMonster(string &in asItem) { } void KeyOnDoor2(string &in asItem, string &in asEntity) { SetSwingDoorLocked(asEntity, false, true); PlaySoundAtEntity("", "unlock_door", asEntity, 0.0f, false); RemoveItem(asItem); } void ScareNoise1() { PlaySoundAtEntity("", "scare_baby_cry1.ogg", "Player", 0, false); PlaySoundAtEntity("", "scare_steps_big5.ogg", "Player", 0, false); PlaySoundAtEntity("", "scare_tingeling_rev2.ogg", "Player", 0, false); } It wont however work, but thanfully doesnt crash or give me any errors. Do I need to use something other than SetEntityPlayerInteractCallback to make it work with a note? EDIT: Sorry, I said "a" sound but I actually want it to play a chorus of those three sounds at once. RE: Scare Sound? - Kazakarumariou - 07-18-2012 void ScareNoise1(string& asName) RE: Scare Sound? - zergling50 - 07-18-2012 (07-18-2012, 09:20 PM)Harthex Wrote: void ScareNoise1(string& asName) It started playing all the sounds for a split second but then they all cut off. Is it because Im trying to play so many at once? Should I make a different method for each noise? Otherwise thank you sooo much! RE: Scare Sound? - Adny - 07-18-2012 The proper syntax for the function is: void ScareNoise1(string &in asEntity) The HPL2 engine is able to handle quite a few sounds at once; if they cut off, its not due to the engine's limitations, but your script. Also, the "PlaySoundAtEntity" function doesn't directly support ogg vorbis (.ogg) files, but .snt files. RE: Scare Sound? - zergling50 - 07-18-2012 (07-18-2012, 10:14 PM)andyrockin123 Wrote: The proper syntax for the function is: What should I do if i want it to runan ogg file? RE: Scare Sound? - Adny - 07-18-2012 You can use a .ogg file. but it has to have an accompanying .snt file. I'd suggest (for troubleshooting purposes) to only use the name of the .snt file and not the individual .ogg names. void ScareNoise1(string &in asEntity) { PlaySoundAtEntity("", "scare_baby_cry", "Player", 0, false); PlaySoundAtEntity("", "scare_steps_big", "Player", 0, false); PlaySoundAtEntity("", "scare_tingeling_rev2", "Player", 0, false); } RE: Scare Sound? - Kazakarumariou - 07-18-2012 (07-18-2012, 10:14 PM)andyrockin123 Wrote: The proper syntax for the function is:Sorry to be adding another question to you, but what's the difference? It works fine with the one I have(I'm using it on an Examine area). RE: Scare Sound? - Adny - 07-18-2012 (07-18-2012, 11:16 PM)Harthex Wrote: Sorry to be adding another question to you, but what's the difference? It works fine with the one I have(I'm using it on an Examine area).Technically you only need to have the "string &in" part then you can put whatever after that, but I just noticed that on the wiki page with the list of functions it specifically says string &in asEntity. RE: Scare Sound? - zergling50 - 07-18-2012 (07-18-2012, 10:22 PM)andyrockin123 Wrote: You can use a .ogg file. but it has to have an accompanying .snt file. I'd suggest (for troubleshooting purposes) to only use the name of the .snt file and not the individual .ogg names.It works now, but whats the point in having an ogg file if you cant use it? I prefer some of the ogg files but ill hav to settle with the snt. RE: Scare Sound? - Adny - 07-19-2012 (07-18-2012, 11:51 PM)zergling50 Wrote: It works now, but whats the point in having an ogg file if you cant use it? I prefer some of the ogg files but ill hav to settle with the snt..snt files aren't actual sound files; they're more like configuration for the ogg files. If you look in the sounds folder, all ogg(s) have an accompanying .snt file. The snt file determines the sound(s) played, the volume, the maximum/minimum distances from which they can be heard, as well as other options. You can open them with notepad and look around inside of them, once you figure out how they work you can make your own .snt files with customized settings. |