SetMusic
void SetMusic (str song [, int order [, int unused]])
Usage
SetMusic changes the music in the game. 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 Nintendo Soundtrack File (NSF), then order is the track number belonging to the song you want to play on the NSF; otherwise, order is ignored. order is optional, so you do not need to specify it if you are not using a MOD or a multi-track NSF.
Additionally, you may also specify “*” instead of the name of a song, and the level's default music as defined in MAPINFO will be played.
Note that the third parameter is currently defined but not used by ZDoom. It is recommended that you do not specify the third parameter at all (as in the examples below), as this parameter may be used in the future.
Example
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
}