Frictional Games Forum (read-only)
[SCRIPT] PlaySoundAtEntity bug - 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] PlaySoundAtEntity bug (/thread-47003.html)



PlaySoundAtEntity bug - goodcap - 05-11-2016

I am working on a custom story and this is what i'm trying to do:

You walk to a door and you try to open it. It's locked and there's a memento added. It tell the player to get the key and you hear the writing sound effect.
This where the problem happens. The settings make it that when you click the door once, the script gets de-activated so you won't be getting 10 million mementos if you spam the door. This doesn't count for the PlaySoundAtEntity for some reason. If I spam click the door you keep hearing the writing noise.


This is my script:

void OnStart()
{
SetEntityPlayerInteractCallback("LibraryDoor", "LibDoor", true);
}

void LibDoor(string &in asEntity)
{
AddQuest("NeedKeyForLibDoor", "NeedKey");
PlaySoundAtEntity("", "MementoWriting.ogg", "Player", 0, false);
}

Everything works except that it does not disable the MementoWriting sound after the player clicked the door once.


RE: PlaySoundAtEntity bug - Daemian - 05-11-2016

Try this inside LibDoor function:
PHP Code:
SetEntityPlayerInteractCallback("LibraryDoor"""true); 



RE: PlaySoundAtEntity bug - Darkfire - 05-12-2016

Weird. Your code should work.

(05-11-2016, 11:59 PM)Daemian Wrote: Try this inside LibDoor function:
PHP Code:
SetEntityPlayerInteractCallback("LibraryDoor"""true); 

Kudos to you, I actually didn't know you can override an interact callback with another one. This should work


RE: PlaySoundAtEntity bug - Mudbill - 05-12-2016

So basically the sound loops, not the function?

Maybe you should call a .snt instead of .ogg and edit it to make sure Loop="False". If you don't know how, just copy another .snt file and rename/edit it.


RE: PlaySoundAtEntity bug - Spelos - 05-14-2016

The AddQuest function creates the Memento writing sound.
Why are you playing it manually?