Frictional Games Forum (read-only)

Full Version: PlaySoundAtEntity is not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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


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.
No, I mean, all the other events happen, only the Sound event doesn't. =(
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.
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?
Maybe the fade time is longer than the sound itself. Try changing it to 0 instead of 2.
I am surprised that I didn't notice that Tongue. Good point!
(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 =)
Aww, In the end Your Computer gets all reputation xD