2015-04-09 19:09:49 +00:00
---
layout: wiki
title: ACE3 Events System
2015-05-15 07:45:15 +00:00
description: Event handlers in ACE3 are implemented through our event system. They should be used to trigger or allow triggering of specific functionality.
2015-04-12 12:42:49 +00:00
group: development
2015-04-09 19:09:49 +00:00
parent: wiki
order: 3
---
2015-05-04 11:43:33 +00:00
## 1. Event Handlers
2015-04-09 19:09:49 +00:00
Event handlers in ACE3 are implemented through our event system. They should be used to trigger or allow triggering of specific functionality.
The commands are listed below.
* `[eventName, eventCodeBlock] call ace_common_fnc_addEventHandler` < br /> adds an event handler with the event name and returns the event handler id.
* `[eventName, args] call ace_common_fnc_globalEvent` < br /> calls an event with the listed args on all machines, the local machine, and the server.
* `[eventName, args] call ace_common_fnc_serverEvent` < br /> calls an event just on the server computer (dedicated or self-hosted).
* `[eventName, targetObject(s), args] call ace_common_fnc_targetEvent` < br /> calls an event just on the targeted object or list of objects.
* `[eventName, args] call ace_common_fnc_localEvent` < br /> calls an event just on the local machine, useful for inter-module events.
Events can be removed or cleared with the following commands.
* `[eventName, eventHandlerId] call ace_common_fnc_removeEventHandler` < br /> will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addEventHandler` .
* `[eventName] call ace_common_fnc_removeAllEventHandlers` < br /> will remove all event handlers for that type of event.
2015-05-04 11:43:33 +00:00
### 1.1 Synchronized Events
2015-04-18 21:43:22 +00:00
* `[eventName, eventCodeBlock, ttlNumberOrCodeBlock] call ace_common_fnc_addSyncedEventHandler` < br /> adds a globally synchronized event handler which will expire events after the provided TTL, or the code returns true.
* `[eventName] call ace_common_fnc_removeSyncedEventHandler` < br /> will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addSyncedEventHandler` .
* * `[eventName, args, ttlNumberOrCodeBlock] call ace_common_fnc_syncedEvent` < br /> calls a global synchronized event, which will also be run on JIP players unless it has expired; event will expire after the provided TTL, or the code returns true.
2015-05-04 11:43:33 +00:00
### 1.2 Pattern:
2015-04-09 19:09:49 +00:00
```c++
// tapper machine
["tapShoulder", [_target], [otherArguments]] call EFUNC(common,targetEvent);
// target machine XEH_preInit.sqf
PREP(onTapShoulder);
["tapShoulder", FUNC(onTapShoulder) ] call EFUNC(common,addEventHandler);
```
2015-05-04 11:43:33 +00:00
### 1.3 Listenable Event List:
2015-04-09 19:09:49 +00:00
< table >
< thead >
< tr >
< th > Event Key< / th >
< th > Description< / th >
< th > Source(s)< / th >
2015-04-10 17:56:56 +00:00
< th > Passed Parameter(s) (_this)< / th >
2015-04-09 19:09:49 +00:00
< th > Locality< / th >
< / tr >
< / thead >
< tbody >
< tr >
< td > "playerChanged"< / td >
2015-07-31 16:23:11 +00:00
< td > `player` changed (zeus/respawn/init)< / td >
2015-04-09 19:09:49 +00:00
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_newPlayer, _oldPlayer]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
< / tr >
2015-04-18 21:41:17 +00:00
< tr >
< td > "PlayerJIP"< / td >
< td > Player was a JIP player, and `player` object is now created.</ td >
< td > common< / td >
< td > [_player]< / td >
< td > local< / td >
< / tr >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "playerInventoryChanged"< / td >
< td > Inventory changed< / td >
< td > common< / td >
2015-05-19 16:17:10 +00:00
< td > [_player, getAllGear-Array]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "playerVisionModeChanged"< / td >
< td > Vision mode changed (e.g. NVG on)< / td >
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_unit, _newVisionMode]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
< / tr >
2015-04-10 17:56:56 +00:00
< tr >
< td > "inventoryDisplayChanged"< / td >
< td > Inventory display opened/closed< / td >
< td > common< / td >
< td > [_unit, _isOpen]< / td >
< td > local< / td >
< / tr >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "zeusDisplayChanged"< / td >
< td > Zeus display opened/closed< / td >
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_unit, _isOpen]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
< / tr >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "cameraViewChanged"< / td >
< td > Camera view changed< / td >
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_unit, _newCameraView]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "playerVehicleChanged"< / td >
< td > Player vehicle changed< / td >
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_unit, _newVehicle]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "playerTurretChanged"< / td >
< td > Player turret changed< / td >
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_unit, _newTurretIndexArray]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "infoDisplayChanged"< / td >
< td > On info box change (e.g. entering and leaving a vehicle)< / td >
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_display, _type]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "inventoryDisplayLoaded"< / td >
< td > On opening the inventory display< / td >
< td > common< / td >
2015-04-10 17:56:56 +00:00
< td > [_display]< / td >
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-10 17:56:56 +00:00
< tr >
< td > "mapDisplayLoaded"< / td >
< td > On loading the map (briefing and mission start)< / td >
< td > common< / td >
< td > [_display, _mapType]< / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
< tr >
< td > "SettingsInitialized"< / td >
< td > Settings are now safe to use (at mission start)< / td >
< td > common< / td >
< td > < / td >
< td > local< / td >
< / tr >
< tr >
< td > "SettingChanged"< / td >
< td > A setting was changed< / td >
< td > common< / td >
< td > [_name, _value]< / td >
< td > local< / td >
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "interactionMenuOpened"< / td >
< td > Interaction Menu Opened< / td >
< td > interaction< / td >
2015-04-10 17:56:56 +00:00
< td > < / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "killedByFriendly"< / td >
< td > On TK/Civilian Killed< / td >
< td > respawn< / td >
2015-04-10 17:56:56 +00:00
< td > < / td >
2015-04-09 19:09:49 +00:00
< td > local< / td >
< / tr >
< tr >
< td > "drawing_requestMarkers"< / td >
< td > Request Drawing Markers< / td >
< td > map< / td >
2015-04-10 17:56:56 +00:00
< td > < / td >
2015-04-09 19:09:49 +00:00
< td > target< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "drawing_sendbackMarkers"< / td >
< td > Send Drawing Markers< / td >
< td > map< / td >
2015-04-10 17:56:56 +00:00
< td > < / td >
2015-04-09 19:09:49 +00:00
< td > target< / td >
< / tr >
< tr >
< td > "drawing_addLineMarker"< / td >
< td > Line Drawn< / td >
< td > map< / td >
2015-04-10 17:56:56 +00:00
< td > < / td >
2015-04-09 19:09:49 +00:00
< td > global< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "drawing_removeLineMarker"< / td >
< td > Line Deleted< / td >
< td > map< / td >
2015-04-10 17:56:56 +00:00
< td > < / td >
2015-04-09 19:09:49 +00:00
< td > global< / td >
2015-07-31 16:23:11 +00:00
< / tr >
2015-04-09 19:09:49 +00:00
< tr >
< td > "flashbangExplosion"< / td >
< td > Flashbang Goes Bang< / td >
< td > grenades< / td >
2015-04-10 17:56:56 +00:00
< td > < / td >
2015-04-09 19:09:49 +00:00
< td > target< / td >
2015-07-31 16:23:11 +00:00
< / tr >
< tr >
< td > "zeusUnitAssigned"< / td >
< td > A player was assigned as zeus< / td >
< td > zeus< / td >
< td > [_logic,_player]< / td >
< td > global< / td >
< / tr >
2015-04-09 19:09:49 +00:00
< / tbody >
< / table >
2015-05-04 11:43:33 +00:00
### 1.4 Callable Event List:
2015-04-09 19:09:49 +00:00
< table >
< thead >
< tr >
< th > Event Key< / th >
< th > Description< / th >
< th > Parameters< / th >
< th > Owner< / th >
< th > Locality< / th >
< / tr >
< / thead >
< tbody >
2015-07-31 16:23:11 +00:00
< / tr >
< td > "SetHandcuffed"< / td >
< td > Set the captive (handcuffed) state of a unit< / td >
< td > [_unit, _state]< / td >
< td > captives< / td >
< td > local< / td >
< / tr >
< / tr >
< td > "SetSurrendered"< / td >
< td > Set the surrender state of a unit< / td >
< td > [_unit, _state]< / td >
< td > captives< / td >
< td > local< / td >
< / tr >
< tr >
2015-04-09 19:09:49 +00:00
< td > "ace_fcs_forceChange"< / td >
< td > force FCS updates< / td >
< td > fcs< / td >
< td > fcs< / td >
< td > local< / td >
< / tr >
< / tbody >
< / table >