Frictional Games Forum (read-only)
[SCRIPT] PlaySoundAtEntity is not working - 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 is not working (/thread-10859.html)



PlaySoundAtEntity is not working - Odin0181 - 10-19-2011

Hello I have just started making my own custom story, and i have a problem with scripting.
I just want to make so that a sound plays on a entity (player in this case) when i pick up a key, but nothing happens!
Here is the code:


void OnStart()
{
SetEntityCallbackFunc("key_study_1", "Break");
}

void Break(string &in asEntity, string &in type)
{
SetPropHealth("barrel01_2", 0.0f);
SetPropHealth("barrel01_3", 0.0f);
SetPropHealth("barrel01_4", 0.0f);
SetPropHealth("barrel01_1", 0.0f);
StartPlayerLookAt("human_skull_1", 5, 5, "Break2");
PlaySoundAtEntity("", "react_scare.snt", "Player", 2, false);
}


Thanks for your help Smile





RE: PlaySoundAtEntity is not working - Elven - 10-19-2011

Nothing happens at all? That means your key name might be something different or maybe your hps isn't even loaded.

Make sure to make sure key name is EXACTLY same.



RE: PlaySoundAtEntity is not working - Odin0181 - 10-19-2011

No, I mean, all the other events happen, only the Sound event doesn't. =(


RE: PlaySoundAtEntity is not working - Elven - 10-19-2011

Try without .snt, even tho it shouldn't affect it at all :/

I gonna try it quickly in my story, if it works

EDIT: Okay, soundentity worked for me. Make sure your volume and everything is working, if others scripts work.



RE: PlaySoundAtEntity is not working - Odin0181 - 10-19-2011

ok thanks...i will try

EDIT: No it's not working for me anyway, but i noticed that all the other sound events happen and only the sound events related to the player doesn't...maybe the game doesn't find the files?


RE: PlaySoundAtEntity is not working - Your Computer - 10-19-2011

Maybe the fade time is longer than the sound itself. Try changing it to 0 instead of 2.


RE: PlaySoundAtEntity is not working - Elven - 10-19-2011

I am surprised that I didn't notice that Tongue. Good point!



RE: PlaySoundAtEntity is not working - Odin0181 - 10-19-2011

(10-19-2011, 08:49 PM)Your Computer Wrote: Maybe the fade time is longer than the sound itself. Try changing it to 0 instead of 2.
Thank you so much, it worked =)


RE: PlaySoundAtEntity is not working - Elven - 10-19-2011

Aww, In the end Your Computer gets all reputation xD