LocalSetMusic

From ZDoom Wiki
Jump to: navigation, search

void LocalSetMusic (str song [, int order [, int unused]])

Usage

LocalSetMusic changes the music in the game, but unlike SetMusic, only affects the player who activated the script. If song refers to a tracker module (MOD), then order specifies the so-called order in the song to start playing at; otherwise, order is ignored. order is optional, so you do not need to specify it if you are not 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.

Examples

This command changes the currently-playing music to “D_DOOM” for the script activator:

LocalSetMusic("D_DOOM");

This command returns the music track to the default specified in MAPINFO:

LocalSetMusic("*");

This command changes the music to the 2nd order of the specified MOD:

LocalSetMusic("MYMOD", 2);