Frictional Games Forum (read-only)

Full Version: Play sound only ONCE
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);
(11-09-2010, 05:51 PM)Someone else Wrote: [ -> ]Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);

Thanks it worked perfectly!
Just so you can learn from it,

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

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