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


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

Posts: 38
Threads: 8
Joined: Oct 2010
Reputation: 0
#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
Som1Lse Offline
Member

Posts: 183
Threads: 9
Joined: Sep 2010
Reputation: 0
#2
RE: Play sound only ONCE

Use this instead:
AddEntityCollideCallback("Player", "Area1", "PlaySound1", true, 0);
11-09-2010, 05:51 PM
Website Find
machosalad Offline
Junior Member

Posts: 38
Threads: 8
Joined: Oct 2010
Reputation: 0
#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
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#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




Users browsing this thread: 1 Guest(s)