Frictional Games Forum (read-only)
Play sound only ONCE - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Play sound only ONCE (/thread-5387.html)



Play sound only ONCE - machosalad - 11-09-2010

I am using this script to play a sound when player collides with an area:

void OnStart()
{
AddEntityCollideCallback("Player", "Area1", "PlaySound1", false, 0);
}


void AreaSound1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("","amb_alert.snt", "mansion_1", 0, false);
}

However it plays the sound everytime the player enters or leaves the area! How do i make it play only once?


RE: Play sound only ONCE - Som1Lse - 11-09-2010

Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);


RE: Play sound only ONCE - machosalad - 11-09-2010

(11-09-2010, 05:51 PM)Someone else Wrote: Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);

Thanks it worked perfectly!


RE: Play sound only ONCE - DamnNoHtml - 11-09-2010

Just so you can learn from it,

AddEntityCollideCallback("Player", "Area1", "PlaySound1", false, 0);

That 'false' refers to "Delete once encountered?"