description: Explains how to use CBA event handlers with ACE3 events used to trigger or allow triggering of specific functionality and lists all documented events.
|`ace_firedPlayerVehicleNonLocal` | [_vehicle, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile] | Local | Listen | Any other player turret fires
|`ace_firedNonPlayerVehicle` | [_vehicle, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile] | Local | Listen | AI turret fires
|`ace_placedInBodyBag` | [_target, _bodyBag, _isGrave] | Global | Listen | Target placed into a bodybag Note: (Target will soon be deleted, target could be a bodybag)
|`ace_placedInGrave` | [_target, _grave] | Global | Listen | Target placed into a grave, _grave will be objNull if `Create Grave Markers` is disabled Note: (Target will soon be deleted)
|`ace_treatmentStarted` | [_caller, _target, _selectionName, _className, _itemUser, _usedItem] | Local | Listen | Treatment action has started (local on the _caller)
|`ace_treatmentFailed` | [_caller, _target, _selectionName, _className, _itemUser, _usedItem] | Local | Listen | Treatment action has been interrupted (local on the _caller)
|`ace_medical_handleUnitVitals` | [_unit, _deltaT] | Local | Listen | Vitals update ran for unit, _deltaT is the time elapsed since the previous vitals update (local to _unit)
|`ace_attach_attached` | [_attachedObject, _itemClassname, _temporary] | Local | Listen | After an item was attached to a unit/vehicle. _temporary flag means a item is being re-attached after the player exits a vehicle
|`ace_attach_detaching` | [_attachedObject, _itemName, _temporary] | Local | Listen | Just before an item gets detached/removed from a unit/vehicle. _temporary flag means its detached because the player unit entered a vehicle.
`CBA_fnc_addEventHandler` - Adds an event handler with the event name and returns the event handler ID.
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Code block | Code | Required
**R** | Event ID | Number | Return value
#### 3.1.2 Remove Event
`CBA_fnc_removeEventHandler` - Removes a specific event handler of the given event name, using the ID returned from `CBA_fnc_addEventHandler`.
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Event ID | Number | Required
**R** | None | None | Return value
### 3.2 Calling Events
#### 3.2.1 Local Event
`CBA_fnc_localEvent` - Calls an event only on the local machine, useful for inter-module events.
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Arguments | Any | Required
**R** | None | None | Return value
#### 3.2.2 Target Event
`CBA_fnc_targetEvent` - Calls an event only on the target machine or list of target machines.
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Arguments | Any | Required
2 | Target(s) | Object OR Number OR Array | Required
**R** | None | None | Return value
#### 3.2.3 Server Event
`CBA_fnc_serverEvent` - Calls an event only on the server machine (dedicated or self-hosted).
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Arguments | Any | Required
**R** | None | None | Return value
#### 3.2.4 Global Event
`CBA_fnc_globalEvent` - Calls an event on all machines - the local machine, and the server machine.
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Arguments | Any | Required
**R** | None | None | Return value
### 3.3 Synchronized Events
#### 3.3.1 Add Synchronized Event
Adds a globally synchronized event handler which will expire events after the provided time-to-live, or the code returns true.
`ace_common_fnc_addSyncedEventHandler`
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Code block | Code | Required
2 | Time to live | Number OR Code | Optional (default: `0`)
**R** | Event ID | Number | Return value
#### 3.3.2 Remove Synchronized Event
Removes a specific event handler of the given event name, using the ID returned from `ace_common_fnc_addSyncedEventHandler`.
`ace_common_fnc_removeSyncedEventHandler`
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
**R** | None | None | Return value
#### 3.3.3 Call Synchronized Event
Calls a globally synchronized event, which will also be run on JIP players unless it has expired. Event will expire after the provided time-to-live, or the code returns true.
`ace_common_fnc_syncedEvent`
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Event name | String | Required
1 | Arguments | Any | Required
2 | Time to live for this call | Number OR Code | Optional (default: `0`)