Arma 3 Scripting

playSound3D

  • Global argument
  • Global effect
  • Arma 3 v0.50

Command · Markdown · JSON · original wiki page

Description

Plays positional sound with given filename on every computer on network. To stop the sound use stopSound

Syntax

playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset, local, loop]

Parameters:

Returns: Number - id of the sound (0..65535) (was Nothing before Arma 3 v2.12)

Examples

Example 1

playSound3D ["A3\Sounds_F\sfx\blip1.wss", player];

Example 2

playSound3D ["A3\Sounds_F\sfx\blip1.wss", player, false, getPosASL player, 1, 1, 0];

Example 3

playSound3D [getMissionPath "mySound.ogg", player]; // to play a mission directory sound

Example 4

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 5

Example 2 from Arma 3 v2.24

playSound3D ["A3\Sounds_F\sfx\blip1.wss", player, false, nil, 1, 1, 0];

See also

say3D · playSound · say2D · say · createSoundSource · setRandomLip · getMissionPath · playSoundUI · stopSound

Community notes

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.

Killzone_Kid

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.