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
Music in a certain area
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#6
RE: Music in a certain area

You can use scripted collisions to control the music. Create an area that is as wide and long (height will not matter, as long as the player will walk through it) as the giant hall you are speaking of. Let's say you call it "grand_hall_area". In your OnStart() function put this:

AddEntityCollideCallback("Player", "grand_hall_area", "MusicControl", false, 0);


Then create the MusicControl function like this:

void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("soothingmusicfile.ogg", true, 1.0f, 0, 0, true);
if(alState == -1) StopMusic(0, 2);
}

This way, whenever the player enters the area (when alState is 1), the music will begin. When the player exits the area (alState is -1), the music will stop with a fade time of two seconds.

05-29-2011, 10:28 AM
Find


Messages In This Thread
Music in a certain area - by Greven - 05-28-2011, 08:25 PM
RE: Music in a certain area - by laser50 - 05-28-2011, 08:55 PM
RE: Music in a certain area - by xtron - 05-28-2011, 08:57 PM
RE: Music in a certain area - by Greven - 05-28-2011, 09:25 PM
RE: Music in a certain area - by xtron - 05-28-2011, 09:58 PM
RE: Music in a certain area - by palistov - 05-29-2011, 10:28 AM
RE: Music in a certain area - by Greven - 05-30-2011, 08:55 AM
RE: Music in a certain area - by palistov - 05-30-2011, 09:20 PM



Users browsing this thread: 1 Guest(s)