Mission Event Handlers – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
(37 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<!-------------------------------------------------------------------------------------->
__NOEDITSECTION__
= Mission Event Handlers =
{{SideTOC}}
 
{{EffArg|com|eff|loc}}


== Description ==
== 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 [[Arma_3:_Event_Handlers|main page]].
Mission event handlers are specific EHs that are anchored to the running mission and automatically removed when mission is over.
These events fire only on the machine where they have been added.<br>
For all other available EHs see the [[Arma_3:_Event_Handlers|Event Handlers main page]].
 


== Related Commands ==
== Related Commands ==
Line 12: Line 17:
* [[removeAllMissionEventHandlers]]
* [[removeAllMissionEventHandlers]]


== Examples ==


<code>handle1 = [[addMissionEventHandler]] ["Loaded",{[[playMusic]] "EventTrack03_F_EPB"}];
== Events ==
[[removeMissionEventHandler]] ["Loaded", handle1];
 
[[addMissionEventHandler]] ["HandleDisconnect",{[[diag_log]] _this}];
{{Cfg ref|start}}
[[removeAllMissionEventHandlers]] "HandleDisconnect";</code>
{{Cfg ref|abc}}
{{ArgTitle|BuildingChanged|4|{{GVI|arma3|1.68}}}}
Fired each time a building model changes, for example due to stages of destruction.
<syntaxhighlight lang="cpp">
addMissionEventHandler ["BuildingChanged", {
params ["_previousObject", "_newObject", "_isRuin"];
}];
</syntaxhighlight>
 
* from: [[Object]] - building it changes from
* to: [[Object]] - building it changes to
* isRuin: [[Boolean]] - [[true]] if changes to ruins
 
 
{{ArgTitle|CommandModeChanged|4|{{GVI|arma3|1.57}}}}
Executes assigned code when user switches to/from HC command mode (<tt>Left Shift + Space</tt>). Stackable version of [[onCommandModeChanged]].
<syntaxhighlight lang="cpp">
addMissionEventHandler ["CommandModeChanged", {
params ["_isHighCommand", "_isForced"];
}];
</syntaxhighlight>
 
* isHighCommand: [[Boolean]] - same as <tt>_isHighCommand</tt> param
* isForced: [[Boolean]] - [[true]] if command mode was forced
 
 
{{ArgTitle|ControlsShifted|4|{{GVI|arma3|1.00}}}}
Triggers when control of a vehicle is shifted (pilot->co-pilot, co-pilot->pilot), usually when user performs an [[action]] such as [[action/Arma_3_Actions_List#TakeVehicleControl | TakeVehicleControl]], [[action/Arma_3_Actions_List#SuspendVehicleControl | SuspendVehicleControl]], [[action/Arma_3_Actions_List#UnlockVehicleControl | UnlockVehicleControl]], [[action/Arma_3_Actions_List#LockVehicleControl | LockVehicleControl]], or when [[enableCopilot]] command is used. This event handler will always fire on the PC where [[action]] is triggered as well as where the vehicle is [[local]] at the time. When control of the vehicle is shifted, the locality of the vehicle changes to the locality of the new controller. Since Arma 3 v1.95.146023 this EH is extended with additional params.
<syntaxhighlight lang="cpp">
addMissionEventHandler ["ControlsShifted", {
params ["_newController", "_oldController", "_vehicle", "_copilotEnabled", "_controlsUnlocked"];
}];
</syntaxhighlight>
 
* newController: [[Object]] - unit currently controlling the vehicle
* oldController: [[Object]] - unit previously controlling the vehicle
* vehicle: [[Object]] - the vehicle for which controls shifted
* copilotEnabled: [[Boolean]] - [[true]] if copilot is enabled
* controlsUnlocked: [[Boolean]] - [[true]] if controls are unlocked
 


== Events ==
{{ArgTitle|Draw3D|4|{{GVI|arma3|0.50}}}}
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]].
<syntaxhighlight lang="cpp">
addMissionEventHandler ["Draw3D", {
// no params
}];
</syntaxhighlight>


{| class="wikitable sortable"
! Class
! class="unsortable" | Description
! class="unsortable" | Arguments
! Since


|-
{{ArgTitle|EachFrame|4|{{GVI|arma3|1.57}}}}
| <!-- Title -->
Executes assigned code each frame. Stackable version of [[onEachFrame]].
==== Draw3D ====
<syntaxhighlight lang="cpp">
| <!-- Description -->
addMissionEventHandler ["EachFrame", {
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]].
// no params
| <!-- Arguments -->
}];
| <!-- Since -->
</syntaxhighlight>
{{GVI|arma3|0.50}}


|-
| <!-- Title -->
==== Ended ====
| <!-- Description -->
Triggered when mission ends, either using trigger of type "End", [[endMission]] command, [[BIS_fnc_endMission]] function or ENDMISSION cheat.
| <!-- Arguments -->
* endType: [[String]] - mission end type. Used in [[Debriefing]] among other things.
| <!-- Since -->
{{GVI|arma3|0.50}}


|-
{{ArgTitle|Ended|4|{{GVI|arma3|0.50}}}}
| <!-- Title -->
Triggered when mission ends, either using trigger of type "End", [[endMission]] command, [[BIS_fnc_endMission]] function or [[ArmA:_Cheats#ENDMISSION|ENDMISSION]] cheat.
==== Loaded ====
<syntaxhighlight lang="cpp">
| <!-- Description -->
addMissionEventHandler ["Ended", {
Triggered when mission is loaded from save.
params ["_endType"];
| <!-- Arguments -->
}];
* saveType: [[String]] - save type, can be have following values:
</syntaxhighlight>
** "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
| <!-- Since -->
{{GVI|arma3|0.50}}


|-
* endType: [[String]] - mission end type. Used in [[Debriefing]] among other things.
| <!-- Title -->
==== Map ====
| <!-- Description -->
Triggered when map is opened or closed either by user action or script command [[openMap]].
| <!-- Arguments -->
* mapIsOpened: [[Boolean]] - [[true]] if map is opened
* mapIsForced: [[Boolean]] - [[true]] if map is forced


| <!-- Since -->
{{ArgTitle|MPEnded|4|{{GVI|arma3|1.60}}}}
{{GVI|arma3|1.62}}
Triggered when the server switches off from "playing" state (mission ends, server closes, etc.) It's only for MP games, it is called on server and also on clients. It's not called on clients when client disconnects from server (and mission continues). This EH has no arguments passed to the code.
|-
<syntaxhighlight lang="cpp">
| <!-- Title -->
addMissionEventHandler ["MPEnded", {
==== HandleDisconnect ====
// code to execute
| <!-- Description -->
}];
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.
</syntaxhighlight>
| <!-- Arguments -->
* unit: [[Object]] - unit formerly occupied by player
* id: [[Number]] - same as _id in [[onPlayerDisconnected]]
* uid: [[String]] - same as _uid in [[onPlayerDisconnected]]
* name: [[String]] - same as _name in [[onPlayerDisconnected]]
'''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;''
| <!-- Since -->
{{GVI|arma3|1.32}}


|-
{{ArgTitle|EntityKilled|4|{{GVI|arma3|1.55}}}}
| <!-- Title -->
Triggered when an entity is killed.  
==== EntityRespawned ====
<syntaxhighlight lang="cpp">
| <!-- Description -->
addMissionEventHandler ["EntityKilled", {
Triggered when an entity is respawned.
params ["_unit", "_killer", "_instigator", "_useEffects"];
| <!-- Arguments -->
}];
* newEntity: [[Object]] - respawned entity
</syntaxhighlight>
* oldEntity: [[Object]] - corpse/wreck
| <!-- Since -->
{{GVI|arma3|1.55}}


|-
| <!-- Title -->
==== EntityKilled ====
| <!-- Description -->
Triggered when an entity is killed.
| <!-- Arguments -->
* killed: [[Object]] - entity that was killed
* killed: [[Object]] - entity that was killed
* killer: [[Object]] - the killer (vehicle or person)
* killer: [[Object]] - the killer (vehicle or person)
(Since Arma 3 v1.65)<br>
* {{GVI|arma3|1.65}} instigator: [[Object]] - person who pulled the trigger
* instigator: [[Object]] - person who pulled the trigger
* {{GVI|arma3|1.67}} useEffects: [[Boolean]] - same as ''useEffects'' in [[setDamage]] alt syntax
| <!-- Since -->
----
{{GVI|arma3|1.55}}
 
It's worth noting that ''instigator'' param is [[objNull]] during road kill. To work around this issue try:
[[addMissionEventHandler]] ["EntityKilled",
{
[[params]] ["_killed", "_killer", "_instigator"];
[[if]] ([[isNull]] _instigator) [[then]] {_instigator = [[UAVControl]] [[vehicle]] _killer [[select]] 0}; {{codecomment|// UAV/UGV player operated road kill}}
[[if]] ([[isNull]] _instigator) [[then]] {_instigator = _killer}; {{codecomment|// player driven vehicle road kill}}
[[hint]] [[format]] ["Killed By %1", [[name]] _instigator];
}];


|-
{{ArgTitle|EntityRespawned|4|{{GVI|arma3|1.55}}}}
| <!-- Title -->
Triggered when an entity is respawned.
<syntaxhighlight lang="cpp">
addMissionEventHandler ["EntityRespawned", {
params ["_entity", "_corpse"];
}];
</syntaxhighlight>


==== EachFrame ====
* newEntity: [[Object]] - respawned entity
| <!-- Description -->
* oldEntity: [[Object]] - corpse/wreck
Executes assigned code each frame. Stackable version of [[onEachFrame]].
| <!-- Arguments -->
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
| <!-- Title -->
==== MapSingleClick ====
| <!-- Description -->
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
| <!-- Arguments -->
* units: [[Array]] - leader selected units, same as [[groupSelectedUnits]] (same as <tt>_units</tt> param)
* pos: [[Array]] - world [[Position3D]] of the click in format [x,y,0] (same as <tt>_pos</tt> param)
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed (same as <tt>_alt</tt> param)
* shift: [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed (same as <tt>_shift</tt> param)
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
{{ArgTitle|ExtensionCallback|4|{{GVI|arma3|1.95}}}}
| <!-- Title -->
Triggered when an [[callExtension | extension]] calls provided function pointer with 3 params.
==== HCGroupSelectionChanged ====
<syntaxhighlight lang="cpp">
| <!-- Description -->
addMissionEventHandler ["ExtensionCallback", {
Executes assigned code when user selects available HC group (<tt>F1,F2...</tt>). Stackable version of [[onHCGroupSelectionChanged]].
params ["_name", "_function", "_data"];
| <!-- Arguments -->
}];
* group: [[Group]] - group selected (same as <tt>_group</tt> param)
</syntaxhighlight>
* isSelected: [[Boolean]] - [[true]] if selected (same as <tt>_isSelected</tt> param)
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
* name: [[String]] - user provided param
| <!-- Title -->
* function: [[String]] - user provided param
==== CommandModeChanged ====
* data: [[String]] - user provided param
| <!-- Description -->
Executes assigned code when user switches to/from HC command mode (<tt>Left Shift + Space</tt>). Stackable version of [[onCommandModeChanged]].
| <!-- Arguments -->
* isHighCommand: [[Boolean]] - same as <tt>_isHighCommand</tt> param
* IsForced: [[Boolean]] - [[true]] if command mode was forced 
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
| <!-- Title -->


==== GroupIconClick ====
{{ArgTitle|GroupIconClick|4|{{GVI|arma3|1.57}}}}
| <!-- Description -->
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 -->
<syntaxhighlight lang="cpp">
addMissionEventHandler ["GroupIconClick", {
params [
"_is3D", "_group", "_waypointId",
"_mouseButton", "_posX", "_posY",
"_shift", "_control", "_alt"
];
}];
</syntaxhighlight>
 
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* group: [[Group]] - group the icon belonds to
* group: [[Group]] - group the icon belonds to
Line 171: Line 168:
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
 
| <!-- Title -->
{{ArgTitle|GroupIconOverEnter|4|{{GVI|arma3|1.57}}}}
==== GroupIconOverEnter ====
| <!-- Description -->
'''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 -->
<syntaxhighlight lang="cpp">
addMissionEventHandler ["GroupIconOverEnter", {
params [
"_is3D", "_group", "_waypointId",
"_posX", "_posY",
"_shift", "_control", "_alt"
];
}];
</syntaxhighlight>
 
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* group: [[Group]] - group the icon belonds to
* group: [[Group]] - group the icon belonds to
Line 188: Line 190:
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
 
| <!-- Title -->
{{ArgTitle|GroupIconOverLeave|4|{{GVI|arma3|1.57}}}}
==== GroupIconOverLeave ====
| <!-- Description -->
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 -->
<syntaxhighlight lang="cpp">
addMissionEventHandler ["GroupIconOverLeave", {
params [
"_is3D", "_group", "_waypointId",
"_posX", "_posY",
"_shift", "_control", "_alt"
];
}];
</syntaxhighlight>
 
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* is3D: [[Boolean]] - [[true]] if HUD icon, [[false]] if main map icon
* group: [[Group]] - group the icon belonds to
* group: [[Group]] - group the icon belonds to
Line 205: Line 212:
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* ctrl: [[Boolean]] - [[true]] if <tt>Ctrl</tt> key was pressed
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
| <!-- Title -->


==== PlayerConnected ====
{{ArgTitle|HandleAccTime|4|{{GVI|arma3|1.90}}}}
| <!-- Description -->
Fires when user changes time acceleration with +/- keys in SP or [[setAccTime]] command. If the code returns [[true]] the on-screen message confirming the change is not displayed. Doesn't fire if desired value is already set.
<syntaxhighlight lang="cpp">
addMissionEventHandler ["HandleAccTime", {
params ["_currentTimeAcc", "_prevTimeAcc", "_messageSuppressed"];
}];
</syntaxhighlight>
 
* currentTimeAcc: [[Number]] - current value
* prevTimeAcc: [[Number]] - previous value
* messageSuppressed: [[Boolean]] - [[true]] if on-screen message was suppressed
 
 
{{ArgTitle|HandleChatMessage|4|{{GVI|arma3dev|1.99}}}}
Fires when a message is received, before adding it to the chat feed. Fires clientside. The output message could be overridden:
* Return [[true]] to block incoming chat message from being added to the chat feed.
* Return [[String]] to replace the chat message content but not the sender name.
* Return [[Array]] [from, text] to replace both the chat message content and the the sender's name.
{{Informative | Only the last added EH with override will be used to override the message.}}
{{Warning | Do not put any of the chat related script command such as [[systemChat]], [[sideChat]], etc in this EH code as it would naturally cause recursion and the game will freeze.}}
<syntaxhighlight lang="cpp">
addMissionEventHandler ["HandleChatMessage", {
params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
}];
</syntaxhighlight>
 
* channel: [[Number]] - See [[Description.ext#disableChannels|radio channel indexes]] (16 for system chat message for example)
* owner: [[Number]] - [[owner]] id of the sender:
** In SP: 0
** In MP with no sender: [[clientOwner]]
** In MP with sender: sender's [[clientOwner]], or if AI - creator id part of [[netId]] of the AI
* from: [[String]] - sender's formatted name as appeared on the chat
* text: [[String]] - the chat message
* person: [[Object]] - sender's object
* name: [[String]] - sender's [[name]], could be different from <tt>from</tt>
* strID: [[String]] - sender's network player ID (marker id):
** "-1": means not available
** "0": means [[player | isPlayer]] in SP
** "1": means AI in SP or MP
** >1: [[getPlayerID]] in MP
* forcedDisplay: [[Boolean]] - if display was forced
* isPlayerMessage: [[Boolean]] - if is player message
* sentenceType: [[Number]] - 0: Normal type, 1: Protocol type
* chatMessageType: [[Number]] - 0: Generic type, 1: SimpleMove type, 2: KillConfirmation type
 
 
{{ArgTitle|HandleDisconnect|4|{{GVI|arma3|1.32}}&nbsp;<div class{{=}}"gvi">[[Image:Exec_Server.gif]]</div>}}
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.
<syntaxhighlight lang="cpp">
addMissionEventHandler ["HandleDisconnect", {
params ["_unit", "_id", "_uid", "_name"];
true;
}];
</syntaxhighlight>
 
* unit: [[Object]] - unit formerly occupied by player
* id: [[Number]] - same as _id in [[onPlayerDisconnected]]
* uid: [[String]] - same as _uid in [[onPlayerDisconnected]]
* name: [[String]] - same as _name in [[onPlayerDisconnected]]
'''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;''
 
 
{{ArgTitle|HCGroupSelectionChanged|4|{{GVI|arma3|1.57}}}}
Executes assigned code when user selects available HC group (<tt>F1, F2…</tt>). Stackable version of [[onHCGroupSelectionChanged]].
<syntaxhighlight lang="cpp">
addMissionEventHandler ["HCGroupSelectionChanged", {
params ["_group", "_isSelected"];
}];
</syntaxhighlight>
 
* group: [[Group]] - group selected (same as <tt>_group</tt> param)
* isSelected: [[Boolean]] - [[true]] if selected (same as <tt>_isSelected</tt> param)
 
 
{{ArgTitle|Loaded|4|{{GVI|arma3|0.50}}}}
Triggered when mission is loaded from save. <br>
{{Warning | "Loaded" event handler should be added <u>BEFORE</u> the mission is loaded from save. Placing it in a [[Functions_Library_(Arma_3)|function]] with preInit {{=}} 1; usually does the trick.}}
<syntaxhighlight lang="cpp">
addMissionEventHandler ["Loaded", {
params ["_saveType"];
}];
</syntaxhighlight>
 
* 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
 
 
{{ArgTitle|Map|4|{{GVI|arma3|1.62}}}}
Triggered when map is opened or closed either by user action or script command [[openMap]].
<syntaxhighlight lang="cpp">
addMissionEventHandler ["Map", {
params ["_mapIsOpened", "_mapIsForced"];
}];
</syntaxhighlight>
 
* mapIsOpened: [[Boolean]] - [[true]] if map is opened
* mapIsForced: [[Boolean]] - [[true]] if map is forced
 
 
{{ArgTitle|MapSingleClick|4|{{GVI|arma3|1.57}}}}
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
<syntaxhighlight lang="cpp">
addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
}];
</syntaxhighlight>
 
* units: [[Array]] - leader selected units, same as [[groupSelectedUnits]] (same as <tt>_units</tt> param)
* pos: [[Array]] - world [[Position3D]] of the click in format [x,y,0] (same as <tt>_pos</tt> param)
* alt: [[Boolean]] - [[true]] if <tt>Alt</tt> key was pressed (same as <tt>_alt</tt> param)
* shift: [[Boolean]] - [[true]] if <tt>Shift</tt> key was pressed (same as <tt>_shift</tt> param)
 
 
{{ArgTitle|PlayerConnected|4|{{GVI|arma3|1.57}}&nbsp;<div class{{=}}"gvi">[[File:Exec_Server.gif]]</div>}}
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 -->
<syntaxhighlight lang="cpp">
addMissionEventHandler ["PlayerConnected",
{
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
}];
</syntaxhighlight>
 
* 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)
* 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)
* uid: [[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)
Line 220: Line 345:
* jip: [[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)
* owner: [[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 -->
* idstr: [[String]] - same as id but in string format, so could be exactly compared to [[allMapMarkers | user marker]] ids
{{GVI|arma3|1.57}}
----
 
If dedicated server was started without '-autoInit' option and this EH was created on server, on first GUI client this EH also fires against server, but after first client.
In mission's initServer.sqf:
handlercon = [[addMissionEventHandler]] ["PlayerConnected",
{
[[diag_log]] "Client connected";
[[diag_log]] [[_this]];
}];
In RPT:
2016/12/16, 15:39:09 "Client connected"
2016/12/16, 15:39:09 [1.51343e+009,"7xxxxxxxxxxxxxxx1","longbow",false,3,"1513430065"]
2016/12/16, 15:39:34  Mission id: 5071d20b183e9580d0ee4f95f413ca18681d6165
2016/12/16, 15:39:34 "Client connected"
2016/12/16, 15:39:34 [2,"","__SERVER__",false,2,"2"]
That happens only for GUI clients, if HC client connects first, EH does not fire for server.<br>
If dedicated server was started with -autoInit option, this EH does not fire against server, only for future clients, and all further clients appear to be JIPped.<br>
Interesting moment for headless clients, for headless clients instead of [[getPlayerUID]], handler gets string like "HC12160", where '12160' is headless client process ID (matches HC's PID observed in windows task manager)
 


|-
{{ArgTitle|PlayerDisconnected|4|{{GVI|arma3|1.57}}&nbsp;<div class{{=}}"gvi">[[File:Exec_Server.gif]]</div>}}
| <!-- Title -->
==== PlayerDisconnected ====
| <!-- Description -->
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 -->
<syntaxhighlight lang="cpp">
addMissionEventHandler ["PlayerDisconnected",
{
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
}];
</syntaxhighlight>
 
* 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)
* 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)
* uid: [[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)
Line 234: Line 380:
* jip: [[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)
* owner: [[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 -->
* idstr: [[String]] - same as id but in string format, so could be exactly compared to [[allMapMarkers | user marker]] ids
{{GVI|arma3|1.57}}
 
|-
| <!-- Title -->
==== TeamSwitch ====
| <!-- Description -->
Executes assigned code when player teamswitches. Stackable version of [[onTeamSwitch]].
| <!-- Arguments -->
* from: [[Object]] - switching from unit (same as <tt>_from</tt> param)
* to: [[Object]] - switching to unit (same as <tt>_to</tt> param)
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
| <!-- Title -->
==== PreloadStarted ====
| <!-- Description -->
Executes assigned code before the mission preload screen. Stackable version of [[onPreloadStarted]].
| <!-- Arguments -->
| <!-- Since -->
{{GVI|arma3|1.57}}


|-
{{ArgTitle|PlayerViewChanged|4|{{GVI|arma3|1.66}}}}
| <!-- Title -->
Fired on player view change. Player view changes when player is changing body due to [[teamSwitch]], gets in out of a vehicle or operates UAV for example.
==== PreloadFinished ====
<syntaxhighlight lang="cpp">
| <!-- Description -->
addMissionEventHandler ["PlayerViewChanged", {
Executes assigned code after the mission preload screen. Stackable version of [[onPreloadFinished]].
params [
| <!-- Arguments -->
"_oldUnit", "_newUnit", "_vehicle",
| <!-- Since -->
"_oldCamera", "_newCamera", "_uav"
{{GVI|arma3|1.57}}
];
}];
</syntaxhighlight>


|-
* oldBody: [[Object]] - player body before EH fired
| <!-- Title -->
==== PlayerViewChanged ====
| <!-- Description -->
Fired on player view change. Player view changes when player is changing body due to [[teamSwitch]], gets in out of a vehicle or operates UAV for example.
| <!-- Arguments -->
* oldBody: [[Object]] - player body before EH fired  
* newBody: [[Object]] - player body after EH fired
* newBody: [[Object]] - player body after EH fired
* vehicleIn: [[Object]] - vehicle player is in ([[ObjNull]] if not in vehicle)
* vehicleIn: [[Object]] - vehicle player is in ([[objNull]] if not in vehicle)
* oldCameraOn: [[Object]] - [[cameraOn]] before EH fired
* oldCameraOn: [[Object]] - [[cameraOn]] before EH fired
* newCameraOn: [[Object]] - [[cameraOn]] after EH fired
* newCameraOn: [[Object]] - [[cameraOn]] after EH fired
* UAV: [[Object]] - UAV reference if player is operating one ([[ObjNull]] if not operating UAV)
* UAV: [[Object]] - UAV reference if player is operating one ([[objNull]] if not operating UAV)
| <!-- Since -->
 
{{GVI|arma3|1.66}}
 
{{ArgTitle|PreloadStarted|4|{{GVI|arma3|1.57}}}}
Executes assigned code before the mission preload screen. Stackable version of [[onPreloadStarted]].<br>
{{Important | This event handler also fires on client after user closes the main map. }}
<syntaxhighlight lang="cpp">
addMissionEventHandler ["PreloadStarted", {
// no params
}];
</syntaxhighlight>
 
 
{{ArgTitle|PreloadFinished|4|{{GVI|arma3|1.57}}}}
Executes assigned code after the mission preload screen. Stackable version of [[onPreloadFinished]].<br>
{{Important | This event handler also fires on client after user closes the main map. }}
<syntaxhighlight lang="cpp">
addMissionEventHandler ["PreloadFinished", {
// no params
}];
</syntaxhighlight>
 
 
==== SelectedActionPerformed ====
RTM helicopter user action event
<syntaxhighlight lang="cpp">
addMissionEventHandler ["SelectedActionPerformed", {
params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
</syntaxhighlight>
 
{{Important|Limited or non-existent functionality}}
 
 
==== SelectedActionChanged ====
RTM helicopter user action event
<syntaxhighlight lang="cpp">
addMissionEventHandler ["SelectedActionChanged", {
params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
</syntaxhighlight>
 
{{Important|Limited or non-existent functionality}}
 
 
==== SelectedRotorLibActionPerformed ====
RTM helicopter user action event
<syntaxhighlight lang="cpp">
addMissionEventHandler ["SelectedRotorLibActionPerformed", {
params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
</syntaxhighlight>
 
{{Important|Works only for key press combination <tt>RightCtrl</tt> + <tt>W</tt>, which is the binding for helicopter wheels brakes. It fires with or without Advanced Flight Model enabled. The enum number returned is 4 and 5, probably because the enum is structured like this:<br>
0: HelicopterAutoTrimOn<br>
1: HelicopterAutoTrimOff<br>
2: HelicopterTrimOn<br>
3: HelicopterTrimOff<br>
4: WheelsBrakeOn<br>
5: WheelsBrakeOff
}}
 
 
==== SelectedRotorLibActionChanged ====
RTM helicopter user action event
<syntaxhighlight lang="cpp">
addMissionEventHandler ["SelectedRotorLibActionChanged", {
params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
</syntaxhighlight>
 
{{Important|Limited or non-existent functionality}}
 
 
{{ArgTitle|TeamSwitch|4|{{GVI|arma3|1.57}}}}
Executes assigned code when player teamswitches. Stackable version of [[onTeamSwitch]].
<syntaxhighlight lang="cpp">
addMissionEventHandler ["TeamSwitch", {
params ["_previousUnit", "_newUnit"];
}];
</syntaxhighlight>
 
* previousUnit: [[Object]] - switching from unit (same as <tt>_from</tt> param)
* newUnit: [[Object]] - switching to unit (same as <tt>_to</tt> param)
 
{{Cfg ref|end}}
 


|}
[[Category: Event Handlers]]
[[Category:Scripting Topics]]

Revision as of 13:47, 13 October 2020

Template:SideTOC

Template:EffArg

Description

Mission event handlers are specific EHs that are anchored to the running mission and automatically removed when mission is over. These events fire only on the machine where they have been added.
For all other available EHs see the Event Handlers main page.


Related Commands


Events

Template:Cfg ref Template:Cfg ref

4

Fired each time a building model changes, for example due to stages of destruction.

addMissionEventHandler ["BuildingChanged", {
	params ["_previousObject", "_newObject", "_isRuin"];
}];
  • from: Object - building it changes from
  • to: Object - building it changes to
  • isRuin: Boolean - true if changes to ruins


4

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

addMissionEventHandler ["CommandModeChanged", {
	params ["_isHighCommand", "_isForced"];
}];
  • isHighCommand: Boolean - same as _isHighCommand param
  • isForced: Boolean - true if command mode was forced


4

Triggers when control of a vehicle is shifted (pilot->co-pilot, co-pilot->pilot), usually when user performs an action such as TakeVehicleControl, SuspendVehicleControl, UnlockVehicleControl, LockVehicleControl, or when enableCopilot command is used. This event handler will always fire on the PC where action is triggered as well as where the vehicle is local at the time. When control of the vehicle is shifted, the locality of the vehicle changes to the locality of the new controller. Since Arma 3 v1.95.146023 this EH is extended with additional params.

addMissionEventHandler ["ControlsShifted", {
	params ["_newController", "_oldController", "_vehicle", "_copilotEnabled", "_controlsUnlocked"];
}];
  • newController: Object - unit currently controlling the vehicle
  • oldController: Object - unit previously controlling the vehicle
  • vehicle: Object - the vehicle for which controls shifted
  • copilotEnabled: Boolean - true if copilot is enabled
  • controlsUnlocked: Boolean - true if controls are unlocked


4

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.

addMissionEventHandler ["Draw3D", {
	// no params
}];


4

Executes assigned code each frame. Stackable version of onEachFrame.

addMissionEventHandler ["EachFrame", {
	// no params
}];


4

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

addMissionEventHandler ["Ended", {
	params ["_endType"];
}];

4

Triggered when the server switches off from "playing" state (mission ends, server closes, etc.) It's only for MP games, it is called on server and also on clients. It's not called on clients when client disconnects from server (and mission continues). This EH has no arguments passed to the code.

addMissionEventHandler ["MPEnded", {
// code to execute
}];

4

Triggered when an entity is killed.

addMissionEventHandler ["EntityKilled", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];
}];
  • killed: Object - entity that was killed
  • killer: Object - the killer (vehicle or person)
  • Arma 3 logo black.png1.65 instigator: Object - person who pulled the trigger
  • Arma 3 logo black.png1.67 useEffects: Boolean - same as useEffects in setDamage alt syntax

It's worth noting that instigator param is objNull during road kill. To work around this issue try:

addMissionEventHandler ["EntityKilled",
{
	params ["_killed", "_killer", "_instigator"];
	if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0}; // UAV/UGV player operated road kill
	if (isNull _instigator) then {_instigator = _killer}; // player driven vehicle road kill
	hint format ["Killed By %1", name _instigator];
}];

4

Triggered when an entity is respawned.

addMissionEventHandler ["EntityRespawned", {
	params ["_entity", "_corpse"];
}];
  • newEntity: Object - respawned entity
  • oldEntity: Object - corpse/wreck


4

Triggered when an extension calls provided function pointer with 3 params.

addMissionEventHandler ["ExtensionCallback", {
	params ["_name", "_function", "_data"];
}];
  • name: String - user provided param
  • function: String - user provided param
  • data: String - user provided param


4

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.

addMissionEventHandler ["GroupIconClick", {
	params [
		"_is3D", "_group", "_waypointId",
		"_mouseButton", "_posX", "_posY",
		"_shift", "_control", "_alt"
	];
}];
  • 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


4

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.

addMissionEventHandler ["GroupIconOverEnter", {
	params [
		"_is3D", "_group", "_waypointId",
		"_posX", "_posY",
		"_shift", "_control", "_alt"
	];
}];


4

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.

addMissionEventHandler ["GroupIconOverLeave", {
	params [
		"_is3D", "_group", "_waypointId",
		"_posX", "_posY",
		"_shift", "_control", "_alt"
	];
}];
  • 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


4

Fires when user changes time acceleration with +/- keys in SP or setAccTime command. If the code returns true the on-screen message confirming the change is not displayed. Doesn't fire if desired value is already set.

addMissionEventHandler ["HandleAccTime", {
	params ["_currentTimeAcc", "_prevTimeAcc", "_messageSuppressed"];
}];
  • currentTimeAcc: Number - current value
  • prevTimeAcc: Number - previous value
  • messageSuppressed: Boolean - true if on-screen message was suppressed


-wrong parameter ("arma3dev") defined!-[[:Category:Introduced with arma3dev version 1.99|1.99]]

4

Fires when a message is received, before adding it to the chat feed. Fires clientside. The output message could be overridden:

  • Return true to block incoming chat message from being added to the chat feed.
  • Return String to replace the chat message content but not the sender name.
  • Return Array [from, text] to replace both the chat message content and the the sender's name.
Only the last added EH with override will be used to override the message.
Do not put any of the chat related script command such as systemChat, sideChat, etc in this EH code as it would naturally cause recursion and the game will freeze.
addMissionEventHandler ["HandleChatMessage", {
	params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
}];
  • channel: Number - See radio channel indexes (16 for system chat message for example)
  • owner: Number - owner id of the sender:
  • from: String - sender's formatted name as appeared on the chat
  • text: String - the chat message
  • person: Object - sender's object
  • name: String - sender's name, could be different from from
  • strID: String - sender's network player ID (marker id):
  • forcedDisplay: Boolean - if display was forced
  • isPlayerMessage: Boolean - if is player message
  • sentenceType: Number - 0: Normal type, 1: Protocol type
  • chatMessageType: Number - 0: Generic type, 1: SimpleMove type, 2: KillConfirmation type


4

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.

addMissionEventHandler ["HandleDisconnect", {
	params ["_unit", "_id", "_uid", "_name"];
	true;
}];

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;


4

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

addMissionEventHandler ["HCGroupSelectionChanged", {
	params ["_group", "_isSelected"];
}];
  • group: Group - group selected (same as _group param)
  • isSelected: Boolean - true if selected (same as _isSelected param)


4

Triggered when mission is loaded from save.

"Loaded" event handler should be added BEFORE the mission is loaded from save. Placing it in a function with preInit = 1; usually does the trick.
addMissionEventHandler ["Loaded", {
	params ["_saveType"];
}];
  • 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


4

Triggered when map is opened or closed either by user action or script command openMap.

addMissionEventHandler ["Map", {
	params ["_mapIsOpened", "_mapIsForced"];
}];


4

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
addMissionEventHandler ["MapSingleClick", {
	params ["_units", "_pos", "_alt", "_shift"];
}];
  • 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)


4

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

addMissionEventHandler ["PlayerConnected",
{
	params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
}];
  • 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)
  • idstr: String - same as id but in string format, so could be exactly compared to user marker ids

If dedicated server was started without '-autoInit' option and this EH was created on server, on first GUI client this EH also fires against server, but after first client. In mission's initServer.sqf:

handlercon = addMissionEventHandler ["PlayerConnected",
{
	diag_log "Client connected";
	diag_log _this;
}];

In RPT:

2016/12/16, 15:39:09 "Client connected"
2016/12/16, 15:39:09 [1.51343e+009,"7xxxxxxxxxxxxxxx1","longbow",false,3,"1513430065"]
2016/12/16, 15:39:34  Mission id: 5071d20b183e9580d0ee4f95f413ca18681d6165
2016/12/16, 15:39:34 "Client connected"
2016/12/16, 15:39:34 [2,"","__SERVER__",false,2,"2"]

That happens only for GUI clients, if HC client connects first, EH does not fire for server.
If dedicated server was started with -autoInit option, this EH does not fire against server, only for future clients, and all further clients appear to be JIPped.
Interesting moment for headless clients, for headless clients instead of getPlayerUID, handler gets string like "HC12160", where '12160' is headless client process ID (matches HC's PID observed in windows task manager)


4

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

addMissionEventHandler ["PlayerDisconnected",
{
	params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
}];
  • 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)
  • idstr: String - same as id but in string format, so could be exactly compared to user marker ids


4

Fired on player view change. Player view changes when player is changing body due to teamSwitch, gets in out of a vehicle or operates UAV for example.

addMissionEventHandler ["PlayerViewChanged", {
	params [
		"_oldUnit", "_newUnit", "_vehicle",
		"_oldCamera", "_newCamera", "_uav"
	];
}];
  • oldBody: Object - player body before EH fired
  • newBody: Object - player body after EH fired
  • vehicleIn: Object - vehicle player is in (objNull if not in vehicle)
  • oldCameraOn: Object - cameraOn before EH fired
  • newCameraOn: Object - cameraOn after EH fired
  • UAV: Object - UAV reference if player is operating one (objNull if not operating UAV)


4

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

This event handler also fires on client after user closes the main map.
addMissionEventHandler ["PreloadStarted", {
	// no params
}];


4

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

This event handler also fires on client after user closes the main map.
addMissionEventHandler ["PreloadFinished", {
	// no params
}];


SelectedActionPerformed

RTM helicopter user action event

addMissionEventHandler ["SelectedActionPerformed", {
	params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
Limited or non-existent functionality


SelectedActionChanged

RTM helicopter user action event

addMissionEventHandler ["SelectedActionChanged", {
	params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
Limited or non-existent functionality


SelectedRotorLibActionPerformed

RTM helicopter user action event

addMissionEventHandler ["SelectedRotorLibActionPerformed", {
	params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
Works only for key press combination RightCtrl + W, which is the binding for helicopter wheels brakes. It fires with or without Advanced Flight Model enabled. The enum number returned is 4 and 5, probably because the enum is structured like this:

0: HelicopterAutoTrimOn
1: HelicopterAutoTrimOff
2: HelicopterTrimOn
3: HelicopterTrimOff
4: WheelsBrakeOn

5: WheelsBrakeOff


SelectedRotorLibActionChanged

RTM helicopter user action event

addMissionEventHandler ["SelectedRotorLibActionChanged", {
	params ["_caller", "_target", "_enumNumber", "_actionId"];
}];
Limited or non-existent functionality


4

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

addMissionEventHandler ["TeamSwitch", {
	params ["_previousUnit", "_newUnit"];
}];
  • previousUnit: Object - switching from unit (same as _from param)
  • newUnit: Object - switching to unit (same as _to param)

Template:Cfg ref