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?
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#3
RE: How do I let a sound play ONLY inside an area?

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 ScriptArea
    {
        PlaySoundAtEntity("houseamb", "00_loop.snt", "Player", 1, true);
    }
    if(alState == -1) //leaving the house ScriptArea
    {
        StopSound("houseamb", 0.5f);
//Add a line in here to add the music outside the house to play again
    }
}

Note: this is completely untested
(This post was last modified: 09-24-2012, 08:20 PM by Statyk.)
09-24-2012, 08:20 PM
Find


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



Users browsing this thread: 2 Guest(s)