playSound3D: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Added info on how to locate and play custom sounds added to a mission.)
(updated description based on info provided by BIS programmer)
Line 11: Line 11:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Plays a sound with given filename. At least 2 parameters must be added.  |= Description
| Plays positional sound with given filename on every computer on network. At least 2 parameters must be added.  |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''playSound3D''' [filename, source, isInside, position, volume, frequency, distance] |= Syntax
| '''playSound3D''' [filename, sound source, isInside, sound position, volume, sound pitch, distance] |= Syntax


|p1= [filename, source, isInside, position, volume, frequency, distance]: [[Array]]  |= PARAMETER1  
|p1= [filename, sound source, isInside, sound position, volume, sound pitch, distance]: [[Array]]  |= PARAMETER1  


|p2= filename: [[String]]  |= PARAMETER2
|p2= filename: [[String]]  |= PARAMETER2


|p3= source: [[Object]] |= PARAMETER3  
|p3= sound source: [[Object]] - the object emitting the sound. If "sound position" is specified this param is ignored |= PARAMETER3  


|p4= isInside: [[Boolean]] |= PARAMETER4  
|p4= isInside: [[Boolean]] (optional) |= PARAMETER4  


|p5= position: [[Position]]  |= PARAMETER5  
|p5= sound position: [[Position]] (optional) - position for sound emitter, will override "sound source" position. |= PARAMETER5  


|p6= volume: [[Number]] |= PARAMETER6  
|p6= volume: [[Number]] (optional) |= PARAMETER6  


|p7= frequency: [[Number]] |= PARAMETER7  
|p7= sound pitch: [[Number]] (optional) - 1: Normal (default), 0.5: Darth Vader, 2: Chipmunks, etc.    |= PARAMETER7  


|p8= distance: [[Number]] - How far is sound audible (0 <nowiki>=</nowiki> no max distance). |= PARAMETER8  
|p8= distance: [[Number]] (optional) - How far is sound audible (0 <nowiki>=</nowiki> no max distance). |= PARAMETER8  


| [[Nothing]] |= RETURNVALUE  
| [[Nothing]] |= RETURNVALUE  
Line 43: Line 43:
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= SEEALSO  
| [[say3D]], [[playSound]], [[say2D]], [[say]] |= SEEALSO  


|  |= MPBEHAVIOUR  
|  |= MPBEHAVIOUR  
Line 62: Line 62:
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''
<dd class="note">This command works well with addon sounds, however getting it to play mission sound files is a bit tricky. Follow [http://killzonekid.com/arma-scripting-tutorials-mission-root/ this guide]
<dd class="note">This command works well with addon sounds, however getting it to play mission sound files is a bit tricky. Follow [http://killzonekid.com/arma-scripting-tutorials-mission-root/ this guide]
<br><br>





Revision as of 23:08, 13 June 2014

Hover & click on the images for description

Description

Description:
Plays positional sound with given filename on every computer on network. At least 2 parameters must be added.
Groups:
Uncategorised

Syntax

Syntax:
playSound3D [filename, sound source, isInside, sound position, volume, sound pitch, distance]
Parameters:
[filename, sound source, isInside, sound position, volume, sound pitch, distance]: Array
filename: String
sound source: Object - the object emitting the sound. If "sound position" is specified this param is ignored
isInside: Boolean (optional)
sound position: Position (optional) - position for sound emitter, will override "sound source" position.
volume: Number (optional)
sound pitch: Number (optional) - 1: Normal (default), 0.5: Darth Vader, 2: Chipmunks, etc.
distance: Number (optional) - How far is sound audible (0 = no max distance).
Return Value:
Nothing

Examples

Example 1:
playSound3D ["A3\Sounds_F\sfx\blip1.wav", player]
Example 2:
playSound3D ["A3\Sounds_F\sfx\blip1.wav", player, false, getPos player, 1, 1, 0]
Example 3:
Sound file extension must be specified even if a config entry has none: playSound3D ["A3\Sounds_F\sfx\alarm_independent", player]; //no sound playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; //alarm

Additional Information

See also:
say3DplaySoundsay2Dsay

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

--JacmacBrian 08:21, 16 October 2013 (CEST)
Jacmac
You need to get the correct path for custom mission sounds. Use missionConfigFile with BIS_fnc_trimString (to trim off "description.ext"), then add your mission's sound directory and sound file: _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\some_sound_file.ogg"; playSound3D [_soundToPlay, _sourceObject, false, getPos _sourceObject, 10, 1, 50]; //Volume db+10, volume drops off to 0 at 50 meters from _sourceObject
Posted on September 23, 2013
Killzone_Kid
This command works well with addon sounds, however getting it to play mission sound files is a bit tricky. Follow this guide

Bottom Section