addMPEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Take[ _]On[ _]Helicopters(\|.*)?]]" to "{{GameCategory|tkoh|Scripting Commands}}") |
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
||
Line 1: | Line 1: | ||
{{Command|Comments= | {{Command|Comments= | ||
| arma2oa |Game name= | | arma2oa |Game name= | ||
Line 13: | Line 12: | ||
|eff= global |Multiplayer Effects= | |eff= global |Multiplayer Effects= | ||
| Adds MP event handler (EH) to the given object and returns EH handle.<br> | | Adds MP event handler (EH) to the given object and returns EH handle.<br> | ||
Line 21: | Line 19: | ||
Since Arma 3 v.1.63.137807 the EH handle is also stored in <tt>_thisEventHandler</tt> variable and is available during EH code execution.<br><br> | Since Arma 3 v.1.63.137807 the EH handle is also stored in <tt>_thisEventHandler</tt> variable and is available during EH code execution.<br><br> | ||
{{Informative | For more information, see [[Arma_3:_Event_Handlers#Multiplayer_Event_Handlers|Event Handlers/addMPEventHandler]].}} |DESCRIPTION= | {{Informative | For more information, see [[Arma_3:_Event_Handlers#Multiplayer_Event_Handlers|Event Handlers/addMPEventHandler]].}} |DESCRIPTION= | ||
| object [[addMPEventHandler]] [type, expression] |SYNTAX= | | object [[addMPEventHandler]] [type, expression] |SYNTAX= | ||
Line 32: | Line 29: | ||
| [[Number]] |RETURNVALUE= | | [[Number]] |RETURNVALUE= | ||
|x1= <code>_index = player [[addMPEventHandler]] ["MPKilled", { [[_this]] [[execVM]] "playerKilled.sqf"; }]; </code> |Example1= | |x1= <code>_index = player [[addMPEventHandler]] ["MPKilled", { [[_this]] [[execVM]] "playerKilled.sqf"; }]; </code> |Example1= | ||
| [[:Category:Event Handlers|EventHandlers list]], [[removeMPEventHandler]], [[removeAllMPEventHandlers]] |SEEALSO= | | [[:Category:Event Handlers|EventHandlers list]], [[removeMPEventHandler]], [[removeAllMPEventHandlers]] |SEEALSO= |
Revision as of 00:05, 17 January 2021
Description
- Description:
- Adds MP event handler (EH) to the given object and returns EH handle.
MP event handlers are added globally to every client on network in multiplayer and will fire on every client too upon event. If EH has some data to return upon event (e.g. the "MPKilled" EH will return an array with 2 elements: the killed unit, and the killer), it is passed in _this variable.
Since Arma 3 v.1.63.137807 the EH handle is also stored in _thisEventHandler variable and is available during EH code execution.
- Groups:
- MultiplayerEvent Handlers
Syntax
- Syntax:
- object addMPEventHandler [type, expression]
- Parameters:
- object: Object - object to monitor
- type: String - event handler name
- expression: String or Code - expression to execute
- Return Value:
- Number
Examples
- Example 1:
_index = player addMPEventHandler ["MPKilled", { _this execVM "playerKilled.sqf"; }];
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
Bottom Section
- Posted on May 8, 2015 - 12:24 (UTC)
- Killzone Kid
- MP EHs are added on every PC and execute on every PC, apart from MPRespawn, that only executes at the locality where unit respawns.
Categories:
- Scripting Commands
- Introduced with Arma 2: Operation Arrowhead version 1.55
- Arma 2: Operation Arrowhead: New Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Command Group: Multiplayer
- Command Group: Event Handlers
- Scripting Commands: Global Effect
- Arma 2: Scripting Commands
- Arma 3: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 2: Operation Arrowhead: New Scripting Commands List