BIS fnc music: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Some wiki formatting)
 
Line 13: Line 13:


|descr= Randomly play provided tracks defined in [[Description.ext#CfgMusic|CfgMusic]] and does a 3 seconds [[fadeMusic|fade out]]. This function takes [[accTime]] into account. See also [[BIS_fnc_jukebox]].
|descr= Randomly play provided tracks defined in [[Description.ext#CfgMusic|CfgMusic]] and does a 3 seconds [[fadeMusic|fade out]]. This function takes [[accTime]] into account. See also [[BIS_fnc_jukebox]].
{{Feature|informative|The function stores the script handle in the {{hl|BIS_fnc_music_spawn}} variable that can be used to stop the function; see {{Link|#Example 3}} for its usage example.}}


|s1= [tracklist, delay] call [[BIS_fnc_music]]
|s1= [tracklist, delay] call [[BIS_fnc_music]]
Line 22: Line 23:
|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <sqf>[["myMusic1", "myMusic2"], 1] call BIS_fnc_music;</sqf>
|x1= <sqf>[["myMusic1", "myMusic2"], 1] call BIS_fnc_music; // play the two musics in a random order</sqf>


|x2= <sqf>[] call BIS_fnc_music; // will play all game tracks</sqf>
|x2= <sqf>[] call BIS_fnc_music; // play all game tracks randomly</sqf>


|seealso= [[playMusic]] [[BIS_fnc_jukebox]]
|x3= <sqf>
}}
[] call BIS_fnc_music;
 
private _startingPos = getPosWorld player;
{{Note
private _timeLimit = time + 30;
|user= Hypoxic125
waitUntil { sleep 1; getPosWorld player distance _startingPos > 50 || time > _timeLimit };
|timestamp= 20240123034523
if (!isNil "BIS_fnc_music_spawn") then { terminate BIS_fnc_music_spawn };
|text= Script handle: <span style="color: blue;">bis_fnc_music_spawn</span> is created internally when called.
 
To terminate:
<sqf>
if (!isNil "bis_fnc_music_spawn") then {terminate bis_fnc_music_spawn};
playMusic "";
playMusic "";
</sqf>
</sqf>
|seealso= [[playMusic]] [[BIS_fnc_jukebox]]
}}
}}

Latest revision as of 13:34, 23 January 2024

Hover & click on the images for description

Description

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.
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.
Execution:
call
Groups:
Sound

Syntax

Syntax:
[tracklist, delay] call BIS_fnc_music
Parameters:
tracklist: Array of Strings - (Optional, default all game musics) a list of CfgMusic classes
delay: Number - (Optional, default 3) delay in seconds between tracks
Return Value:
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 "";

Additional Information

See also:
playMusic BIS_fnc_jukebox

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note