Arma 3 Scripting

Command in Event Handlers, Sounds

addMusicEventHandler

Also available as Markdown and JSON, or read the original wiki page.

Description

Adds playMusic event handler. Returns id of the handler or -1 when failed. Like addMissionEventHandler, the music event handler is attached to the mission. See Arma 3: Event Handlers#Music Event Handlers.

Syntax

addMusicEventHandler [type, function]

Parameters:

Returns: Number - event handler id

Examples

Example 1

private _ehID = addMusicEventHandler ["MusicStart", { hint str _this }];

Example 2

private _ehID = addMusicEventHandler ["MusicStop", { hint str _this }];

See also

removeMusicEventHandler · playMusic · removeAllMusicEventHandlers · getEventHandlerInfo

Community notes

Druid

There are these two types at this time:

  • MusicStart - It is triggered when the music is started (command playMusic). In variable _this is stored class name from CfgMusic.
  • MusicStop - It is triggered when the music is ended (command playMusic). In variable _this is stored class name from CfgMusic.