Frictional Games Forum (read-only)

Full Version: Amnesia Sound Trigger Script Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok so im brand new to amnesias custom story creator and so far I have made the first part of my map. What I want to do is create an area so when the player walks through it a sound will play. So far I havent been able to figure it out. This is the script code I have been using

PlaySoundAtEntity("", "enabled.snt", "guardian_area1", 6.0f, false);

and I put this script in the void OnEnter() section. I cant get it to play when I walk through the area I set it to activate on, but it will just randomly go off while im playing. Please help I am not all good when it comes to scripting thanks.

(11-28-2011, 03:44 PM)NuggetBlubber Wrote: [ -> ]Ok so im brand new to amnesias custom story creator and so far I have made the first part of my map. What I want to do is create an area so when the player walks through it a sound will play. So far I havent been able to figure it out. This is the script code I have been using

PlaySoundAtEntity("", "enabled.snt", "guardian_area1", 6.0f, false);

and I put this script in the void OnEnter() section. I cant get it to play when I walk through the area I set it to activate on, but it will just randomly go off while im playing. Please help I am not all good when it comes to scripting thanks.
Use this:

Spoiler below!



void OnStart()
{
PreloadSound("enabled.snt");
AddEntityCollideCallback("Player", "guardian_area1", "Sound", true, 1);
}


void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "enabled.snt", "guardian_area1", 0.0, false);
}



You should check out some tutorials of scriptingSmile
They are really helpful sometimes