Arma 3 Scripting

removeMissionEventHandler

  • Local effect
  • Arma 3 v0.50

Command · Markdown · JSON · original wiki page

Description

Removes mission event handler added by addMissionEventHandler.

Syntax

removeMissionEventHandler [type, index]

Parameters:

Returns: Nothing

Examples

Example 1

private _eventHandlerId = addMissionEventHandler ["Ended", { diag_log "mission complete"; }];
// ...
removeMissionEventHandler ["Ended", _eventHandlerId];

Example 2

for "_i" from 0 to 4 do {
    missionNamespace setVariable [format ["handler%1",_i], addMissionEventHandler ["Loaded","hint ""_i"";"]];
};
removeMissionEventHandler ["Loaded", handler2]; // Remove the third index under type "Loaded"

Example 3

addMissionEventHandler ["entityKilled",{hint "First kill!"; removeMissionEventHandler ["entityKilled", _thisEventHandler]; }];

See also

addMissionEventHandler · removeAllMissionEventHandlers

Community notes

SilentSpike

As of Arma 3 version 1.38 you can safely remove mission event handlers without worrying about decrementing higher indices.
EDIT: this command used to decrement other EH ids above the deleted one (e.g EH 0,1,2,3, delete EH 1, EH would be 0,1,2 now and not 0,2,3) - Lou Montana (talk) 19:29, 25 June 2020 (CEST)