machosalad
Junior Member
Posts: 38
Joined: Oct 2010
Reputation: 0
|
Play sound only ONCE
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?
|
|
| 11-09-2010 05:35 PM |
|
Someone else
Member
Posts: 179
Joined: Sep 2010
Reputation: 0
|
RE: Play sound only ONCE
Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);
|
|
| 11-09-2010 05:51 PM |
|
machosalad
Junior Member
Posts: 38
Joined: Oct 2010
Reputation: 0
|
RE: Play sound only ONCE
(11-09-2010 05:51 PM)Someone else Wrote: Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);
Thanks it worked perfectly!
|
|
| 11-09-2010 05:57 PM |
|
DamnNoHtml
Senior Member
Posts: 386
Joined: Sep 2010
Reputation: 11
|
RE: Play sound only ONCE
Just so you can learn from it,
AddEntityCollideCallback("Player", "Area1", "PlaySound1", false, 0);
That 'false' refers to "Delete once encountered?"
(This post was last modified: 11-09-2010 10:22 PM by DamnNoHtml.)
|
|
| 11-09-2010 10:22 PM |
|