Event Framework

From Arma Projects
Jump to: navigation, search

Summary

The triggered events are single-player and multi-player compatible synchronised events that can be set up to co-ordinate the execution of events and functions across a network such as object destroyed or intel picked up. It is limitless on the type and amount of events that can be set-up to trigger.

Code

Add Event Trigger

MPSF_fnc_addEventHandler
Description
Function Description
Syntax
[<string:uniqueID>,<string:eventType>,<script:code>] call MPSF_fnc_addEventHandler
Parameters
1 - <string> : Unique ID for reference and tracking the event handler
2 - <string> : Event type that will be triggered.
Prebuilt events include:
  • xxx
3 - <code> : Code to be called when the event is triggered
Example
["PO4_onHighFive_EH","onHighFive",{ _this call My_Fnc_function }] call MPSF_fnc_addEventHandler;

Remove Event Trigger

MPSF_fnc_removeEventHandler
Description
Function Description
Syntax
[<string:uniqueID>,<string:eventType>] call MPSF_fnc_removeEventHandler
Parameters
1 - <string> : Unique ID of the event
2 - <string> : Event type that was added.
Example
["PO4_onHighFive_EH","onHighFive"] call MPSF_fnc_removeEventHandler;

Trigger Event

MPSF_fnc_triggerEventHander
Description
Function Description
Syntax
[<string:eventType>,<arguments:array>,<target:remoteExec>] call MPSF_fnc_triggerEventHander
Parameters
1 - <string> : Event type that will be triggered.
2 - <array> : Array of attributes to be passed to the triggered code as _this
3 - <variable> : Uses the [Remote Execute]
Number - 0 or 2. When 0, the event will be executed globally, i.e. on the server and every client, including the trigger machine. When 2, it will be executed only on the server. When number is negative, the effect is inverted. -2 means execute on every client but not the server.
Object - the function will be executed only where unit is local
String - the function will be executed only where object or group defined by the variable with passed name is local
Side - the function will be executed only on clients where the player is on the specified side
Group - the function will be executed only on clients where the player is in the specified group.
Array - array of any of types listed above
Example
["onHighFive",[player],0] call MPSF_fnc_triggerEventHander;