Author Sticky: Post Working Scripts Here
NiTrIc Posted: Tuesday, 16 July 12:43AM
Name:Music Change
Function:Change the background music dynamically
Notes:You can put this script in the OnEnter part of an area, or OnUse, or whatever else you want to trigger the music change. My implimentation was in the OnEnter of a trigger so when you step on certain places of my inn, the music changes. If you wanted, you could easily add a random function to it, so as to pick music for you each time you entered an area or stepped on a trigger, or pulled a switch. Anyway, enough of this, here's the script.
NWScript:
void main()

{

  object this_area;

  this_area = GetArea(OBJECT_SELF);

  if (MusicBackgroundGetNightTrack(this_area) != 57)

  {

    MusicBackgroundChangeDay(this_area, 57);

    MusicBackgroundChangeNight(this_area, 57);

  }

}



Where the "57" is, is any track number in the ambientmusic.2da file. If you want to customize your music, there's a good tutorial in the Content forum.