playMusic: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Armed[ _]Assault(\|.*)]]" to "{{GameCategory|arma1|Scripting Commands}}")
m (Text replacement - "[] spawn" to "0 spawn")
 
(31 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| ofp |Game name=
|game1= ofp
|version1= 1.00


|1.00|Game version=
|game2= ofpe
|version2= 1.00


|eff= local |Multiplayer Effects=
|game3= arma1
|version3= 1.00


|gr1= Sounds |GROUP1=
|game4= arma2
____________________________________________________________________________________________
|version4= 1.00


| Plays music defined in [[Description.ext#CfgMusic|Description.ext's CfgMusic]] or config.cpp. If the ''musicName'' could not be found a message is logged into the .rpt file: <tt>Music <''musicName''> not found</tt>.
|game5= arma2oa
* [[Arma 3 CfgMusic]]
|version5= 1.50
* [[Arma 2: CfgMusic]]
 
* [[ArmA: CfgMusic]]
|game6= tkoh
|version6= 1.00


{{Informative | To stop the music, use {{Inline code|[[playMusic]] ""}}.}}
|game7= arma3
|version7= 0.50


{{Feature|arma3 | See [[Arma 3 CfgMusic]] for possible vanilla values. Since {{arma3}} v1.67 one can use the [[Arma_3_Utilities#Jukebox|Jukebox Utility]] to preview in-game music.}} |DESCRIPTION=
|eff= local
____________________________________________________________________________________________


| [[playMusic]] musicName |SYNTAX=
|gr1= Sounds


|p1= musicName: [[String]] - music classname |Parameter1=
|descr= Plays music defined in [[Description.ext#CfgMusic|Description.ext's CfgMusic]] or config.cpp. If the ''musicName'' could not be found a message is logged into the .rpt file: {{hl|Music <''musicName''> not found}}.
* [[Arma 3: CfgMusic]]
* [[Arma 2: CfgMusic]]
* [[ArmA: Armed Assault: CfgMusic]]
* [[Operation Flashpoint: CfgMusic]]


|[[Nothing]] |RETURNVALUE=
{{Feature|informative|To stop the music, use <sqf inline>playMusic "";</sqf>.}}
____________________________________________________________________________________________


|s2= [[playMusic]] [musicName, start] |SYNTAX2=
|s1= [[playMusic]] musicName


|p21= musicName: [[String]] - music classname |PARAMETER21=
|p1= musicName: [[String]] - music classname


|p22= start: [[Number]] - start, in seconds. Can be negative. |PARAMETER22=
|r1= [[Nothing]]


|r2= [[Nothing]] |RETURNVALUE2=
|s2= [[playMusic]] [musicName, start]
____________________________________________________________________________________________


|x1= <code>[[playMusic]] "RadioAmbient1";</code> |EXAMPLE1=
|p21= musicName: [[String]] - music classname


|x2= <code>[[playMusic]] ["RadioAmbient3", 3]; {{cc|start to play from 00:00:03}}</code> |EXAMPLE2=
|p22= start: [[Number]] - start, in seconds. Can be negative.


|x3= Play from 00:00:01 to 00:00:05:
|r2= [[Nothing]]
<code>[] [[spawn]] {
[[playMusic]] ["RadioAmbient5", 1];
[[sleep]] 4;
[[playMusic]] "";
};</code> |EXAMPLE3=


| [[getMusicPlayedTime]], [[playSound]], [[say]], [[createSoundSource]], [[addMusicEventHandler]], [[fadeMusic]] |SEEALSO=
|x1= <sqf>playMusic "RadioAmbient1";</sqf>
}}


<h3 style="display:none">Notes</h3>
|x2= <sqf>playMusic ["RadioAmbient3", 3]; // start to play from 00:00:03</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x3= Play from 00:00:01 to 00:00:05:
</dl>
<sqf>
0 spawn {
playMusic ["RadioAmbient5", 1];
sleep 4;
playMusic "";
};
</sqf>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[getMusicPlayedTime]] [[playSound]] [[say]] [[createSoundSource]] [[addMusicEventHandler]] [[fadeMusic]] [[Arma_3_Utilities#Jukebox|{{arma3}} Jukebox Utility]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands OFP 1.46|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma1|Scripting Commands}}
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Sounds|{{uc:{{PAGENAME}}}}]]

Latest revision as of 21:24, 2 September 2024

Hover & click on the images for description

Description

Description:
Plays music defined in Description.ext's CfgMusic or config.cpp. If the musicName could not be found a message is logged into the .rpt file: Music <musicName> not found.
To stop the music, use playMusic "";.
Groups:
Sounds

Syntax

Syntax:
playMusic musicName
Parameters:
musicName: String - music classname
Return Value:
Nothing

Alternative Syntax

Syntax:
playMusic [musicName, start]
Parameters:
musicName: String - music classname
start: Number - start, in seconds. Can be negative.
Return Value:
Nothing

Examples

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

Additional Information

See also:
getMusicPlayedTime playSound say createSoundSource addMusicEventHandler fadeMusic Arma 3 Jukebox Utility

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