ACE3/documentation/development/ace3-events-system.md
2015-04-09 21:09:49 +02:00

5.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) Locality
"playerChanged" `player` changed (zeus/respawn) common local
"playerInventoryChanged" Inventory changed common local
"playerVisionModeChanged" Vision mode changed (e.g. NVG on) common local
"zeusDisplayChanged" Zeus display opened/closed common local
"cameraViewChanged" Camera view changed common local
"playerVehicleChanged" Player vehicle changed common local
"playerTurretChanged" Player turret changed common local
"infoDisplayChanged" On info box change (e.g. entering and leaving a vehicle) common local
"inventoryDisplayLoaded" On opening the inventory display common 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