playSound3D: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Added info on how to locate and play custom sounds added to a mission.)
Line 52: Line 52:
<dl class='command_description'>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">--[[User:JacmacBrian|JacmacBrian]] 08:21, 16 October 2013 (CEST)
<dt class="note">'''[[User:JacmacBrian|Jacmac]]'''
<dd class="note">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:
<code>_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</code>
<dd class="notedate">Posted on September 23, 2013
<dd class="notedate">Posted on September 23, 2013
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''

Revision as of 07:21, 16 October 2013

Hover & click on the images for description

Description

Description:
Plays a sound with given filename. At least 2 parameters must be added.
Groups:
Uncategorised

Syntax

Syntax:
playSound3D [filename, source, isInside, position, volume, frequency, distance]
Parameters:
[filename, source, isInside, position, volume, frequency, distance]: Array
filename: String
source: Object
isInside: Boolean
position: Position
volume: Number
frequency: Number
distance: Number - 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:
See also needed

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