Frictional Games Forum (read-only)
Amnesia Sound Trigger Script Help - 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: Amnesia Sound Trigger Script Help (/thread-11561.html)



Amnesia Sound Trigger Script Help - NuggetBlubber - 11-28-2011

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.




RE: Amnesia Sound Trigger Script Help - Unearthlybrutal - 11-28-2011

(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