Category:Scripting Commands VBS1

From Bohemia Interactive Community
Jump to navigation Jump to search

Introduction

In addition to the regular OFP commands, the list below contains the commands that have been added to VBS1.


Variables

There are a number of inbuilt variables and functions that are added by the VBS core at the start of every mission.

VBS_init

Will equal true when VBS initialisation is complete. Do not use any variable or function defined by the VBS core until VBS_init equals true.

Code:

~0.01
@VBS_init

VBS is now initialised

VBS_is_server

Will equal true on the computer that is the server, otherwise false. (Note that this variable is more reliable than the IsServer command, which due to a bug returns false in a single player game).

Code:

~0.01
@VBS_init
? VBS_is_server : hint "I am the server"

VBS Arrays

Note : In order for third-party content to be inserted into these arrays, it is required that the vehicle eventhandlers be inherited from class vbs_eventhandlers{}. Additionally, these arrays should not be accessed until vbs_init is true.

VBS_units

This is an array containing a reference to every unit in a mission. This includes units in vehicles. This array will be ordered the same on all computers in a networked session.

Code:

~0.01
@VBS_init
hint format["There are %1 units in the mission",count VBS_units]

VBS_vehs

This is an array containing a reference to every vehicle (empty or otherwise) in a mission. This array will be ordered the same on all computers in a networked session.

Code:

~0.01
@VBS_init
hint format["There are %1 vehicles in the mission",count VBS_vehs]

VBS_units_str

This is an array of strings containing the names of every unit in a mission. This array will be ordered the same on all computers in a networked session (as per VBS_units). This array is used by the VBS core to update the VBS_units array when units respawn in multiplayer.

Code:

~0.01
@VBS_init
hint format["I am unit number %1 in the mission",VBS_units_str find (name player)]

VBS_distance3D

No info placeholder

Pages in category "Scripting Commands VBS1"

The following 78 pages are in this category, out of 78 total.