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
How do I let a sound play ONLY inside an area?
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#4
RE: How do I let a sound play ONLY inside an area?

(09-24-2012, 08:20 PM)Statyk Wrote: Try this:

void OnStart()
{
    PlaySoundAtEntity("", "07_amb_breath.snt", "Player", 1, true);
    AddEntityCollideCallback("Player", "HouseAmbience", "Kaas", false, 0);
}

void Kaas(string &in asParent, string &in asChild, int alState)
{
    if(alState == 1) //entering the house
    {
        PlaySoundAtEntity("houseamb", "00_loop.snt", "Player", 1, true);
    }
    if(alState == -1) //leaving the house
    {
        StopSound("houseamb", 0.5f);
//Add a line in here to add the music outside the house to play again
    }
}

Note: this is completely untested
I've done this a couple, three times and works like a charm.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
09-24-2012, 08:21 PM
Find


Messages In This Thread
RE: How do I let a sound play ONLY inside an area? - by i3670 - 09-24-2012, 08:21 PM



Users browsing this thread: 1 Guest(s)