Page tree
Skip to end of metadata
Go to start of metadata

Introduction

The following system event handlers can be added using addGlobalEventHandler.

System event handlers differ from traditional event handlers (also called object event handlers), in that they are not associated with a particular object. Rather, system event handlers run when a global event occurs, such as the editor being opened.

An alternative way of adding global events is via VBS Custom Event Handlers.


Event Handlers by Category

Camera

CameraOnChanged


Fires when when the player camera view changes, by either:

  • Executing switchCamera.
  • Executing selectPlayer.
  • Selecting Switch to Unit from the RTE context menu.
  • Selecting First Person Camera from the RTE context menu.
  • Selecting Bullet Camera from the RTE context menu.
  • Exiting a vehicle.

Passed array: [object]

  • object: Object - New object camera is attached to.


OpticsToggled

, Not available in V2.0+!
Fires when when optics (of a unit or vehicle) are switched.

Passed array: [optics,3d]

  • optics: Boolean - true if optics are on
  • 3d: Boolean - true if a 3D view is used (i.e. iron sights)

Communications

OnConversationStart


Fires when the VBS3 conversation system is conversationStart.

Passed array: [player, unit, conversationClass, initNode]

  • player: Object - Player that initiated the conversation.
  • unit: Object - AI or other player to converse with.
  • conversationClass: String - Conversation class being used.
  • initNode: String - Initial conversation sub-class being used (can be empty for player/player) conversations.
    If none was specified in conversationStart, then the name of the 'initState' class is returned.

OnConversationEnd


Fires when a VBS3 conversation system is conversationEnd (either via the conversation menu/conversationEnd, or by pressing <Esc>).

Passed array: [player, unit, endNode]

  • player: Object - Player that initiated the conversation.
  • unit: Object - Conversation partner (AI or other player).
  • endNode: String - Last conversation sub-class that was being used.

OnConversationSay


Fires whenever a phrase is spoken via the VBS3 conversation system.

Passed array: [player, unit, conversationClass, nodeClass, nodeText]

  • player: Object - Unit that is speaking.
  • unit: Object - Unit is that being spoken to.
  • conversationClass: String - Conversation class being used.
  • nodeClass: String - Conversation sub-class that was used.
  • nodeText: String - Full text (with substituted variables) that was used.


SideChannel

, Not available in V2.0+!
Fires when when the player sends a side-channel chat message. Note that this does not work with the sideChat command, only with chat messages sent over the side channel.

Passed array: [sender,message]

  • sender: Object - Player that sent the chat command.
  • message: String - Message that was sent.

Vehicles

AfterGetIn/AfterGetOut

, Not available in V2.0+!
Triggered after a unit gets in or out of a vehicle.

Passed array: [vehicle, position, unit]

  • vehicle: Object - Vehicle that was left/entered.
  • position: String - Vehicle position (i.e. "driver", "gunner" or "cargo").
  • unit: Object - Unit that has left or entered the vehicle


BeforeGetIn/BeforeGetOut

, Not available in V2.0+!
Triggered just before a unit gets in or out of a vehicle.

Passed array: [vehicle, position, unit]

  • vehicle: Object - Vehicle that will be left/entered.
  • position: String - Vehicle position (i.e. "driver", "gunner" or "cargo").
  • unit: Object - Unit that will be leaving or entering the vehicle.


URNonChanged


Triggered during an LVC game, when a vehicle's DIS/LVC URN is changed.

Passed array: [identifier]

  • identifier: String - LVC identifier.

Other

inputAction


Triggered whenever any user input is detected.

Passed Array ["action",inputAmount]

  • action: String - Action activated / deactivated. See VBS Key Actions for a list of key actions
  • amount: Amount of input. Number 0-1 if Analog input, boolean if Digital input.

FileChanged


Triggered when a file that matched the fileWatch filter has been changed.

Passed Array [filename]

  • filename: String - Full path of file that has been modified