-
Notifications
You must be signed in to change notification settings - Fork 6
API Functions
Coryf88 edited this page Jul 3, 2022
·
5 revisions
Sometimes in your missions, you'll want to do some scripting of your own, and that's okay. We've prepared some small functions to aid you in your endeavors.
BRM_FMK_fnc_addIfNew - DEPRECATED: Use pushBackUnique. | |
Adds an item to an array if it doesn't currently exists in it - otherwise replaces the current index. | |
PARAMETERS |
0 - Item to add (ANY) 1 - Array (ARRAY) |
RETURNS | Index of the item. |
USAGE | ["Nife", myArrayOfPlayers] call BRM_FMK_fnc_addIfNew |
BRM_FMK_fnc_appendIndices | |
Returns an array of the specified indices appended together. | |
PARAMETERS |
0 - Source array (ARRAY) 1 - Indices (ARRAY) |
RETURNS | Array containing the specified indices appended together (ARRAY) |
USAGE | [[["Hello"], ["Foo"], ["Bar"], ["World"]], [0, 1, 3]] call BRM_FMK_fnc_appendIndices; // ["Hello", "Foo", "World"] |
BRM_FMK_fnc_callCodeArea | |
Executes code on all units inside a trigger area. Call this from a trigger init field. | |
PARAMETERS |
0 - thisTrigger (TRIGGER) 1 - Filter (STRING that evaluates as an EXPRESSION / CODE that returns BOOLEAN) 2 - Code to be executed (STRING that evaluates as CODE / CODE) |
RETURNS | Nothing. |
USAGE | // ON A TRIGGER'S INIT FIELD (make sure you set the condition to TRUE):
_nul = [thisTrigger, "(side _x == east)", "[_x, 'side_b'] call BRM_fnc_initAI"] spawn BRM_FMK_fnc_callCodeArea;
_nul = [thisTrigger, "(side _x == civilian) && (alive _x)", "[_x, 'RACS'] call BRM_fnc_initAI"] spawn BRM_FMK_fnc_callCodeArea; |
BRM_FMK_fnc_colorToHex | |
Converts a CfgMarkerColors name to its hexadecimal equivalent. | |
PARAMETERS |
0 - Color name (STRING) CfgMarkerColors classname without the 'Color' prefix: black, grey, red, brown, orange, yellow, khaki, green, blue, pink, white, west, east, guer, civ, unknown, blufor, opfor, independent, civilian |
RETURNS | Color hex code (STRING) |
USAGE | _myColor = ["red"] call BRM_FMK_fnc_colorToHex; |
BRM_FMK_fnc_garrisonUnits | |
Teleports the units to random windows of the building(s) within the distance. Faces units in the right direction and orders them to stand up or crouch on a roof. Units will only fill the building to as many positions as there are windows. Multiple buildings can be filled either evenly or to the limit of each sequentially | |
PARAMETERS |
0 - The building(s) nearest this position is used. (ARRAY) 1 - Array of objects, the units that will garrison the building(s). (ARRAY) 2 - (OPTIONAL) Radius in which to fill building(s), -1 for only nearest building. Default -1 (SCALAR) 3 - (OPTIONAL) true to put units on the roof, false for only inside. Default false (BOOLEAN) 4 - (OPTIONAL) true to fill all buildings in radius evenly, false for one by one. Default false (BOOLEAN) 5 - (OPTIONAL) true to fill from the top of the building down. Default false (BOOLEAN) 6 - (OPTIONAL) true to order AI units to move to the position instead of teleporting. Default false (BOOLEAN) |
RETURNS | Array of objects, the units that were not garrisoned (ARRAY) |
USAGE | [getMarkerPos "myPosition", myArrayOfUnits, -1, true, true] call BRM_FMK_fnc_garrisonUnits; |
BRM_FMK_fnc_getFactionVehicles - DEPRECATED: Use BRM_FMK_fnc_appendIndices. | |
'Alias' for appendIndices | |
PARAMETERS |
0 - Source array (ARRAY) 1 - Indices (ARRAY) |
RETURNS | Array containing the specified indices appended together (ARRAY) |
USAGE | [[["Hello"], ["Foo"], ["Bar"], ["World"]], [0, 1, 3]] call BRM_FMK_fnc_getFactionVehicles; // ["Hello", "Foo", "World"] |
BRM_FMK_fnc_getGear - DEPRECATED: Use getUnitLoadout. | |
Returns an array containing all items of a given unit | |
PARAMETERS | 0 - A player object. (OBJECT) |
RETURNS | An array containing all inventory items. (ARRAY) |
USAGE | [player] call BRM_FMK_fnc_getGear; |
BRM_FMK_fnc_getSideInfo | |
Returns the relevant information about any side. | |
PARAMETERS |
0 - Side whose information should be returned. (SIDE) 1 - The type of information: "faction", "side", "color", "name", "skill", "callsigns", "units", "vehicles", "objects", or "dacCamps" (STRING) |
RETURNS | The requested information. (ANY) |
USAGE | [west, "callsigns"] call BRM_FMK_fnc_getSideInfo;
[east, "name"] call BRM_FMK_fnc_getSideInfo;
[resistance, "faction"] call BRM_FMK_fnc_getSideInfo; |
BRM_FMK_fnc_getUnitsArray - DEPRECATED: Use BRM_FMK_fnc_getSideInfo. | |
Returns an array containing unit class names for the side | |
PARAMETERS | 0 - Side to get the unit class names of. (SIDE) |
RETURNS | An array containing unit class names for the side. (ARRAY) |
USAGE | [WEST] call BRM_FMK_fnc_getUnitsArray; |
BRM_FMK_fnc_newMarker | |
Creates a marker with the specified settings. | |
PARAMETERS |
0 - (OPTIONAL) Marker locality - true for global. Default false. (BOOLEAN) 1 - (OPTIONAL) Name. Default "BRM_FMK_newMarker%d". (ARRAY) 2 - (OPTIONAL) Position. Default [0, 0]. (ARRAY) 3 - (OPTIONAL) Shape: "ICON", "RECTANGLE", "ELLIPSE" or "POLYLINE". Default "ICON". (STRING) 4 - (OPTIONAL) Brush: "Solid", "SolidFull", "Horizontal", "Vertical", "Grid", "FDiagonal", "BDiagonal", "DiagGrid", "Cross", "Border", or "SolidBorder". Default "Solid". (STRING) 5 - (OPTIONAL) Type: See https://community.bistudio.com/wiki/cfgMarkers#ArmA_3 for possible values. Default "". (STRING) 6 - (OPTIONAL) Color: See https://community.bistudio.com/wiki/CfgMarkerColors_Arma_3 for possible values. Default "Default". (STRING) 7 - (OPTIONAL) Size: an array with half width and half height. Default [1, 1]. (ARRAY) 8 - (OPTIONAL) Text. Default "". (STRING) 9 - (OPTIONAL) Direction, in degrees. Default 0. (NUMBER) 10 - (OPTIONAL) Alpha: 0 to 1, with 0 being transparent. Default 1. (NUMBER) |
RETURNS | The created marker's name. (STRING) |
USAGE | // Create a 50% transparent, solid, blue, 500x500 rectangle at the player's position.
_mynewMarker = [true, nil, player, "RECTANGLE", "Solid", nil, "ColorBlue", [250, 250], nil, 0, 0.5] call BRM_FMK_fnc_newMarker;
// Create a 50% transparent, cross, red, 500x500 ellipse at the player's position.
_markerName = [false, nil, player, "ELLIPSE", "Cross", nil, "ColorRed", [250, 250], nil, 0, 0.5] call BRM_FMK_fnc_newMarker;
// Create a opaque, blue, 1x1 hd_flag labeled "Help us!" at the player's position.
_markerName = [true, nil, player, nil, nil, "hd_flag", "ColorBlue", [1, 1], "Help us!", 0, 1] call BRM_FMK_fnc_newMarker;
// Create a opaque, red, 0.5x0.5 hd_warning labeled "Enemy infantry" at the position of 'enemy'.
_markerName = [false, nil, enemy, nil, nil, "hd_warning", "ColorRed", [0.5, 0.5], "Enemy infantry", 0, 0.3] call BRM_FMK_fnc_newMarker; |
BRM_FMK_fnc_newMarkerArea | |
Easier and shorter way to create markers. Makes an area marker. | |
PARAMETERS |
0 - Locality - "global" or "local" (STRING) 1 - Position. (ARRAY) 2 - Type: The area type - "RECTANGLE" or "ELLIPSE" (STRING) 3 - Brush: Fill: see https://community.bistudio.com/wiki/setMarkerBrush (STRING) 4 - (OPTIONAL) Color: "ColorRed", "ColorBlue" etc. (STRING) 5 - (OPTIONAL) Size: an array with the width and the height, 1 being the default. (ARRAY) 6 - (OPTIONAL) Direction in degrees. (NUMBER) 7 - (OPTIONAL) Opacity, from 0 to 1. (NUMBER) |
RETURNS | Object of the marker created. (MARKER) |
USAGE | _mynewMarker = ["global", (getPos player), "RECTANGLE", "Solid", "ColorBlue", [250,250], 0, 0.5] call BRM_FMK_fnc_newMarkerArea;
_mynewMarker = ["local", (getPos player), "ELLIPSE", "Cross", "ColorRed", [250,250], 0, 0.5] call BRM_FMK_fnc_newMarkerArea; |
BRM_FMK_fnc_newMarkerIcon | |
Easier and shorter way to create markers. Makes an icon marker. | |
PARAMETERS |
0 - Locality - "global" or "local" (STRING) 1 - Position. (ARRAY) 2 - Type: The marker's icon. See https://community.bistudio.com/wiki/cfgMarkers (STRING) 3 - (OPTIONAL) Color: "ColorRed", "ColorBlue" etc. (STRING) 4 - (OPTIONAL) Text. (STRING) 5 - (OPTIONAL) Size: an array with the width and the height, 1 being the default. (ARRAY) 6 - (OPTIONAL) Direction in degrees. (NUMBER) 7 - (OPTIONAL) Opacity, from 0 to 1. (NUMBER) |
RETURNS | Object of the marker created. (MARKER) |
USAGE | _mynewMarker = ["global", (getPos player), "hd_flag", "ColorBlue", "Help us!", [1,1], 0, 1] call BRM_FMK_fnc_newMarkerIcon;
_mynewMarker = ["local", (getPos enemy), "hd_warning", "ColorRed", "Enemy infantry", [0.5,0.5], 0, 0.3] call BRM_FMK_fnc_newMarkerIcon; |
BRM_FMK_fnc_playGlobal | |
Plays a track global to all players. | |
PARAMETERS | 0 - Track. (STRING) |
RETURNS | Nothing. |
USAGE | ["LeadTrack01_F"] call BRM_FMK_fnc_playGlobal; |
BRM_FMK_fnc_setGear - DEPRECATED: Use setUnitLoadout. | |
Restores previously saved gear | |
PARAMETERS |
0 - A player object. (OBJECT) 1 - An array containing all gear. (ARRAY) |
RETURNS | Nothing. |
USAGE | [player, [player] call BRM_FMK_fnc_getGear] call BRM_FMK_fnc_setGear; |
BRM_FMK_fnc_showText | |
Shows text in an organized and timed fashion. | |
PARAMETERS |
n Screens to display (ARRAY): 0 - Text to show (STRING) 1 - Type of title (STRING) 2 - How long to display (NUMBER) |
RETURNS | All titles have been displayed. (BOOLEAN) |
USAGE | [
["This is an intro...", "BLACK FADED", 3],
["And it just ended!", "PLAIN", 5]
] spawn BRM_FMK_fnc_showText; |
BRM_FMK_fnc_stripItems | |
Remove all items from a unit object. | |
PARAMETERS | 0 - Unit (OBJECT) |
RETURNS | Nothing. |
USAGE | [player] call BRM_FMK_fnc_stripItems; |
BRM_FMK_fnc_teamsExist | |
Loops through to see how many sub-teams exist under your squad. | |
PARAMETERS |
0 - Your side + squad. (STRING) 1 - Your own team. (NUMBER) |
RETURNS | Sub-teams that exist in your squad, disregarding the Actual team. |
USAGE | ["blu_0", 1] call BRM_FMK_fnc_teamsExist; |
BRM_FMK_fnc_unitFromName | |
Gets a unit's object from its name. | |
PARAMETERS | 0 - Name (STRING) |
RETURNS | Unit (OBJECT) |
USAGE | ["Nife"] call BRM_FMK_fnc_unitFromName; |
BRM_FMK_fnc_verboseArray | |
Converts an array into an english reading format. | |
PARAMETERS | 0 - Array (ARRAY) |
RETURNS | Verbosed array (STRING) |
USAGE | _myReadArray = [["Nife","Royal","Knite"]] call BRM_FMK_fnc_verboseArray; // "Nife, Royal and Knite" |
BRM_FMK_fnc_weaponAway | |
The unit will put its current weapon away. | |
PARAMETERS | 0 - What unit should put the current weapon on back? (OBJECT) |
RETURNS | Nothing. |
USAGE | [player] call BRM_FMK_fnc_weaponAway; |
Maintained by BromA - ArmA for the refined autist.