Music in a certain area - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: Music in a certain area (/thread-8310.html) |
Music in a certain area - Greven - 05-28-2011 Ok i need some help with music in a certain area. I have a big hall called castle halls which i want to have the soothing music while you are in this big hall. But the thing is it has many doors and level doors so im wondering how to make the music sound just in that hall. Sorry for the nooby question :3 RE: Music in a certain area - laser50 - 05-28-2011 I think there was a Sound space. On the line where you can also pick entities and stuff. Sorry i cannot tell more, I never used it. RE: Music in a certain area - xtron - 05-28-2011 If i get you correctly make a script and name it like "play_music_hall" Then make a script with the function: Code: PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume); RE: Music in a certain area - Greven - 05-28-2011 (05-28-2011, 08:57 PM)xtron Wrote: If i get you correctly make a script and name it like "play_music_hall" Thank you! :3 RE: Music in a certain area - xtron - 05-28-2011 Your welcome bud ^^ RE: Music in a certain area - palistov - 05-29-2011 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. RE: Music in a certain area - Greven - 05-30-2011 (05-29-2011, 10:28 AM)palistov Wrote: 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: Um for me it doesnt work, so im wondering if that is the whole script? Oh and ive changed the soothingmusicfile.ogg to amb_09safe RE: Music in a certain area - palistov - 05-30-2011 Did you create the grand_hall_area? Also, I mixed up the numbers in StopMusic :X sorry! The whole script will look like this void OnStart() { AddEntityCollideCallback("Player", "grand_hall_area", "MusicControl", false, 0); //more of your stuff here } 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(2, 0); } |