playSound3D: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(added defaults)
(Position ASL is needed)
Line 24: Line 24:
|p4= isInside: [[Boolean]] (optional) Default: [[false]]|= PARAMETER4  
|p4= isInside: [[Boolean]] (optional) Default: [[false]]|= PARAMETER4  


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


|p6= volume: [[Number]] (optional) Default: 1 |= PARAMETER6  
|p6= volume: [[Number]] (optional) Default: 1 |= PARAMETER6  
Line 36: Line 36:


|x1= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]]]</code>|= EXAMPLE1  
|x1= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]]]</code>|= EXAMPLE1  
|x2= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]], [[false]], [[getPos]] [[player]], 1, 1, 0]</code>|= EXAMPLE2  
|x2= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]], [[false]], [[getPosASL]] [[player]], 1, 1, 0]</code>|= EXAMPLE2  
|x3= Sound file extension must be specified even if a config entry has none:
|x3= Sound file extension must be specified even if a config entry has none:
<code>[[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent", [[player]]]; //no sound
<code>[[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent", [[player]]]; //no sound

Revision as of 14:49, 22 September 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 specified.
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) Default: false
sound position: PositionASL (optional) - position for sound emitter, will override "sound source" position. Default: [0,0,0]
volume: Number (optional) Default: 1
sound pitch: Number (optional) - 1: Normal, 0.5: Darth Vader, 2: Chipmunks, etc. Default: 1
distance: Number (optional) - How far is sound audible (0 = no max distance) Default: 0.
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, getPosASL 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