playMusic: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Added getMusicPlayedTime to see also)
m (template:command argument fix)
Line 10: Line 10:


| Plays music defined in [[Description.ext#CfgMusic]] or config.cpp. To stop the music execute [[playMusic]] "" or give the start time which is beyond the music duration [[playMusic]] ["SomeMusic", 1000]; <br><br>
| Plays music defined in [[Description.ext#CfgMusic]] or config.cpp. To stop the music execute [[playMusic]] "" or give the start time which is beyond the music duration [[playMusic]] ["SomeMusic", 1000]; <br><br>
For Arma 3 music, see [[Arma 3 CfgMusic]]. Since Arma 3 v1.67 one can use [[Arma_3_Utilities#Jukebox|Jukebox Utility]] to preview in-game music. |= Description
For Arma 3 music, see [[Arma 3 CfgMusic]]. Since Arma 3 v1.67 one can use [[Arma_3_Utilities#Jukebox|Jukebox Utility]] to preview in-game music. |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''playMusic''' name |= Syntax
| '''playMusic''' name |SYNTAX=
| p1 = name : [[String]] - music class
| p1 = name : [[String]] - music class
|[[Nothing]]  |= Return value
|[[Nothing]]  |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
|s2= '''playMusic''' [name, start] |= Syntax 2
|s2= '''playMusic''' [name, start] |SYNTAX= 2


|p21= [name, start]: [[Array]] |= Parameter 1
|p21= [name, start]: [[Array]] |PARAMETER1=
|p22 = name: [[String]] - music class |= Parameter 2
|p22 = name: [[String]] - music class |PARAMETER2=
|p23= start: [[Number]] - start from (seconds). Could be negative. |= Parameter 3
|p23= start: [[Number]] - start from (seconds). Could be negative. |PARAMETER3=


|r2= [[Nothing]] |= Return value 2
|r2= [[Nothing]] |RETURNVALUE= 2


____________________________________________________________________________________________
____________________________________________________________________________________________
|x1 = <code>[[playMusic]] "RadioAmbient1";</code> |= Example 1  
|x1 = <code>[[playMusic]] "RadioAmbient1";</code> |EXAMPLE1=   
|x2 = <code>[[playMusic]] ["RadioAmbient3", 3]; //start from 00:00:03</code> |= Example 2
|x2 = <code>[[playMusic]] ["RadioAmbient3", 3]; //start from 00:00:03</code> |EXAMPLE2=
|x3 = Play from 00:00:01 to 00:00:05<code>0 = [] [[spawn]] {
|x3 = Play from 00:00:01 to 00:00:05<code>0 = [] [[spawn]] {
[[playMusic]] ["RadioAmbient5", 1];
[[playMusic]] ["RadioAmbient5", 1];
[[sleep]] 4;
[[sleep]] 4;
[[playMusic]] "";
[[playMusic]] "";
};</code> |= Example 3
};</code> |EXAMPLE3=


| [[getMusicPlayedTime]], [[playSound]], [[say]], [[createSoundSource]], [[addMusicEventHandler]] |= See also
| [[getMusicPlayedTime]], [[playSound]], [[say]], [[createSoundSource]], [[addMusicEventHandler]] |SEEALSO=


}}
}}

Revision as of 14:44, 7 April 2019

Hover & click on the images for description

Description

Description:
Plays music defined in Description.ext#CfgMusic or config.cpp. To stop the music execute playMusic "" or give the start time which is beyond the music duration playMusic ["SomeMusic", 1000];

For Arma 3 music, see Arma 3 CfgMusic. Since Arma 3 v1.67 one can use Jukebox Utility to preview in-game music.
Groups:
Uncategorised

Syntax

Syntax:
playMusic name
Parameters:
name : String - music class
Return Value:
Nothing

Alternative Syntax

Syntax:
playMusic [name, start]
Parameters:
[name, start]: Array
name: String - music class
start: Number - start from (seconds). Could be negative.
Return Value:
Nothing

Examples

Example 1:
playMusic "RadioAmbient1";
Example 2:
playMusic ["RadioAmbient3", 3]; //start from 00:00:03
Example 3:
Play from 00:00:01 to 00:00:050 = [] spawn { playMusic ["RadioAmbient5", 1]; sleep 4; playMusic ""; };

Additional Information

See also:
getMusicPlayedTimeplaySoundsaycreateSoundSourceaddMusicEventHandler

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

Notes

Crowe
You can get all Music Types from Arma:_cfgMusic http://community.bistudio.com/wiki/Arma_2:_Music#top

Bottom Section