SetMusic

From ZDoom Wiki
Jump to navigation Jump to search

void SetMusic (str song [, int order [, int unused]]);

Usage

SetMusic changes the music in the game.

Parameters

  • song:
  • The name of a music file to be played.
  • If song contains a /, then it is assumed to be a full path in a PK3 including music/ and the file extension. The file name may be longer than 8 characters.
  • If song is "*", then the default music as defined in MAPINFO will be played.
  • order:
  • If song refers to a tracker module (MOD), then order specifies the so-called order in the song to start playing at.
  • If song refers to a multi-track music file, then order is the track number belonging to the song you want to play.
  • If song is not a tracker module or a multi-track file, then order can be omitted.
  • unused: This parameter is currently defined but not used by ZDoom. It is recommended that you do not specify the third parameter at all.

Examples

Script 100 (int tid) // Boss battle
{
   SetMusic("BosFight", 0);

   ACS_Execute(666, 0, tid, 0, 0); // Starts a health tracker for the boss

   while (ThingCount(T_NONE, tid) > 0) delay(35);

   SetMusic("*", 0); // Restore the level's default music
}