Arma 3 Scripting

BIS_fnc_music

  • Arma 3 v0.50
  • First in Arma 2: Operation Arrowhead v1.50

Function · Markdown · JSON · original wiki page

Description

Randomly play provided tracks defined in CfgMusic and does a 3 seconds fade out. This function takes accTime into account. See also BIS_fnc_jukebox.

Note

The function stores the script handle in the BIS_fnc_music_spawn variable that can be used to stop the function; see #Example 3 for its usage example.

Syntax

[tracklist, delay] call BIS_fnc_music

Parameters:

Returns: Nothing

Examples

Example 1

[["myMusic1", "myMusic2"], 1] call BIS_fnc_music; // play the two musics in a random order

Example 2

[] call BIS_fnc_music; // play all game tracks randomly

Example 3

[] call BIS_fnc_music;
private _startingPos = getPosWorld player;
private _timeLimit = time + 30;
waitUntil { sleep 1; getPosWorld player distance _startingPos > 50 || time > _timeLimit };
if (!isNil "BIS_fnc_music_spawn") then { terminate BIS_fnc_music_spawn };
playMusic "";

See also

playMusic · BIS_fnc_jukebox