The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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?
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#1
How do I let a sound play ONLY inside an area?

I've been looking for an answer around the internet, but unfortunately without any succes.

So this is what I want to do:
You hear a sound playing (ambience) and when you walk into an abondoned looking house, the ambience suddenly changes. then when you walk out of the house, the ambience changes back to the ambience that it was before.

I've tried setting an area with StopSound(''Soundfile'', 0); at the entrance of the house. But it doesn't seem to work. I'll post the script here. (This is a map that I just started.)




////////////////////////////
// Run first time starting map
void OnStart()
{
}


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

void Kaas(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "00_loop.snt", "Player", 1, true);
}


void stophammertime(string &in asParent, string &in asChild, int alState)
{
StopSound("00_loop.snt", 0);
}



How do I do this?

[Image: 25F7U37.png]
(This post was last modified: 09-24-2012, 09:56 PM by Melvin.)
09-24-2012, 08:01 PM
Website Find


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



Users browsing this thread: 1 Guest(s)