BIS Functions
In Arma2 BIS introduced a set of functions to deal with all sorts of things ranging from mathematical functions to spawning groups. Below is a list of a few functions you might find very useful in everyday mission making.
There are also a few important notes at the end.
[text, position, minDis, fadeDis] call BIS_fnc_3Dcredits
Operand types:
text:
Structured Textposition:
PositionminDis (Optional):
Number - distance in which text is displayed (default is 20)
fadeDis (Optional):
Number - distance in which text starts fading again (default is 1.5)
Type of returned value:
Description:
Displays structured text in 3D world.
GUI layer for indicator is 2733.
Used In:
Arma2OA
Example:
["<t size='2'>Hello World</t>",position helloWorld,15,0] spawn bis_fnc_3Dcredits;
["<img size='2' image='img\myImage.paa'/><br />Some text on the second line", getPos someObject] spawn bis_fnc_3Dcredits;
[header text,bottom text] spawn BIS_fnc_AAN
Operand types:
Type of returned value:
Description:
Creates the AAN news overlay on the bottom of the screen with given text.
Used In:
Arma2:OA
Example:
[parseText "<t size='2.3'>Hello World</t><br />Col. Kane announces Hello World",parseText "<t size='1.5'>Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world, Hello world</t>"] spawn BIS_fnc_AAN;
[position,areaSize,number,height] call BIS_fnc_crows
Operand types:
position:
Array (in format position) or
Object (object position) or
String (marker position)
areasize (optional):
Number - area radius
number (optional):
Number of crows
height (optional):
Number - height in which crows flies
Type of returned value:
Array - List of spawned crows
Description:
Spawns flock of crows circling an area around the given position.
Used In:
Arma2:OA
Example:
_crows = [loon3,20,8,20] call bis_fnc_crows;
[path,deltaX,deltaY] call BIS_fnc_customGPS
Operand types:
path:
String - full path to image file
deltaX (optional):
NumberdeltaY (optional):
Number
Type of returned value:
Description:
Replaces the GPS frame with the given texture.
Following line have to be defined in mission Description.ext for this to work:
onMinimapScript[] = {"BIS_fnc_customGPS_Spawn"};
Used In:
Arma2:OA
Example:
_["ca\missions_pmc\data\ui_gps_ca.paa",-0.05,0.16] call bis_fnc_customGPS;
[path,sizeCoef] call BIS_fnc_customGPSvideo
Operand types:
path:
String - full path to image file
sizeCoef (optional):
Number - screen size coeficient (default is 1)
Type of returned value:
Script - script which terminates itself once the video ends
Description:
Plays a video in-game using the GPS frame.
If BIS_fnc_customGPS has been used to change GPS texture, the changed texture is used.
GUI layer for the GPS is 19.
Used In:
Arma2:OA
Example:
_videoScript = ["\ca\video_pmc\CP00_Reynolds_b.ogv",1.04] spawn bis_fnc_customGPSvideo;
waitUntil {scriptDone _videoScript};
[position,areaSize,seed,blacklist] call BIS_fnc_destroyCity
Operand types:
position:
Array (in format position) or
Object (object position) or
String (marker position)
areaSize (optional):
Number - area diameter (default is 1000)
seed (optional):
Number - random seed (default is 1138)
blacklist (optional):
Array of blacklisted objects (default is an empty array)
Type of returned value:
Boolean - true when completed
Description:
Destroys buildings in given area based on input seed.
Used In:
Arma2:OA
Example:
["destroyBase",500,42,[bis_vila]] call bis_fnc_destroyCity;
[center,related object,color,sizeCoef] call BIS_fnc_dirIndicator
Operand types:
center:
Objectrelated object:
Object to which indicator points to
color (optional):
Array in format Color ([r, g, b, a])
sizeCoef (optional):
Number - size coeficient (default is same as height of command bar)
Type of returned value:
Description:
Direction indicator. Points the direction from the center object to the related object.
GUI layer for indicator is 17.
Used In:
Arma2:OA
Example:
[player,enemy_officer,[0.706,0.0745,0.0196,1]] call bis_fnc_dirIndicator;
[text,x coord,y coord,duration,fade-in time,delta y,resource layer] call BIS_fnc_dynamicText
Operand types:
text:
Textx coord (optional):
Number - screen position x
y coord (optional):
Number - screen position y
duration (optional):
Number - text duration
fade-in time (optional):
Number - time it takes for the text to fade in
delta y (optional):
Number - up/down movement speed
resource layer (optional):
Number - Layer ID
Type of returned value:
Description:
Creates dynamic opening credits, or end credits.
Used In:
Arma2:OA
Example:
["<t size='2'>" + "Hello World" + "</t>",0.02,0.3,10,-1,1,3010] spawn bis_fnc_dynamicText
//From Operation Arrowhead campaign
[]spawn
{
BIS_ShowUI = "HarrisUp";
Sleep 1.5;
playsound ["ce0_tv_intro_H_0", true]; //yesgoodmorning
_sqf = ["<t size='0.5'>" + localize "STR_EP1_ce0_tv_intro_H_0" + "</t>",-1,-(safezoneH-1.05)/2,50,-1,0,3010] spawn bis_fnc_dynamicText;
Sleep 23;
playsound ["ce0_tv_intro_H_1", true]; //Takistany demanded
_sqf = ["<t size='0.5'>" + localize "STR_EP1_ce0_tv_intro_H_1" + "</t>",-1,-(safezoneH-1.05)/2,50,-1,0,3010] spawn bis_fnc_dynamicText;
Sleep 10;
playsound ["ce0_tv_intro_H_2", true]; //justenetrerd
_sqf = ["<t size='0.5'>" + localize "STR_EP1_ce0_tv_intro_H_2" + "</t>",-1,-(safezoneH-1.03)/2,50,-1,0,3010] spawn bis_fnc_dynamicText;
Sleep 22;
playsound ["ce0_tv_intro_H_3", true]; //Col MuhhamadRazim
_sqf = ["<t size='0.5'>" + localize "STR_EP1_ce0_tv_intro_H_3" + "</t>",-1,-(safezoneH-1.05)/2,50,-1,0,3010] spawn bis_fnc_dynamicText;
Sleep 15;
playsound ["ce0_tv_intro_H_4", true]; //latestreports
_sqf = ["<t size='0.7'>" + localize "STR_EP1_ce0_tv_intro_H_4" + "</t>",-1,-(safezoneH-1.05)/2,50,-1,0,3010] spawn bis_fnc_dynamicText;
};
[center,min dist c,max dist c,min dist o,water mode,max terrain grad,shore mode,blacklist,default positions] call BIS_fnc_findSafePos
Operand types:
center:
Array - center position from which to originate the search
min dist c:
Number - minimum distance from the center position
max dist c:
Number - maximum distance from the center position
min dist o:
Number - minimum distance from the nearest object
water mode:
Number - water "mode"
max terrain grad:
Number - average altitude diffrerence in meters
shore mode:
Number - shore "mode"
blacklist (optional):
Array - nested array of positions to avoid
default positions (optional):
Array - nested array of default positions
Type of returned value:
Array - a position selected based on the given parameters
Description:
Retrieve an dynamic position in the world according to given parameters.
water mode:
0: searched position can not be in the water
1: searched position can be in the water or not
2: searched position must be in the water
shore mode:
0: searched position does not have to be at a shore
1: searched position must be at a shore
Used In:
Arma2/Arma2:OA
Example:
[(position zombycastle),100,200,10,0,2000,0] call BIS_fnc_findSafePos;
[position,interval,areaSize] call BIS_fnc_flies
Operand types:
position:
Arrayinterval (optional):
Number - particle refresh time, default is 0.1
areaSize (optional):
Number - area radius, default is 1
Type of returned value:
Description:
Spawns flies around the given position.
Used In:
Arma2:OA
Example:
[position deadBody,0.05,1.5] call bis_fnc_flies;
Operand types:
Type of returned value:
Description:
Executes HALO script with the corresponding PP and sound effects and anim.
When using object, like player, the function will wait until the player ejects the vehicle he/she is in.
If array is used the function will open a parachute immediately for the given object.
Used In:
Arma2:OA
Example:
player spawn BIS_fnc_halo;
Operand types:
Type of returned value:
Description:
Shows a Function Library Viewer which contains a list of all available functions, both official and unofficial.
Used In:
Arma2/Arma2:OA
Example:
[] call bis_fnc_help;
[string0,string1,..stringN] call BIS_fnc_infoText
Operand types:
Array:
Array of lines of text (
String)
Type of returned value:
Description:
Creates the letter by letter appearing/disappearing text on the bottom right corner of your screen (used in Operation Arrowhead campaign for example).
Used In:
Arma2:OA
Example:
["Hello World", str(01)+"."+(str(58)), "Hello World"] spawn BIS_fnc_infoText;
[localize "STR_EP1_mission.sqmMission_Intel0_8", str(date select 2) + "." + str(date select 1) + "." + str(date select 0), localize "STR_EP1_description.ext0_13"] spawn BIS_fnc_infoText;
[object] call BIS_fnc_inv
Operand types:
object:
Object - vehicle or unit
Type of returned value:
Array - weapons and magazines as
Config entries
Description:
Returns the inventory contents of given unit or vehicle.
The returned values are
Config entries, for example
bin\config.bin/CfgWeapons/m16a4NOTE: for vehicles it returns the mounted gun and it's ammo, not cargo's weapons and ammo.
Used In:
Arma2
Example:
_inventory = [loon1] call BIS_fnc_inv;
[object,inventory item,force add] call BIS_fnc_invAdd
Operand types:
object:
Object - The unit to add the inventory item to
inventory item:
String or
Config entry - weapon class name or weapon config entry
force add (optional):
Boolean - set to
true will force adding the given item
Type of returned value:
Boolean -
true if item is succesfully added into the inventory,
false if not.
When forcing add (force add
true)
Array - list of removed items.
Description:
Adds given item to given unit's inventory.
Checks if there's room in the inventory, if force add is false or not set will not add the item if there is no room.
Setting force add to true will add the item regardless.
Used In:
Arma2
Example:
[player,"M16a4"] call BIS_fnc_invAdd; _wep = ([loon_e] call BIS_fnc_inv) select 0;
_oldPlayersWeapon = [player,_wep,true] call BIS_fnc_invAdd;
[unit,item,amount] call BIS_fnc_invRemove
Operand types:
unit:
Objectitem:
String or
Config entry - item class name or config entry
amount (optional):
Object
Type of returned value:
Number - The amount of succesfully removed items.
Description:
Removes given item from unit's inventory.
Used In:
Arma2
Example:
[loon1,"M16a4"] call BIS_fnc_invRemove; [loon1,"30Rnd_556x45_Stanag",3] call BIS_fnc_invRemove;
[unit] call BIS_fnc_invSlots
Operand types:
Type of returned value:
Array - list of empty inventory slot types
Description:
Returns config inventory slots of given unit.
For example [1,1,1,8,12,2,0,12] which translates into:
1x WeaponSlotPrimary
1x WeaponSlotHandGun
1x WeaponSlotSecondary
8x WeaponSlotHandGunItem
12x WeaponSlotItem
2x WeaponSlotBinocular
0x WeaponHardMounted
12x WeaponSlotInventory
Used In:
Arma2
Example:
_inventorySlots = [loon1] call BIS_fnc_invSlots;
[unit] call BIS_fnc_invSlotsEmpty
Operand types:
Type of returned value:
Array - list of how many empty inventory slots
Description:
Returns the amount of empty inventory item slots for the given unit.
For example [0,0,0,4,0,0,0,7] which translates into:
0x WeaponSlotPrimary
0x WeaponSlotHandGun
0x WeaponSlotSecondary
4x WeaponSlotHandGunItem
0x WeaponSlotItem
0x WeaponSlotBinocular
0x WeaponHardMounted
7x WeaponSlotInventory
Used In:
Arma2
Example:
_emptySlots = [loon1] call BIS_fnc_invSlotsEmpty;
[item] call BIS_fnc_invSlotType
Operand types:
Type of returned value:
Array - numbers representing slots taken by given item
Description:
Returns slots taken by given item (given in config).
One item can take more slots of same or different type - empty if type 0 or not found.
Used In:
Arma2/Arma2:OA
Example:
_slotType = ["compass"] call BIS_fnc_invSlotType;
[unit] call BIS_fnc_invString
Operand types:
Type of returned value:
Array - weapons and magazines
Description:
Returns a list of inventory content for the given unit or vehicle.
NOTE: for vehicles it retruns the mounted weapon and it's ammo, not cargo weapons and ammo.
The returned array is an array of strings: ["M16a4","M16a4Mag"]
Used In:
Arma2/Arma2:OA
Example:
_playerInv = [player] call BIS_fnc_invString;
[object1,object2,offset] call BIS_fnc_isInFrontOf
Operand types:
object1:
Objectobject2:
Objectoffset:
Number
Type of returned value:
Boolean - true if object2 is infront of object1
Description:
Check if an object is in front of another object. Returns true when the given object2 is over the "shoulder line" of the given object1.
You can use the offset value to determine how directly in front of the object1 the object2 must be. With value 18 object2 has to be directly at front of the object1. Value 19 or over will cause the function to return false. So use values from 0 to 18.
Used In:
Arma2/Arma2:OA
Example:
_infront = [player,loon_e,0] call BIS_fnc_isInFrontOf;_playerSeesCar = [player,car1,14] call BIS_fnc_isInFrontOf;
[type(s),area,debug] call BIS_fnc_locations
Operand types:
type(s):
String or
Array of strings
area:
Array - in format [center,distance]
debug (optional):
Boolean
Type of returned value:
Array - List of registered locations
Description:
Creates or registers location logics (used in various modules, like Ambient Civilians, Ambient Civilian Vehicles or Warfare 2).
Upon registering, function will set following variables into location logic's variable space:
- "class" - unique class of location (either BIS_loc_<configname> or BIS_loc_custom_<ID>)
- "name" - name of location from config or setName command. If none is defined, class is used
- "type" - config type
- "neighbors" - config defined neighbor locations
If you're registering currently existing object and some of variables above is already stored in it, it won't be replaced.
Used In:
Arma2/Arma2:OA
Example:
["CityCenter",[position player,1000]] call bis_fnc_locations;
[["acityc_dolina"]] call bis_fnc_locations;
[[myLocation1,myLocation2],[],true] call bis_fnc_locations;
[songs,delay] spawn BIS_fnc_music
Operand types:
songs (optional):
Array - list of songs to play
delay (optional):
Number - delay between songs
Type of returned value:
Description:
Jukebox.
Plays given songs, if songs are not specified plays random default game songs.
Used In:
Arma2:OA
Example:
[["song1", "song2", "song3", "song4"], 2] spawn BIS_fnc_music;
[] spawn BIS_fnc_music;
[path,size,color] call BIS_fnc_playVideo
Operand types:
path:
String - full path to OGV file
size (optional):
Array - in format [x, y, w, h]
color (optional):
Array - in format Color ([r,g,b,a])
Type of returned value:
Description:
Plays in-game video. The video must be in OGV format (
Theora, Ogg Vorbis Video).
GUI layer for video is 25.
The script terminates itself once the video ends.
Used In:
Arma2:OA
Example:
_video = ["intro.ogv"] spawn bis_fnc_playVideo; waitUntil {scriptDone _video};
[object,interval,brightness,newspapers] call BIS_fnc_sandstorm
Operand types:
object:
Object - sandstorm center, you should use the player
interval:
Number - particle refresh time, default is 0.07
brightness:
Number - brightness coeficient, default is 1
newspapers:
Boolean - true if flying newspapers will be present, default is true
Type of returned value:
Array of created particle effect
Description:
Creates particle sandstorm around the given object.
Used In:
Arma2:OA
Example:
[player,-1,0.8,false] call bis_fnc_sandstorm;
units call BIS_fnc_saveGame
Operand types:
units:
Array - units to check
Type of returned value:
Description:
Evaluates the current battlefield situation for the given units and saves the game when appropriate.
Used In:
Arma2/Arma2:OA
Example:
[units group player] call BIS_fnc_saveGame;
array call BIS_fnc_selectRandom
Operand types:
Type of returned value:
Any Value - One of the values you passed, chosen at random
Description:
Selects one of the passed array's elements at random.
Used In:
Arma2/Arma2:OA
Example:
_randomLoon = [loon1,loon2,loon3] call BIS_fnc_selectRandom;
[vehicle,group,dummy toggle,dummy type,crew type] call BIS_fnc_spawnCrew
Operand types:
vehicle:
Object - the vehicle to fill with the crew
group:
Group - the crew's group. Must be an existing group
dummy toggle (optional):
Boolean - whether or not to use the dummy mode
dummy type (optional):
String - dummy mode vehicle type
crew type (optional):
String - type of spawned crew
Type of returned value:
Array - array of objects or scalars.
Description:
Function to fill all crew positions in a vehicle, including turrets.
In dummy mode (dummy toggle set to true) no objects are created and returned array contains only ones (the number 1, as in array of scalars: [1,1,1,1,1]).
In this mode the function can be used to count the actual crew of an existing vehicle or vehicle type.
In the latter case dummy type can be used in order to count a given vehicle type crew positions.
The given crew group must be an existing group.
Used In:
Arma2/Arma2:OA
Example:
_newCrew = [e_tank1,e_tank1_grp] call BIS_fnc_spawnCrew; _crewPosts = [e_tank1,grpNull,true] call BIS_fnc_spawnCrew;
_crewCount = count _crewPosts;
[object1,object2,side,enemy classes,max count,spawn delay,code] spawn BIS_fnc_spawnEnemy
Operand types:
object1:
Object - player
object2:
Object - reference object
side:
Side - the enemy side
enemy classes (optional):
Array - optional list of enemy types to spawn
max count (optional):
Number - maximum count of spawned enemies. Default is 10.
spawn delay (optional):
Number - delay between spawning (in seconds). Default is 30.
code (optional):
Code - code to execute on all spawned units.
Type of returned value:
Array - list of spawned units
Description:
Spawns enemies around players.
The reference object must be a existing unit of the given enemy side.
The spawned enemy will immediately maneuver to attack the player.
You can pass a list of enemy types if you wish.
You can also pass code to be executed for every spawned unit. You can refer to the unit in the code with _this.
Used In:
Arma2:OA
Example:
[player, enemy_mother, east] spawn BIS_fnc_spawnEnemy; [player, enemy_mother, east, ["TK_INS_Soldier_EP1", "TK_INS_Soldier_AAT_EP1", "TK_INS_Soldier_2_EP1", "TK_INS_Soldier_3_EP1", "TK_INS_Soldier_4_EP1"], (2+(random 10)), {_this addEventHandler ['fired', {shotfired=true}]}] spawn BIS_fnc_spawnEnemy;
[position, side, character details, relative positions, list of ranks, skill range, ammo count range, randomization controls, azimuth] call BIS_fnc_spawnGroup
Operand types:
position:
Array - group's starting position
side:
side - groups side
character details: Can be three different types:
a list of character types (
Array), an amount of characters to spawn (
Number) or a CfgGroups entry (
Config)
relative positions (optional):
Array - a list of relative positions
list of ranks (optional):
Array - a list of ranks
skill range (optional):
Array - the range of skill levels
ammo count range (optional):
Array - the range of ammo counts
randomization controls (optional):
Array - randomization controls, first element (0): amount of mandatory units (
Number), second element (1): spawn chance for remaining units (
Number)
azimuth (optional):
Number - the direction the created group is facing
Type of returned value:
Description:
Function which handles the spawning of a dynamic group of characters.
The composition of the group can be passed to the function.
Alternatively a number can be passed and the function will spawn that amount of characters with a random type.
A side's Center must have been created before a group may be spawned. Either by using createCenter or an editor placed (0% Probability of Presence is fine) unit of the appropriate side.
Used In:
Arma2/Arma2:OA
Example:
//Spawn five random EAST units at aPos
[getPos aPos, EAST, 5] call BIS_fnc_spawnGroup;
//Spawn a Stryker MGS Platoon at marker "tankSpawn"
[getMarkerPos "tankSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Armored" >> "US_MGSPlatoon")] call BIS_fnc_spawnGroup;
//Spawn a TK Militia Medic and Soldier at aPos facing south
[getPos aPos, EAST, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
[position,direction,type,side or group] call BIS_fnc_spawnVehicle
Operand types:
position:
Array - position to create the vehicle to
direction:
Number - direction the created vehicle should face
type:
String- type of the vehicle
side or group:
Side or
Group - defines the side of the vehicle or creates it in a existing group
Type of returned value:
Array - [created vehicle (
Object),vehicle's crew (
Array),vehicle's group (
Group)]
Description:
Spawns a certain vehicle type with all crew (including turrets).
The vehicle can either become part of an existing group or create a new group.
Used In:
Arma2/Arma2:OA
Example:
[getPos mySpawnPos, 180, "BMP3", EAST] call bis_fnc_spawnvehicle;
[sniper,spotter] spawn BIS_fnc_spotter
Operand types:
sniper:
Object - The sniper
Spotter:
Object - The spotter
Type of returned value:
Description:
Makes the spotter report target distance to the sniper.
When you see a target and reveal (default is right mouse button) it the spotter will give you the distance to it so you can properly adjust the scope.
Used In:
Arma2:OA
Example:
[player,spotterloon] spawn BIS_fnc_spotter;
[unit,object] spawn BIS_fnc_supplydrop
Operand types:
unit:
Object - aerial unit
object:
String - supply object class
Type of returned value:
Description:
Creates a supplydrop of the given supply object coming down attached to a parachute.
The aerial unit can any of the aerial units, including parachutes.
The function also accepts two pre-set strings as the supply object, these are:
"reammobox" which will create the basic ammobox for the side the dropping vehicle is on. Default is the US ammobox.
"land" which will create a basic vehicle to be dropped, again defined by the side of the dropping vehicle. Default is HMMWV M2.
Used In:
Arma2/Arma2:OA
Example:
[helo1,"reammobox"] spawn BIS_fnc_supplydrop; [plane1,"M2A2_EP1"] spawn BIS_fnc_supplydrop;
[group,attack pos] call BIS_fnc_taskAttack
Operand types:
group:
Group attack pos:
Array - position
Type of returned value:
Description:
The given group will attack the given position.
Used In:
Arma2/Arma2:OA
Example:
[f_group_1,position e_base] call BIS_fnc_taskAttack;
[group,position] call BIS_fnc_taskDefend
Operand types:
group:
Groupposition:
Array
Type of returned value:
Description:
Group will man nearby static defenses within a 100 meter radius of the defense position and guard the position.
Some units will man weapons, others will patrol and the remainder will sit on the ground.
Used In:
Arma2/Arma2:OA
Example:
[group this, getPos this] call bis_fnc_taskDefend;
[group,position,distance,area blacklist] call BIS_fnc_taskPatrol
Operand types:
group:
Group - the group to which to assign the waypoints
position:
Array - the position on which to base the patrol
distance:
Number - the maximum distance between waypoints
area blacklist (optional):
Array - a blacklist of areas
Type of returned value:
Description:
Create a random patrol of several waypoints around a given position.
Used In:
Arma2/Arma2:OA
Example:
[group this, getPos this, 1000] call bis_fnc_taskPatrol;
Notes
There are a lot more functions available that can be viewed in-game via the function viewer: Select Modules (F7) in the mission editor and place the 'Functions' module on the map. You can access the viewer via a radio trigger for example, or a script.
Note that it takes a moment for the functions module to initialize so if you use a radio trigger don't activate it immediately upon mission start. If you use a script, e.g. the init.sqf, you must make the script wait until the functions module is confirmed to have been initialized.
Some of the functions are executed with the command call and some with the command spawn.
The examples shown in the viewer are limited and may fail to mention which should be used, however if you scroll through the function and see either the command sleep or waitUntil you need to use spawn.
spawn executes the function as a script whereas call executes it as a function.
To access the viewer you need to type the following code:
In a radio trigger
[] call BIS_fnc_help
In a script
//wait for the functions module to initialize
waitUntil{!isnil "bis_fnc_init"};
//open the functions viewer
[] call BIS_fnc_help;
NOTE: the Functions module has to be present in the mission if you wish to use any of the BIS functions listed above.