Killzone_Kid
Currently, playSound3D is not JIP compatible, so joining players will not hear the sound if is started before and is still playing when player joins.
Results appear below as you type; use the arrow keys to move through them.
Plays positional sound with given filename on every computer on network. To stop the sound use stopSound
playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset, local, loop]
Parameters:
filename: String - see Arma 3: Sound Files for available file names or #Example 3 to use mission files
Important
Since Arma 3 v2.10 the file name can start with a leading backslash
**\**a3\....However a leading backslash must not be used for an addon sound file.
soundSource: Object - the object emitting the sound. If soundPosition below is specified this parameter is ignored
isInside: Boolean - (Optional, default false) - true to simulate a sound played inside a building or similar
soundPosition: PositionASL - (Optional, default nil) position for sound emitter, overrides soundSource. Object is also supported (see note below). Since Arma 3 v2.24 use nil to skip this param
Note
If a following parameter has to be used, simply use
getPosASL _soundSourcefor soundPosition instead of_soundSourcefor soundSource.
Important
This parameter also takes Object but their AGL position is used instead of ASL resulting in sound source being underground if they're above ground, always use PositionASL instead.
volume: Number - (Optional, default 1) sound volume. A value greater than 5 gets capped
soundPitch: Number - (Optional, default 1)
distance: Number - (Optional, default 0) how far the sound is audible, in meters. 0 means no maximum distance
offset: Number - (Optional, default 0) offset in seconds. Same as with playMusic (ignored if sound is set to play repeatedly, see 'loop') (since arma3 2.00)
local: Boolean - (Optional, default false) if true the sound will not be broadcast over network (since arma3 2.06)
loop: Boolean - (Optional, default false) if true the sound will repeat indefinitely. In MP, requires 'local' to be set to true. Use stopSound to stop. (since arma3 2.22)
Returns: Number - id of the sound (0..65535) (was Nothing before Arma 3 v2.12)
playSound3D ["A3\Sounds_F\sfx\blip1.wss", player];
playSound3D ["A3\Sounds_F\sfx\blip1.wss", player, false, getPosASL player, 1, 1, 0];
playSound3D [getMissionPath "mySound.ogg", player]; // to play a mission directory sound
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
Example 2 from Arma 3 v2.24
playSound3D ["A3\Sounds_F\sfx\blip1.wss", player, false, nil, 1, 1, 0];
say3D · playSound · say2D · say · createSoundSource · setRandomLip · getMissionPath · playSoundUI · stopSound
Currently, playSound3D is not JIP compatible, so joining players will not hear the sound if is started before and is still playing when player joins.
When object is supplied but not a position, the position is taken from object, otherwise the position is taken from supplied position. That doesn't mean that when position is taken from object it is going to follow object when it changes position. The sound is generated at object position and it stays there.
One other important note: If soundSource param is objNull then this command develops the same bug with first person view as createSoundSource and say3D. If soundSource is player then the bug is inverted. It seems that passing vehicle player as soundSource param is the only way to make it behave correctly when vehicles involved.
The sound will be distorted according to the https://en.wikipedia.org/wiki/Doppler_effect when passing by the sound source quickly.
Wait for sound to end:
private _sound = playSound3D ["A3\Sounds_F\sfx\blip1.wss", player];
waitUntil { soundParams _sound isEqualTo [] };