Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Play sound only ONCE
Author Message
machosalad Offline
Junior Member

Posts: 38
Joined: Oct 2010
Reputation: 0
Post: #1
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
Find all posts by this user Quote this message in a reply
Someone else Offline
Member

Posts: 180
Joined: Sep 2010
Reputation: 0
Post: #2
RE: Play sound only ONCE

Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);
11-09-2010 05:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
machosalad Offline
Junior Member

Posts: 38
Joined: Oct 2010
Reputation: 0
Post: #3
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
Find all posts by this user Quote this message in a reply
DamnNoHtml Offline
Senior Member

Posts: 469
Joined: Sep 2010
Reputation: 16
Post: #4
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?"

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
(This post was last modified: 11-09-2010 10:22 PM by DamnNoHtml.)
11-09-2010 10:22 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)