ACE3/documentation/development/ace3-events-system.md
2015-04-10 19:56:56 +02:00

6.1 KiB

layout title group parent order
wiki ACE3 Events System dev wiki 3

Event Handlers

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
    adds an event handler with the event name and returns the event handler id.
  • [eventName, args] call ace_common_fnc_globalEvent
    calls an event with the listed args on all machines, the local machine, and the server.
  • [eventName, args] call ace_common_fnc_serverEvent
    calls an event just on the server computer (dedicated or self-hosted).
  • [eventName, targetObject(s), args] call ace_common_fnc_targetEvent
    calls an event just on the targeted object or list of objects.
  • [eventName, args] call ace_common_fnc_localEvent
    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
    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
    will remove all event handlers for that type of event.

Pattern:

// tapper machine
["tapShoulder", [_target], [otherArguments]] call EFUNC(common,targetEvent);

// target machine XEH_preInit.sqf
PREP(onTapShoulder);
["tapShoulder", FUNC(onTapShoulder) ] call EFUNC(common,addEventHandler);

Listenable Event List:

Event Key Description Source(s) Passed Parameter(s) (_this) Locality
"playerChanged" `player` changed (zeus/respawn) common [_newPlayer, _oldPlayer] local
"playerInventoryChanged" Inventory changed common getAllGear-Array local
"playerVisionModeChanged" Vision mode changed (e.g. NVG on) common [_unit, _newVisionMode] local
"inventoryDisplayChanged" Inventory display opened/closed common [_unit, _isOpen] local
"zeusDisplayChanged" Zeus display opened/closed common [_unit, _isOpen] local
"cameraViewChanged" Camera view changed common [_unit, _newCameraView] local
"playerVehicleChanged" Player vehicle changed common [_unit, _newVehicle] local
"playerTurretChanged" Player turret changed common [_unit, _newTurretIndexArray] local
"infoDisplayChanged" On info box change (e.g. entering and leaving a vehicle) common [_display, _type] local
"inventoryDisplayLoaded" On opening the inventory display common [_display] local
"mapDisplayLoaded" On loading the map (briefing and mission start) common [_display, _mapType] local
"interactionMenuOpened" Interaction Menu Opened interaction local
"killedByFriendly" On TK/Civilian Killed respawn local
"drawing_requestMarkers" Request Drawing Markers map target
"drawing_sendbackMarkers" Send Drawing Markers map target
"drawing_addLineMarker" Line Drawn map global
"drawing_removeLineMarker" Line Deleted map global
"flashbangExplosion" Flashbang Goes Bang grenades target

Callable Event List:

Event Key Description Parameters Owner Locality
"ace_fcs_forceChange" force FCS updates fcs fcs local