Adding a Sound Triggered by an Area - 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: Adding a Sound Triggered by an Area (/thread-6751.html) |
Adding a Sound Triggered by an Area - Samuelblitz - 03-01-2011 Hello everyone, i'm pretty new to scripting / amnesia editing in general and there's one thing im confused about right now. I have a fairly basic map set up right now with some basic scripts being used, and i realized i wanted to add some noises to my environment So far i have tried these methods: - Placing a "Sound" from within the level editor. (No matter how much i tweaked the sound's settings, i could never hear it in-game) - Creating a script area in the level editor, and then scripting a collidecallback so that it would play a sound from a nearby entity. This is what my script looked like: void OnStart() { AddEntityCollideCallback("Player", "monsterscare1", "CollideAreaTest01", true, 1); } void CollideAreaTest01(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "enabled.snt", "sloped_square_shelf_1", 6.0f, false); AddDebugMessage("Entered area!", false); } Thanks in advance to anyone that can help! RE: Adding a Sound Triggered by an Area - Russ Money - 03-01-2011 You could try adding a sound entity near the shelf and make it play the .snt you want it to. Then just change the "sloped_square_shelf_1" to "sound_1", as maybe the origin of sound might be muffled from the shelf. RE: Adding a Sound Triggered by an Area - Samuelblitz - 03-01-2011 (03-01-2011, 02:39 AM)Russ Money Wrote: You could try adding a sound entity near the shelf and make it play the .snt you want it to. Then just change the "sloped_square_shelf_1" to "sound_1", as maybe the origin of sound might be muffled from the shelf. thank you for your help! I did exactly as you said and it partially worked this time my game actually displayed the debug text it is supposed to when i walk into the area, except still no sound, and i have no idea why RE: Adding a Sound Triggered by an Area - Russ Money - 03-01-2011 Which sound .snt are trying to use specifically? Also, maybe try changing the fade to something quicker than six seconds, try PlaySoundAtEntity("", "enabled.snt", "sound_1", 1.0f, false); RE: Adding a Sound Triggered by an Area - Samuelblitz - 03-01-2011 (03-01-2011, 04:01 AM)Russ Money Wrote: Which sound .snt are trying to use specifically? Also, maybe try changing the fade to something quicker than six seconds, try enabled.snt is one of the grunt's sound files and i tried the fade at 0.0f but still no sound in-game, just out of curiosity, is this a common problem? or is it just my game specifically? RE: Adding a Sound Triggered by an Area - Russ Money - 03-02-2011 Quote:enabled.snt is one of the grunt's sound files and i tried the fade at 0.0f but still no sound in-game, Most likely just a coding or some small detail we're overlooking. Just for testing sake, try this instead. PlaySoundAtEntity("", "enabled.snt", "Player", 0.0f, false); It'll play directly on the player, letting them hear it regardless. If it doesn't play, it's .snt file. Which alternatively, you can try a different .snt and test that. RE: Adding a Sound Triggered by an Area - Samuelblitz - 03-02-2011 (03-02-2011, 08:17 AM)Russ Money Wrote:Quote:enabled.snt is one of the grunt's sound files and i tried the fade at 0.0f but still no sound in-game, Ahh, that worked perfectly! Thank you very much. However are there any disadvantages to playing the sound directly from "Player"? Because i was planning to have quite a few triggered sounds and i might end up having to use this method for all of them. RE: Adding a Sound Triggered by an Area - Russ Money - 03-02-2011 Well, the only thing that I see wrong with it, is if you wanted the sound the play at the end of a hall and want the player to know specifically it's coming from down the hall. When it's played on the Player, it'll play the sound as if the sound if coming from the player, they'll hear it in all directions. RE: Adding a Sound Triggered by an Area - Nye - 03-02-2011 (03-02-2011, 09:37 PM)Samuelblitz Wrote:(03-02-2011, 08:17 AM)Russ Money Wrote:Quote:enabled.snt is one of the grunt's sound files and i tried the fade at 0.0f but still no sound in-game, The issue here, which I found out the hard way, you CANNOT play sounds from entities. As silly as it sounds, there are a few exceptions, like the player. And don't stick to the partial solution, since you might as well play a GuiSound if you want to play a sound from the player. The solution is to create a script area and play the sound from that script area. RE: Adding a Sound Triggered by an Area - Samuelblitz - 03-03-2011 (03-02-2011, 09:45 PM)Nye Wrote:(03-02-2011, 09:37 PM)Samuelblitz Wrote:(03-02-2011, 08:17 AM)Russ Money Wrote:Quote:enabled.snt is one of the grunt's sound files and i tried the fade at 0.0f but still no sound in-game, Really? That sounds perfect, thanks for your help too Nye, i'll reply again if there are any more problems i actually have a few more questions about editing that i would be grateful for your help on, and i don't think i want to spam this board with more help threads: - I'm trying to set it so when i interact with a locked door WITHOUT the key in my inventory, text will appear on screen telling me that i need to find the key. However i also want a quest to be added at the same time. The problems i'm having are that no text pops up in-game, BUT it does show the little memento icon in the corner, however when i check that quest, the the text just says " - " like it's missing text... this is my .hps: "void TouchLockedDoor(string &in asEntity) { if(HasItem("Storage_Room_Key")) SetMessage("Hints", "HaveKeyLockedDoor1", 6.0f); else AddQuest("Quests", "QuestLockedDoor1"); SetMessage("Hints", "LockedDoor1", 6.0f); }" and this is my extra_english.lang: "<LANGUAGE> <CATEGORY Name="Hints"> <Entry Name="LockedDoor1"> The door is locked sturdily.</Entry> <Entry Name="LockedCrowBarDoor1"> The door is locked with an old, weak lock.</Entry> <Entry Name="HaveKeyLockedDoor1"> You need to use the key on the door to unlock it.</Entry> <Entry Name="HaveCrowBarCrowBarDoor1"> You need to use the crowbar on the door to break the lock.<Entry> </CATEGORY> <CATEGORY Name="Quests"> <Entry Name="QuestLockedDoor1"> I need to find the key for the Storage Door.</Entry> <Entry Name="QuestCrowBarDoor1"> I need to find a way to break the lock.</Entry> </LANGUAGE>" in-case your wondering, the "HaveKeyLockedDoor1" should just display a message telling you that you need to drag the key to the door. thanks for your help! |