Difference between revisions of "Arma 3: Event Handlers/addMissionEventHandler"

From Bohemia Interactive Community
Jump to navigation Jump to search
(Fixed typo: Execudes -> Executes)
m (name before type, always...)
Line 112: Line 112:
 
* Does not have engine default functionality override like the original EH
 
* Does not have engine default functionality override like the original EH
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Array]] - leader selected units, same as [[groupSelectedUnits]] (same as <tt>_units</tt> param)
+
* units: [[Array]] - leader selected units, same as [[groupSelectedUnits]] (same as <tt>_units</tt> param)
* [[Array]] - world [[Position3D]] of the click in format [x,y,0] (same as <tt>_pos</tt> param)
+
* pos: [[Array]] - world [[Position3D]] of the click in format [x,y,0] (same as <tt>_pos</tt> param)
* [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed (same as <tt>_alt</tt> param)
+
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed (same as <tt>_alt</tt> param)
* [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed (same as <tt>_shift</tt> param)
+
* shift: [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed (same as <tt>_shift</tt> param)
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 125: Line 125:
 
Executes assigned code when user selects available HC group (<tt>F1,F2...</tt>). Stackable version of [[onHCGroupSelectionChanged]].
 
Executes assigned code when user selects available HC group (<tt>F1,F2...</tt>). Stackable version of [[onHCGroupSelectionChanged]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Group]] - group selected (same as <tt>_group</tt> param)
+
* group: [[Group]] - group selected (same as <tt>_group</tt> param)
* [[Boolean]] - [[true]] if selected (same as <tt>_isSelected</tt> param)
+
* isSelected: [[Boolean]] - [[true]] if selected (same as <tt>_isSelected</tt> param)
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 136: Line 136:
 
Executes assigned code when user switches to/from HC command mode (<tt>Left Shift + Space</tt>). Stackable version of [[onCommandModeChanged]].
 
Executes assigned code when user switches to/from HC command mode (<tt>Left Shift + Space</tt>). Stackable version of [[onCommandModeChanged]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* '''WIP''': Currently single [[Boolean]] is returned, but this is likely to change (same as <tt>_isHighCommand</tt> param)
+
* '''WIP''' - isHighCommand: Currently single [[Boolean]] is returned, but this is likely to change (same as <tt>_isHighCommand</tt> param)
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 147: Line 147:
 
Executes assigned code when user clicks on the HC group icon on the map. If [[groupIconSelectable]] is [[true]], LMB clicking (firing) at the HC group icon on the HUD will also trigger the event. To set group icon selectable use [[setGroupIconsSelectable]]. Stackable version of [[onGroupIconClick]].
 
Executes assigned code when user clicks on the HC group icon on the map. If [[groupIconSelectable]] is [[true]], LMB clicking (firing) at the HC group icon on the HUD will also trigger the event. To set group icon selectable use [[setGroupIconsSelectable]]. Stackable version of [[onGroupIconClick]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
+
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* [[Group]] - group the icon belonds to
+
* group: [[Group]] - group the icon belonds to
* [[Number]] - waypoint ID
+
* wpID: [[Number]] - waypoint ID
* [[Number]] - mouse button: 0 - LMB, 1 - RMB (only applicable to IconClick)
+
* mb: [[Number]] - mouse button: 0 - LMB, 1 - RMB (only applicable to IconClick)
* [[Number]] - screen X of the mouse
+
* posX: [[Number]] - screen X of the mouse
* [[Number]] - screen Y of the mouse
+
* posY: [[Number]] - screen Y of the mouse
* [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed
+
* shift: [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed
* [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
+
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
+
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 165: Line 165:
 
'''Continuously''' executes assigned code when user hovers with pointer over the HC group icon, either on the HUD or the main map. [[groupIconSelectable]] must be set to [[true]] for this EH to work at all. To set group icon selectable use [[setGroupIconsSelectable]]. When EH fires over the HUD icon, X and Y coordinates will change depending on the position of the pointer in relation to the icon area. When over main map, the X and Y do not change and indicate icon center. Stackable version of [[onGroupIconOverEnter]].
 
'''Continuously''' executes assigned code when user hovers with pointer over the HC group icon, either on the HUD or the main map. [[groupIconSelectable]] must be set to [[true]] for this EH to work at all. To set group icon selectable use [[setGroupIconsSelectable]]. When EH fires over the HUD icon, X and Y coordinates will change depending on the position of the pointer in relation to the icon area. When over main map, the X and Y do not change and indicate icon center. Stackable version of [[onGroupIconOverEnter]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
+
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* [[Group]] - group the icon belonds to
+
* group: [[Group]] - group the icon belonds to
* [[Number]] - waypoint ID
+
* wpID: [[Number]] - waypoint ID
* [[Number]] - screen X of the mouse
+
* posX: [[Number]] - screen X of the mouse
* [[Number]] - screen Y of the mouse
+
* posY: [[Number]] - screen Y of the mouse
* [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed
+
* shift: [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed
* [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
+
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
+
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 182: Line 182:
 
Executes assigned code when user moves the pointer away from HC group icon it was over. Fires either for on the HUD icons or the main map HC icons. [[groupIconSelectable]] must be set to [[true]] for this EH to work at all. To set group icon selectable use [[setGroupIconsSelectable]]. Stackable version of [[onGroupIconOverLeave]].
 
Executes assigned code when user moves the pointer away from HC group icon it was over. Fires either for on the HUD icons or the main map HC icons. [[groupIconSelectable]] must be set to [[true]] for this EH to work at all. To set group icon selectable use [[setGroupIconsSelectable]]. Stackable version of [[onGroupIconOverLeave]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
+
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* [[Group]] - group the icon belonds to
+
* group: [[Group]] - group the icon belonds to
* [[Number]] - waypoint ID
+
* wpID: [[Number]] - waypoint ID
* [[Number]] - screen X of the mouse
+
* posX: [[Number]] - screen X of the mouse
* [[Number]] - screen Y of the mouse (Y is always 0 when leaving HUD icon for some reason)
+
* posY: [[Number]] - screen Y of the mouse (Y is always 0 when leaving HUD icon for some reason)
* [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed
+
* shift: [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed
* [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
+
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
+
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 200: Line 200:
 
Executes assigned code when client joins the mission in MP. Stackable version of [[onPlayerConnected]].
 
Executes assigned code when client joins the mission in MP. Stackable version of [[onPlayerConnected]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Number]] - unique DirectPlay ID (very large number). It is also the same id used for user placed markers (same as <tt>_id</tt> param)
+
* id: [[Number]] - unique DirectPlay ID (very large number). It is also the same id used for user placed markers (same as <tt>_id</tt> param)
* [[String]] - [[getPlayerUID]] of the joining client. The same as Steam ID (same as <tt>_uid</tt> param)
+
* uid: [[String]] - [[getPlayerUID]] of the joining client. The same as Steam ID (same as <tt>_uid</tt> param)
* [[String]] - [[profileName]] of the joining client (same as <tt>_name</tt> param)
+
* name: [[String]] - [[profileName]] of the joining client (same as <tt>_name</tt> param)
* [[Boolean]] - [[didJIP]] of the joining client (same as <tt>_jip</tt> param)
+
* jip: [[Boolean]] - [[didJIP]] of the joining client (same as <tt>_jip</tt> param)
* [[Number]] - [[owner]] id of the joining client (same as <tt>_owner</tt> param)
+
* owner: [[Number]] - [[owner]] id of the joining client (same as <tt>_owner</tt> param)
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 214: Line 214:
 
Executes assigned code when client leaves the mission in MP. Stackable version of [[onPlayerDisconnected]].
 
Executes assigned code when client leaves the mission in MP. Stackable version of [[onPlayerDisconnected]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Number]] - unique DirectPlay ID (very large number). It is also the same id used for user placed markers (same as <tt>_id</tt> param)
+
* id: [[Number]] - unique DirectPlay ID (very large number). It is also the same id used for user placed markers (same as <tt>_id</tt> param)
* [[String]] - [[getPlayerUID]] of the leaving client. The same as Steam ID (same as <tt>_uid</tt> param)
+
* uid: [[String]] - [[getPlayerUID]] of the leaving client. The same as Steam ID (same as <tt>_uid</tt> param)
* [[String]] - [[profileName]] of the leaving client (same as <tt>_name</tt> param)
+
* name: [[String]] - [[profileName]] of the leaving client (same as <tt>_name</tt> param)
* [[Boolean]] - [[didJIP]] of the leaving client (same as <tt>_jip</tt> param)
+
* jip: [[Boolean]] - [[didJIP]] of the leaving client (same as <tt>_jip</tt> param)
* [[Number]] - [[owner]] id of the leaving client (same as <tt>_owner</tt> param)
+
* owner: [[Number]] - [[owner]] id of the leaving client (same as <tt>_owner</tt> param)
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}
Line 228: Line 228:
 
Executes assigned code when player teamswitches. Stackable version of [[onTeamSwitch]].
 
Executes assigned code when player teamswitches. Stackable version of [[onTeamSwitch]].
 
| <!-- Arguments -->
 
| <!-- Arguments -->
* [[Object]] - switching from unit (same as <tt>_from</tt> param)
+
* from: [[Object]] - switching from unit (same as <tt>_from</tt> param)
* [[Object]] - switching to unit (same as <tt>_to</tt> param)
+
* to: [[Object]] - switching to unit (same as <tt>_to</tt> param)
 
| <!-- Since -->
 
| <!-- Since -->
 
{{GVI|arma3|1.57}}
 
{{GVI|arma3|1.57}}

Revision as of 03:21, 8 May 2016

Mission Event Handlers

Description

Mission event handlers are specific EHs that are anchored to the running mission and automatically removed when mission is over. For all other available EHs see the main page.

Related Commands

Examples

handle1 = addMissionEventHandler ["Loaded",{playMusic "EventTrack03_F_EPB"}]; removeMissionEventHandler ["Loaded", handle1]; addMissionEventHandler ["HandleDisconnect",{diag_log _this}]; removeAllMissionEventHandlers "HandleDisconnect";

Events

Class Description Arguments Since

Draw3D

Runs the EH code each frame in unscheduled environment. Client side EH only (presence of UI). Will stop executing when UI loses focus (if user Alt+Tabs for example). Usually used with drawIcon3D, drawLine3D.

Introduced with Arma 3 version 0.500.50

Ended

Triggered when mission ends, either using trigger of type "End", endMission command, BIS_fnc_endMission function or ENDMISSION cheat.

Introduced with Arma 3 version 0.500.50

Loaded

Triggered when mission is loaded from save.

  • saveType: String - save type, can be have following values:
    • "save" - custom save, achieved by pressing SAVE button in the pause menu
    • "autosave" - automatic checkpoint, saved using saveGame command
    • "continue" - saved when leaving a mission to the main menu

Introduced with Arma 3 version 0.500.50

HandleDisconnect

Triggered when player disconnects from the game. Similar to onPlayerDisconnected event but can be stacked and contains the unit occupied by player before disconnect. Must be added on the server and triggers only on the server.

Override: If this EH code returns true, the unit, previously occupied by player, gets transferred to the server, becomes AI and continues to live, even with description.ext param disabledAI = 1;

Introduced with Arma 3 version 1.321.32

EntityRespawned

Triggered when an entity is respawned.

  • newEntity: Object - respawned entity
  • oldEntity: Object - corpse/wreck

Introduced with Arma 3 version 1.551.55

EntityKilled

Triggered when an entity is killed.

  • killed: Object - entity that was killed
  • killer: Object - the killer

Introduced with Arma 3 version 1.551.55

EachFrame

Executes assigned code each frame. Stackable version of onEachFrame.

Introduced with Arma 3 version 1.571.57

MapSingleClick

Executes assigned code when user clicks anywhere on the main map. Stackable version of onMapSingleClick with some limitations:

  • No arguments can be passed to the assigned code in comparison with the original EH
  • Does not have engine default functionality override like the original EH
  • units: Array - leader selected units, same as groupSelectedUnits (same as _units param)
  • pos: Array - world Position3D of the click in format [x,y,0] (same as _pos param)
  • alt: Boolean - true if Alt key was pressed (same as _alt param)
  • shift: Boolean - true if Shift key was pressed (same as _shift param)

Introduced with Arma 3 version 1.571.57

HCGroupSelectionChanged

Executes assigned code when user selects available HC group (F1,F2...). Stackable version of onHCGroupSelectionChanged.

  • group: Group - group selected (same as _group param)
  • isSelected: Boolean - true if selected (same as _isSelected param)

Introduced with Arma 3 version 1.571.57

CommandModeChanged

Executes assigned code when user switches to/from HC command mode (Left Shift + Space). Stackable version of onCommandModeChanged.

  • WIP - isHighCommand: Currently single Boolean is returned, but this is likely to change (same as _isHighCommand param)

Introduced with Arma 3 version 1.571.57

GroupIconClick

Executes assigned code when user clicks on the HC group icon on the map. If groupIconSelectable is true, LMB clicking (firing) at the HC group icon on the HUD will also trigger the event. To set group icon selectable use setGroupIconsSelectable. Stackable version of onGroupIconClick.

  • is3D: Boolean - true if HUD icon, false if main map icon
  • group: Group - group the icon belonds to
  • wpID: Number - waypoint ID
  • mb: Number - mouse button: 0 - LMB, 1 - RMB (only applicable to IconClick)
  • posX: Number - screen X of the mouse
  • posY: Number - screen Y of the mouse
  • shift: Boolean - true if Shift key was pressed
  • ctrl: Boolean - true if Ctrl key was pressed
  • alt: Boolean - true if Alt key was pressed

Introduced with Arma 3 version 1.571.57

GroupIconOverEnter

Continuously executes assigned code when user hovers with pointer over the HC group icon, either on the HUD or the main map. groupIconSelectable must be set to true for this EH to work at all. To set group icon selectable use setGroupIconsSelectable. When EH fires over the HUD icon, X and Y coordinates will change depending on the position of the pointer in relation to the icon area. When over main map, the X and Y do not change and indicate icon center. Stackable version of onGroupIconOverEnter.

Introduced with Arma 3 version 1.571.57

GroupIconOverLeave

Executes assigned code when user moves the pointer away from HC group icon it was over. Fires either for on the HUD icons or the main map HC icons. groupIconSelectable must be set to true for this EH to work at all. To set group icon selectable use setGroupIconsSelectable. Stackable version of onGroupIconOverLeave.

  • is3D: Boolean - true if HUD icon, false if main map icon
  • group: Group - group the icon belonds to
  • wpID: Number - waypoint ID
  • posX: Number - screen X of the mouse
  • posY: Number - screen Y of the mouse (Y is always 0 when leaving HUD icon for some reason)
  • shift: Boolean - true if Shift key was pressed
  • ctrl: Boolean - true if Ctrl key was pressed
  • alt: Boolean - true if Alt key was pressed

Introduced with Arma 3 version 1.571.57

PlayerConnected

Executes assigned code when client joins the mission in MP. Stackable version of onPlayerConnected.

  • id: Number - unique DirectPlay ID (very large number). It is also the same id used for user placed markers (same as _id param)
  • uid: String - getPlayerUID of the joining client. The same as Steam ID (same as _uid param)
  • name: String - profileName of the joining client (same as _name param)
  • jip: Boolean - didJIP of the joining client (same as _jip param)
  • owner: Number - owner id of the joining client (same as _owner param)

Introduced with Arma 3 version 1.571.57

PlayerDisconnected

Executes assigned code when client leaves the mission in MP. Stackable version of onPlayerDisconnected.

  • id: Number - unique DirectPlay ID (very large number). It is also the same id used for user placed markers (same as _id param)
  • uid: String - getPlayerUID of the leaving client. The same as Steam ID (same as _uid param)
  • name: String - profileName of the leaving client (same as _name param)
  • jip: Boolean - didJIP of the leaving client (same as _jip param)
  • owner: Number - owner id of the leaving client (same as _owner param)

Introduced with Arma 3 version 1.571.57

TeamSwitch

Executes assigned code when player teamswitches. Stackable version of onTeamSwitch.

  • from: Object - switching from unit (same as _from param)
  • to: Object - switching to unit (same as _to param)

Introduced with Arma 3 version 1.571.57

PreloadStarted

Executes assigned code before the mission preload screen. Stackable version of onPreloadStarted.

Introduced with Arma 3 version 1.571.57

PreloadFinished

Executes assigned code after the mission preload screen. Stackable version of onPreloadFinished.

Introduced with Arma 3 version 1.571.57