SetMusic

From ZDoom Wiki

Jump to: navigation, search

void SetMusic (str song [, int pattern [, int unused]])

Usage

Setmusic changes the music in the game. If song is a MOD, then pattern specifies the pattern in the song to start playing at. Otherwise pattern is ignored. Pattern is optional, so you don't need to specify it if you aren't using a MOD.

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
}
Personal tools