User Tools

Site Tools


nfextra_functions

Table of Contents

artillery

nfextra_artillery_fnc_artilleryBarrage

/*
 * File: artilleryBarrage.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   This function initiates an artillery barrage at a specified location with given parameters.
 * 
 * Parameter(s):
 *   0: ARRAY - Center position of the barrage
 *   1: ARRAY - Area dimensions of the barrage [a,b,angle,rect,c]
 *   2: STRING - Ammo class to be used for the barrage
 *   3: NUMBER - Minimum delay between shots
 *   4: NUMBER - Maximum delay between shots
 *   5: NUMBER - Duration of the barrage
 *   6: NUMBER - Height at which projectiles are spawned
 *   7: NUMBER - Downward velocity of the projectiles
 *   8: STRING - Sound to be played during the barrage
 *   9: NUMBER - Safety radius around players where the barrage can't hit
 * 
 * Returns:
 *   handle
 */

Back to top

nfextra_artillery_fnc_stopArtilleryBarrage

/*
 * File: stopArtilleryBarrage.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   This function stops an ongoing artillery barrage identified by the given handle.
 * 
 * Parameter(s):
 *   0: NUMBER - Handle of the artillery barrage to stop
 * 
 * Returns:
 *   NOTHING
 */

Back to top

common

nfextra_common_fnc_addACEItems

/* ----------------------------------------------------------------------------
Function: addACEItems.sqf

Description:
  Add some basic ACE medical items to a unit, values right now hardcoded due to lazyness
Parameters:
  unit: OBJECT - the unit to add ACE medical items to
Returns:
  success: BOOLEAN - true on success, false otherwise
Examples:
  (begin example)
  this call nfextra_common_fnc_addACEItems;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_addDestroyWithFireAction

/* ----------------------------------------------------------------------------
Function: addDestroyWithFireAction.sqf

Description:
  Adds action to destroy object with fire grenade (AN M14 from ACE)
Parameters:
  object: OBJECT - the object the action should be attached to
Returns:
  nothing
Examples:
  (begin example)
  this call nfextra_common_fnc_addDestroyWithFireAction;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_addItemOrDrop

/*
 * File: addItemOrDrop.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Adds an item into player inventory, or drops it onto ground if it can't be added. Should be run local to the player.
 * 
 * Parameter(s):
 *   0: STRING - class name of the item to add
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_addLootDropToUnit

/*
 * File: addLootDropToUnit.sqf
 * Author: Tiwaz
 * -----
 * Description:
 *   Adds a loot table of possible loot drops to a unit. When its killed there is chance for it to drop loot based on data in the table
 * 
 * Parameter(s):
 *   0: Object - The unit that can drop loot
 *  1: ARRAY - ARRAY of Loot Data (see below)
 *  2: BOOL - Wether or not multiple drops are allowed
 *
 * Loot Data Array:
 * 0: STRING - item classname 
 * 1: NUMBER - chance of item dropping from 0 for 0% to 1 for 100%
 * 2: NUMBER - Amount of items dropped
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_addToCargo

/* ----------------------------------------------------------------------------
Function: addToCargo.sqf

Description:
  Add any item to cargo
Parameters:
  item: STRING - type of item
  container: OBJECT - container to add items into
  amount: NUMBER - amount of items to add
Returns:
  nothing
Examples:
  (begin example)
  ["toolkit",_box,2] call nfextra_common_fnc_addToCargo;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_canFitCargo

/*
 * File: canFitCargo.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Checks if the supplied vehicle can fit all items of the given cargo array
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_canSafelyRemove

/*
 * File: canSafelyRemove.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Checks if something is "unseen" and therefore safe to remove without a player noticing
 * 
 * Parameter(s):
 *   0: OBJECT - The object which should check if players are nearby
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_codeToExpressionString

/*
 * File: codeToExpressionString.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Converts code {hint "example"} to expression string "hint example"
 * 
 * Parameter(s):
 *   0: CODE - the code
 * 
 * Returns:
 *   STRING - expression string
 */

Back to top

nfextra_common_fnc_distanceToClosestPlayer

/* ----------------------------------------------------------------------------
Function: fnc_distanceToClosestPlayer.sqf

Description:
  Returns distance to closest player from position
Parameters:
  pos - position
Returns:
  NUMBER - distance
Examples:
  (begin example)
  [0,0,0] call nfextra_common_fnc_distanceToClosestPlayer;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_endMissionWithOutro

/* ----------------------------------------------------------------------------
Function: endMissionWithOutro.sqf

Description:
  Plays an outro video and then ends the mission
Parameters:
  path: STRING - relative path to video in mission folder.
  message: STRING - message shown to players on mission ending screen
Returns:
  NOTHING
Examples:
  (begin example)
  ["intro.ogv","Ending"] call nfextra_common_fnc_endMissionWithOutro;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_explodado

/*
 * File: explodado.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Function to causes large explosions or even spread out ones (cook off) depending on arguments passed.
 *  A bit overengineered to avoid scheduled environment
 * Parameter(s):
 *   0: ARRAY - Position array
 *  1: STRING - Ammo classname for bombs, missiles and such that will be used to cause the explosion "M_Zephyr" good for decent size HE explosion, "Bo_GBU12_LGB" big boom that can damage armored vehicles
 *  2: NUMBER - Amount of ammo
 *  3: NUMBER - Minimum delay between explosions
 *  4: NUMBER - Max delay between explosions
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_explodeWhenDead

/*
 * File: explodeWhenDead.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Causes an explosion when vehicle is considered killed
 * 
 * Parameter(s):
 *   0: OBJECT - Object which will explode when killed
 *  1: STRING - Ammo classname for bombs, missiles and such that will be used to cause the explosion "M_Zephyr" good for decent size HE explosion, "Bo_GBU12_LGB" big boom that can damage armored vehicles
 *  2: NUMBER - Amount of ammo
 *  3: NUMBER - Minimum delay between explosions
 *  4: NUMBER - Max delay between explosions
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_fillInventory

/* ----------------------------------------------------------------------------
Function: fillInventory.sqf

Description:
  Fills up a units inventory with ammo based on what he already has
Parameters:
  unit: OBJECT - the unit which inventory should be filled up
Returns:
  nothing
Examples:
  (begin example)
  this call nfextra_common_fnc_fillInventory
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_findSafePos

/*
 * File: findSafePos.sqf
 * Author: Joris-Jan van 't Land, optimised by Killzone_Kid modified by Northern Fronts Mod
 * -----
 *  Description:
 *      NFEXTRA: This is the findSafePos modified so you can give it a list of object types it should NOT consider (see https://community.bistudio.com/wiki/nearestTerrainObjects for possible values).
 *      The main motivation behind this is the fact that findSafePos considers roads, tracks, trail as obstructions, which makes no sense.
 *      This also allows ignoring bushes, small trees as obstructions, if you for example want to find a good location to spawn a vehicle, but are willing to clear some vegetation.
 *      What follows is the original function header, with the new paramter added:
 *
 *    Function to generate position in the world according to several parameters.
 *
 *  Parameters:
 *    0: (Optional) ARRAY - center position
 *        Note: passing [] (empty Array), the world's "safePositionAnchor" entry will be used.
 *        
 *    1: (Optional) NUMBER - minimum distance from the center position
 *    2: (Optional) NUMBER - maximum distance from the center position
 *        Note: passing -1, the world's "safePositionRadius" entry will be used.
 *        
 *    3: (Optional) NUMBER - minimum distance from the nearest object
 *    4: (Optional) NUMBER - water mode
 *        0 - cannot be in water
 *        1 - can either be in water or not
 *        2 - must be in water
 *            
 *    5: (Optional) NUMBER - maximum terrain gradient (hill steepness)
 *    6: (Optional) NUMBER - shore mode:
 *        0 - does not have to be at a shore
 *        1 - must be at a shore
 *            
 *    7: (Optional) ARRAY - black listed areas in format [area1, area2, area3, ...areaN], where area is: 
 *        ARRAY - array in format [topLeftCorner, bottomRightCorner]
 *        or
 *        OBJECT - trigger area
 *        STRING - marker area
 *        LOCATION - location area
 *        ARRAY - array in format [center, distance] or [center, a, b, angle, rect] or [center, a, b, angle, rect, height]
 *            
 *    8: (Optional) ARRAY - array in format [landPosition, seaPosition], where:
 *        landPosition: ARRAY - in format [x,y] or [x,y,z] - default position on land
 *        seaPosition: ARRAY - in format [x,y] or [x,y,z] - default position on water
 *
 *      9: (optional) ARRAY - array of type names to ignore in proximity check. Recommend values to ignore roads and trails: ["HIDE", "ROAD", "MAIN ROAD", "TRACK", "TRAIL"]
 *      Possible values are: 
 *      "BUILDING","BUNKER","BUSH","BUSSTOP","CHAPEL","CHURCH","CROSS","FENCE","FOREST BORDER","FOREST SQUARE","FOREST TRIANGLE","FOREST","FORTRESS","FOUNTAIN",
 *      "FUELSTATION","HIDE","HOSPITAL","HOUSE","LIGHTHOUSE","MAIN ROAD","POWER LINES","POWERSOLAR","POWERWAVE","POWERWIND","QUAY","RAILWAY","ROAD","ROCK","ROCKS",
 *      "RUIN","SHIPWRECK","SMALL TREE","STACK","TOURISM","TRACK","TRAIL","TRANSMITTER","TREE","VIEW-TOWER","WALL","WATERTOWER"
 *  
 *  Returns:
 *    ARRAY - position solution
 *  Syntax:
 *      [center, minDist, maxDist, objDist, waterMode, maxGrad, shoreMode, blacklistPos, defaultPos,types] call nfextra_common_fnc_findSafePos;
 *  Example:
 *      private _pos = [player, 1, 150, 3, 0, 20, 0,[],[],["HIDE", "ROAD", "MAIN ROAD", "TRACK", "TRAIL"]] call nfextra_common_fnc_findSafePos;
 */

Back to top

nfextra_common_fnc_forceFace

/* ----------------------------------------------------------------------------
Function: fnc_forceFace.sqf

Description:
  Forces certain face on playable unit. Persists through respawn.
Parameters:
  object - OBJECT - playable unit
    face - STRING - classname of the face
Returns:
  nothing
Examples:
  (begin example)
  [this,_faceClass] call nfextra_common_fnc_forceFace;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_getAllCargo

/*
 * File: getAllCargo.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Returns all cargo in the given container or vehicle
 * 
 * Parameter(s):
 *   0: OBJECT - the vehicle
 * 
 * Returns:
 *   0: ARRAY - ARRAY of weapons format [classNames,amounts]
 *   1: ARRAY - ARRAY of magazines format [classNames,amounts]
 *   2: ARRAY - ARRAY of items format [classNames,amounts]
 *   3: ARRAY - ARRAY of backpacks format [classNames,amounts]
 */

Back to top

nfextra_common_fnc_getInventoryItemMass

/*
 * File: getInventoryItemMass.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Gets the mass valaue required to store the given inventory item
 * 
 * Parameter(s):
 *   0: STRING - classname of the item, weapo, backpack or magazine
 * 
 * Returns:
 *   NUMER - the mass of the item
 */

Back to top

nfextra_common_fnc_getPosWithinConstraints

/* ----------------------------------------------------------------------------
Function: getPosWithinConstraints.sqf

Description:
  Gets a position with direction between dirFrom and dirTo in relation to center, 
  at least distance away from pos and nearest player 
Parameters:
  center: ARRAY format position - center position
  distance: NUMBER - distance
  dirFrom: NUMBER - direction
  dirTo: NUMBER - direction
Returns:
  position
Examples:
  (begin example)
  [player,500,0,259] call nfextra_common_fnc_getPosWithinConstraints;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_hasAllCargo

/*
 * File: hasAllCargo.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Check if the object contains all the required cargo items. CargoData passed into this function is the same as returned by getAllCargo
 * 
 * Parameter(s):
 *   0: OBJECT - The container or vehicle
 *  1: ARRAY - cargo data in same format as values returned by getAllCargo
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_inNested

/*
 * File: inNested.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Function to check for appearance of an element anywhere in an array, including subarrays. Even works on arrays with mixed type
 * 
 * Parameter(s):
 *   0: ARRAY - the array to search
 *  1: ANY - the element to find
 * 
 * Returns:
 *   Boolean - true if found false if not
 */

Back to top

nfextra_common_fnc_isKindOfAny

/*
 * File: isKindOfAny.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   This function works like the "isKindOf" command, but checks for multiple types
 * 
 * Parameter(s):
 *   0: OBJECT or CLASS - the element to check type of
 *  1: ARRAY - Array with types
 * 
 * Returns:
 *   Boolean - true if its of any of the given types
 */

Back to top

nfextra_common_fnc_isLambsLoaded

/* ----------------------------------------------------------------------------
Function: lambs.sqf

Description:
  Returns wether or not lambs is loaded
Parameters:
  none
Returns:
  boolean
Examples:
  (begin example)
  if (call nfextra_populator_fnc_lambs) then {
        hint "lambs is active";
    };
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_markAsGarbage

/*
 * File: markAsGarbage.sqf
 * Author: Tiwaz
 * -----
 * Description:
 *   Marks something as garbage and activates scripted garbage collector if it isn't active yet
 * 
 * Parameter(s):
 *   0: ARRAY - array of objects to remove
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_nearPlayer

/*
 * File: nearPlayer.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 * Check whether these are any players within a certain distance of a unit.
 * 
 * Parameter(s):
 *   0: OBJECT - the entity to check the distance from
 *  1: NUMBER - the desired distance
 * 
 * Returns:
 * BOOLEAN: true if there are any players within the given distance of the position, false if there aren't.
 *
 * Examples:
 * [pos, distance] call nfextra_common_fnc_nearPlayer;
 */

Back to top

nfextra_common_fnc_quickTravel

/* ----------------------------------------------------------------------------
Function: quickTravel.sqf

Description:
  Teleports a group of players with a transition.
Parameters:
  group: GROUP - the group to teleport
  destination: ARRAY - format position - the position to teleport them to
  text : STRING - text to display to the players during transition
Returns:
  nothing
Examples:
  (begin example)
  Example for calling it from zeus init (select local)
  [_this,[12782,8474.84,0],"Some time later"] call nfextra_common_fnc_quickTravel;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_quickTravelClient

/* ----------------------------------------------------------------------------
Function: fnc_quickTravelClient.sqf

Description:
  Teleports local client with fancy transition
  Fades out, shows text and teleports the player before fading back in again.
Parameters:
  destination - ARRAY - position array
    text - STRING - text shown during transition
    speed - NUMBER - speed of the transition
    sound - STRING - classname of the sound
Returns:
  nothing
Examples:
  (begin example)
  [[0,0,0],"Fancy Text",5,"outro_Truck"] call nfextra_common_fnc_quickTravelClient;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_randomSpreadPosInArea

/* ----------------------------------------------------------------------------
Function: fnc_randomSpreadPosInArea.sqf

Description:
  Gets somewhat evenly distributet random positions in an area
Parameters:
  center: ARRAY format pos - center position of the area
  area: ARRAY format area - area to search in
  count: NUMBER - number of random positions to get
Returns:
  array of positions
Examples:
  (begin example)
  [[0,0,0],[100,100,0,true],10] call nfextra_common_fnc_randomSpreadPosInArea;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_removeCargo

/*
 * File: removeCargo.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Remove cargo based on the supplied cargo array
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_saveTeleportGroup

/* ----------------------------------------------------------------------------
Function: fnc_saveTeleportGroup.sqf

Description:
  Teleports a group safely (attempting to avoid spawning them inside objects)
Parameters:
  group: GROUP - group that will be teleportet
  pos: ARRAY format position - target position
Returns:
  nothing
Examples:
  (begin example)
  [group player,[0,0,0]] call nfextra_common_fnc_saveTeleportGroup;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_selectRandomAndDelete

/*
 * File: selectRandomAndDelete.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Selects and returns random element of an array and then deletes that element from the array
 * 
 * Parameter(s):
 *   0: ARRAY - the array to select random from
 * 
 * Returns:
 *   ANY - the selected element
 */

Back to top

nfextra_common_fnc_setAIStatic

/* ----------------------------------------------------------------------------
Function: fnc_setAIStatic.sqf

Description:
  Sets AI to not move from the spot. Essentially disabling "PATH", but also works with lambs.
Parameters:
  ai: OBJECT - the AI unit
  isStatic: BOOLEAN - if AI should be static (not moving)
Returns:
  nothing
Examples:
  (begin example)
  [this,true] call nfextra_common_fnc_setAIStatic
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_common_fnc_setAllCargo

/*
 * File: setAllCargo.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Adds item and backpack cargo to a vehicle. CargoData passed into this function is the same as returned by getAllCargo
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_common_fnc_stalkNearestEnemyGroup

/*
 * File: stalkNearestEnemyGroup.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Looks for the nearest enemy and makes the group stalk that enemy
 * 
 * Parameter(s):
 *   0: GROUP - the group that should be stalking its nearest enemys
 * 
 * Returns:
 *   NOTHING
 */

Back to top

descriptionext

nfextra_descriptionext_fnc_harderToSpot

/* ----------------------------------------------------------------------------
Function: harderToSpot.sqf

Description:
  Makes players harder to spot via unit traits.
Examples:
  (begin example)
  playerHarderToSpot = 1; - in description.ext enables this feature
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_descriptionext_fnc_persistentInsignia

/* ----------------------------------------------------------------------------
Function: persistentInsignia.sqf

Description:
  Ensures insignia stays the same after respawn, only for players
Examples:
  (begin example)
  persistentInsignia = 1; in description.ext to enable
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_descriptionext_fnc_serverViewDistance

/* ----------------------------------------------------------------------------
Function: serverViewDistance.sqf

Description:
  Sets the servers viewdistance, which also acts as the limit for all clients viewdistance.
  Increasing the server viewdistance impacts AI calculations on the server. Be sensible with it.
Parameters:
  
Returns:
Examples:
  (begin example)
  serverViewDistance = 1000; in description.ext to set viewDistance to 1000 meters
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_descriptionext_fnc_weaponOnBack

/* ----------------------------------------------------------------------------
Function: weaponOnBack.sqf

Description:
  Automaticaly lowers player weapon on respawn.
Examples:
  (begin example)
  playerWeaponOnBack = 1; - in description.ext to enable
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_descriptionext_fnc_zeusRespawnNotification

/* ----------------------------------------------------------------------------
Function: zeusRespawnNotification.sqf

Description:
  System for showing notifications to zeus whenever players respawn.
Examples:
  (begin example)
    In description.ext:
  zeusRespawnNotificationDuration = 15; - how long respawned player notification is shown
  zeusRespawnNotification = 1; - enables this system
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

loadout

nfextra_loadout_fnc_applyLoadouts

/* ----------------------------------------------------------------------------
Function: applyLoadouts.sqf

Description:
  Applies loadouts to units. Made for use with player loadouts, but could be used elswhere as well.
Parameters:
  unitClasses: ARRAY of strings - unit classes that should have the loadouts applied
  loadoutData: ARRAY of loadout data:
    - loadouts: ARRAY of loadouts - Unit Loadout Array or config - array in format of https://community.bistudio.com/wiki/Unit_Loadout_Array
    - init: CODE - code to be run local to the unit on init
Returns:
  nothing

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_loadout_fnc_createBoxSpawner

/* ----------------------------------------------------------------------------
Function: createBoxSpawner.sqf

Description:
  Creates a box spawner
Parameters:
  spawner: OBJECT - the object with actions on it to spawn boxes
  boxData: ARRAY - array in following format:
    - type: STRING - classname of the box object
    - displayname: STRING - name shown in action menu
    - weapons: ARRRAY of STRINGS - weapon classnames
    - magazines: ARRRAY of STRINGS - magazine classnames
    - backpack: ARRRAY of STRINGS - backpack classnames
    - items: ARRRAY of STRINGS - item classnames
Returns:
  Nothing

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_loadout_fnc_createLoadoutSelector

/* ----------------------------------------------------------------------------
Function: createLoadoutSelector.sqf

Description:
  Creates a loadout selector
Parameters:
    spawner: OBJECT - object with action for loadout selection
  loadoutData: ARRAY of loadout data:
    - loadouts: ARRAY of loadouts - Unit Loadout Array or config - array in format of https://community.bistudio.com/wiki/Unit_Loadout_Array
    - init: CODE - code to be run local to the unit on init
    - name: STRING - name of the loadout which is shown in action name
Returns:
  Nothing

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

logistics

nfextra_logistics_fnc_addToManufacturingQue

/*
 * File: addToManufacturingQue.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Only call this function on server
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_logistics_fnc_buyRecipe

/*
 * File: buyRecipe.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   This function allows one to purchase a recipe. It will remove the cost from the manufacturing objects cargo and que the creation of the recipe.
 * 
 * Parameter(s):
 *   0: OBJECT - The manufacturing object that should be used
 *  1: STRING - category of the recipe
 *  2: STRING - name of the recipe
 *  3: AMOUNT - How often should the recipe be purchased
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_logistics_fnc_getFactories

/*
 * File: getFactories.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Gets factory objects
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_logistics_fnc_getItemCount

/*
 * File: getItemCount.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Returns the count of a specific item in an object's cargo.
 * 
 * Parameter(s):
 *   0: OBJECT - Object to check
 *   1: STRING - Item type to check for
 * 
 * Returns:
 *  NUMBER - Count of the item in the object's cargo
 */

Back to top

nfextra_logistics_fnc_getManufacturingRecipes

/*
 * File: getManufacturingRecipes.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Get manufacturing recipes
 * 
 * Parameter(s):
 *   0: SIDE - side to filter by
 * 
 * Returns:
 *   array of hashmaps - manufacturing recipes
 */

Back to top

nfextra_logistics_fnc_getManufacturings

/*
 * File: getManufacturings.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   I don't think this works right now. Might fix later
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_logistics_fnc_getProductionNumber

/*
 * File: getProductionNumber.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Gets the amount of times a recipe can be produced with the current cargo of a manufacturing object
 * 
 * Parameter(s):
 *   0: OBJECT - Manufacturing object
 *   1: STRING - Product category
 *   2: STRING - Product name
 * 
 * Returns:
 *   NUMBER - Amount of times the recipe can be produced
 */

Back to top

nfextra_logistics_fnc_getRecipeFromCategoryAndName

/*
 * File: getRecipeFromCategoryAndName.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Gets a recipe from a category and name
 * 
 * Parameter(s):
 *   0: STRING - Category
 *   1: STRING - Name
 * 
 * Returns:
 *   HASHMAP - Recipe
 */

Back to top

nfextra_logistics_fnc_initFactory

/*
 * File: initFactory.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Initializes a factory building
 * 
 * Parameter(s):
 *   0: OBJECT - Factory building
 *   1: ARRAY - Cost
 *   2: ARRAY - Produce
 *   3: NUMBER - Production rate
 *   4: NUMBER - Downtime
 *   5: CODE - Condition
 *   6: CODE - On production cycle start
 *   7: CODE - On production cycle end
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_logistics_fnc_initManufacturing

/*
 * File: initManufacturing.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Initiates a manufacturing building
 * 
 * Parameter(s):
 *   0: OBJECT - Object to initiate
 *   1: SIDE - Side of the object
 *   2: CODE - Usage condition
 *   3: CODE - On manufacture start
 *   4: CODE - On manufacture end
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_logistics_fnc_initManufacturingRecipe

/*
 * File: initManufacturingRecipe.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Initializes a manufacturing recipe
 * 
 * Parameter(s):
 *   0: STRING - Name - name of the recipe
 *   1: STRING - Category - category of the recipe
 *   2: ARRAY - Cost - items that will be consumed
 *   3: ARRAY - Produce - items that will be prduced
 *   4: BOOL - Create All - wether or not to create objects, groupdata AND recipe or random
 *   5: NUMBER - Production rate - time it takes to produce this recipe once
 *   6: SIDE - Side - side that will have access to the recipe
 *   7: STRING - Unlock hint - hint shown to player when unlock conditon false
 *   8: CODE - Unlock condition - condition for unlocking the recipe
 *   9: CODE - On produced - code to run when produced
 *   10: ARRAY - Object data - data for creating objects
 *   11: ARRAY - Group data - data for creating groups
 *   12: STRING - Icon - icon for the recipe
 * 
 * Returns:
 *   hashmap - recipe data
 */

Back to top

modules

nfextra_modules_fnc_createGroup

/*
 * File: createGroup.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Creates a group with data from nfextra_modules_fnc_getSyncedGroups
 * 
 * Parameter(s):
 *   0: ARRAY - Position where the groups should spawn
 *  1: ARRAY - Group data. Element returned by nfextra_modules_fnc_getSyncedGroups
 *  2: ARRAY or Object - Position or object. If supplied, sets the direction of spawned vehicles and soldiers towards this position or object.
 * 
 * Returns:
 *  0: GROUP  - The created Group
 *   1: NUMBER - Total number of created vehicles
 *  2: NUMBER - Total number of crew created
 *  3: NUMBER - Total number of created foot soldiers
 */

Back to top

nfextra_modules_fnc_createObject

/*
 * File: createObject.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Creates objects with data from nfextra_modules_fnc_getSyncedObjects
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_modules_fnc_getArea

/* ----------------------------------------------------------------------------
Function: getArea.sqf

Description:
  Gets area values from a module
Parameters:
  module: OBJECT with area - the module
Returns:
  area: ARRAY format area - [a, b, angle, isRectangle, c]
Examples:
  (begin example)
  _logic call nfextra_modules_getArea
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_modules_fnc_getGroupCounts

/*
 * File: getGroupCounts.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   This function processes a group's data from "nfextra_modules_fnc_getSyncedGroups" and categorizes the counts of various vehicle types and foot soldiers.
 *   It updates the counts of vehicles and their crews, and also counts foot soldiers under a generic "Footsoldier" category.
 * 
 * Parameter(s):
 *   0: ARRAY - Array in format of returned array by nfextra_modules_fnc_getSyncedGroups. See documentation of that function for more details
 * 
 * Returns:
 *   (HashMap) A hashmap containing counts of different vehicle categories and foot soldiers.
 *     - Key: (String) Category name (Possible values: "Footsoldier", "Air", "LandVehicle", "Ship")
 *     - Value: (Array) [Count of vehicles/foot soldiers, Total count of crew members in vehicles (0 for foot soldiers)]
 */

Back to top

nfextra_modules_fnc_getSyncedGroups

/*
 * File: getSyncedGroups.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   This script retrieves all groups synchronized with the given logic object and processes their units.
 *   It categorizes units into vehicles and foot soldiers, gathers relevant data, and deletes the units and groups.
 * 
 * Parameter(s):
 *   0: OBJECT
 *     The logic object from which the synced groups are retrieved.
 * 
 * Returns:
 *   ARRAY in format [
 *     [
 *       [
 *         ARRAY of foot soldier data in format [typeOf, loadout]
 *       ],
 *       [
 *         ARRAY of vehicle data in format [
 *           typeOf,
 *           ARRAY of crew data in format [typeOf, loadout, role, cargoIndex, turretPath],
 *                  ARRAY of cargo data in format [getWeaponCargo,getMagazineCargo,getItemCargo,getBackpackCargo]
 *           type category (e.g., "Air", "LandVehicle", "Ship")
 *         ]
 *       ],
 *       SIDE
 *     ]
 *   ]
 *   Each element in the returned array corresponds to a group. For each group, the array contains:
 *     - An array of foot soldier data, where each foot soldier data is represented by an array containing its type and loadout.
 *     - An array of vehicle data, where each vehicle data is represented by an array containing:
 *       - The type of the vehicle.
 *       - An array of crew data, where each crew data is represented by an array containing the crew member's type, loadout, role, cargo index, and turret path.
 *          - An array of cargo data as returned by nfextra_common_fnc_getAllCargo
 *       - The category of the vehicle (e.g., "Air", "LandVehicle", "Ship").
 *     - The side (BLUFOR, OPFOR, INDEPENDENT, CIVILIAN) to which the group belongs.
 * 
 * Example:
 *   [
 *     [
 *       [
 *         ["B_Soldier_F", UNITLOADOUTARRAY],
 *         ["B_Soldier_LAT_F", UNITLOADOUTARRAY]
 *       ],
 *       [
 *         [
 *                  "B_MRAP_01_F", 
 *                  [
 *                 ["B_Soldier_F", UNITLOADOUTARRAY, "Driver", -1, []],
 *                 ["B_Soldier_LAT_F", UNITLOADOUTARRAY, "Gunner", -1, [0]]
 *             ], CARGODATA,
 *                  "LandVehicle"
 *              ]
 *       ],
 *       EAST
 *     ]
 *   ]
 * For example UNITLOADOUTARRAYs look here: https://community.bistudio.com/wiki/Unit_Loadout_Array
 */

Back to top

nfextra_modules_fnc_getSyncedObjects

/*
 * File: getSyncedObjects.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   This script retrieves all objects synchronized with the given logic object. If its a vehicle cargo data is saved alongside.
 *   Vehicles with crew, unit and groups are filtered out. To save those use getSyncedGroups instead.
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   0: STRING - object classname
 *  1: ARRAY - Cargo array as returned by getAllCargo
 */

Back to top

modules_common

nfextra_modules_common_fnc_constantPush

/*
 * File: constantPush.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *  Starts an instance of the constant push system which will create a constant "pushing" force
 * 
 * Parameter(s):
 *   0: OBJECT - Center object
 *   1: ARRAY - Area
 *   2: NUMBER - Amount
 *   3: NUMBER - Vertical amount
 *   4: NUMBER - Type
 *   5: BOOL - Set direction
 *   6: BOOL - Vector up
 *   7: NUMBER - Duration
 *   8: NUMBER - Interval
 *   9: STRING - Condition
 *   10: NUMBER - Direction
 * 
 * Returns:
 *   handle - Handle to the constant push system. Used to stop it again.
 */

Back to top

nfextra_modules_common_fnc_createTeleporter

/* ----------------------------------------------------------------------------
Function: createTeleporter.sqf

Description:
  Creates a telporter object
Parameters:
  object - the teleporter
    speed - teleportation transition speed
    sound - sound played on transition
    locationDataArray - array in following format
        name - name of the location
        text - transition text shown during teleportation
        areaOrObject - area or object which will be teleportation destination. If its an area there is some randomization.
        safe - true or false whether exact positions should be used or it should check for a safe position away from objects for placement
Returns:
  nothing

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

nfextra_modules_common_fnc_initRandomPlacement

/*
 * File: initRandomPlacement.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Internal function for random placement module
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_modules_common_fnc_moveTo

/*
 * File: moveTo.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Uses setpos to make an object "move" to a location bit by bit. Object can be anything that can be moved via setPos including modules, projectiles whatever.
 * 
 * Parameter(s):
 *   0: _obj - Object to move
 *   1: _destinationPos - Position to move to (array)
 *   2: _speed - Speed of the movement (number)
 *   3: _isSetDir - Boolean to set direction while moving (boolean)
 *   4: _interval - Time interval between each move (number)
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_modules_common_fnc_stopConstantPush

/*
 * File: stopConstantPush.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Stops a constant push system
 * 
 * Parameter(s):
 *   0: NUMBER : Handle of the constant push system as returned by constnatPush function
 * 
 * Returns:
 *   NOTHING
 */

Back to top

populator

nfextra_populator_fnc_generateTraffic

/*
 * File: generateTraffic.sqf
 * Author: Tiwaz
 * -----
 * Description:
 *   Spawns groups at different locations and has them travel to other locations. 
 *  Each location acts as spawn and possible destination, unless spawn is deactivatet on the destination within the destinations array.
 *
 * Parameter(s):
 *   0: ARRAY - GroupsDataArray as returned by getSyncedGroups
 *  1: ARRAY - Destinations
 *    0: LOGIC or ARRAY(position) - Position OR traffic route location module
 *    1: BOOL - Optional bool that indicates wether or not this destination can spawn vehicles. Default true
 *  2: NUMBER - Minimum delay between spawns
 *  3: NUMBER - Maximum delay between spawns
 *  4: SIDE - Side of the spawned vehicles
 *  5: STRING - Waypoint speed for example: "NORMAL" or "FULL"
 *  6: STRING - Waypoint behaviour of the vehicle. For example "CARELESS" or "COMBAT"
 *  7: STRING - expression string that is called on vehicle spawn
 *  8: STRING - expression string that is called as waypoint statement when vehicle reached the end. "this" returns the group leader, thisList returns the units of the group
 * 
 * Returns:
 *   NUMBER - Handle used to stop the system if required
 */

Back to top

nfextra_populator_fnc_stopGenerateTraffic

/*
 * File: stopGenerateTraffic.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Stops the traffic route system with given handle
 * 
 * Parameter(s):
 *   0: NUMBER - handle of the traffic system
 * 
 * Returns:
 *   NOTHING
 */

Back to top

respawn

nfextra_respawn_fnc_addItemBasedRespawnPosition

/*
 * File: addItemBasedRespawnPosition.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Adds a respawn position that is tied to a container (such as an ammobox). Players can only spawn on it if the box contains a respawn item.
 *  Respawning also consumes one respawn item.
 *  Works best with "MenuPosition" respawn template. (https://community.bistudio.com/wiki/Arma_3:_Respawn#Official_Templates)
 *
 *  Needs to be called on server.
 * 
 * Parameter(s):
 *   0: SIDE or NAMESPACE,SIDE,GROUP or OBJECT - receiver of the respawn position. Use missionNamespace to add the position to everyone
 *  1: Object - Object that needs to hold respawn items, also used as respawn position
 *  2: String - (Optional) respawn name, can be text or link to localization key
 * Returns:
 *   Array - format [target,id] (used in BIS_fnc_removeRespawnPosition)
 */

Back to top

vehicleService

nfextra_vehicleService_fnc_createServicePoint

/* ----------------------------------------------------------------------------
Function: fnc_createServicePoint.sqf

Description:
  Creates a service point for repairing vehicle without player input by entering an area.
  Service point only exists on the clients this function was run on.
Parameters:
  center: ARRAY format position OR object - center position of the service point area
  area: ARRAY format AREA - service area
  rearm: BOOLEAN - (optional, default true) rearm?
  repair: BOOLEAN - (optional, default true) repair?
  refuel: BOOLEAN - (optional, default true) refuel?
  ground: BOOLEAN - (optional, default true) Repair ground?
  air: BOOLEAN - (optional, default true) Repair air?
Returns:
  logic: OBJECT - the logic representing the service point
Examples:
  (begin example)
  servicePoint = [[0,0,0],[10, 10, 0, false, 5]] call nfextra_vehicleService_fnc_createServicePoint;
  (end)

Author:
  Tiwaz
---------------------------------------------------------------------------- */

Back to top

waves

nfextra_waves_fnc_getOverallGroupType

/*
 * File: getOverallGroupType.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Figures out which overall type (Ship,Air,LandVehicle,Footsoldier) the group belongs to. Only ever returns one. Some types are prioritized over others, if for example a group
 * Contains Ships and Air, it will still return Ship due to higher priority.
 * 
 * Parameter(s):
 *   0:
 * 
 * Returns:
 *   NOTHING
 */

Back to top

nfextra_waves_fnc_getSyncTree

/*
 * File: getSyncTree.sqf
 * Author: Northern Fronts Mod
 * -----
 * Description:
 *   Recursive function to get all synchronized objects in a tree.
 * 
 * Parameter(s):
 *   0: OBJECT - starting object for building the tree
 *   1: ARRAY - list of types to include in the tree, everything else is ignored
 *   2: ARRAY - root of the tree (optional), used durign recursion
 *   3: ARRAY - visited nodes (optional), used during recursion
 *
 * Example:
 * [_moduleStart,["nfextra_waves_fnc_moduleThresholdBase"]] call nfextra_waves_fnc_getSyncTree;
 * 
 * Returns:
 *   ARRAY - arrays of the synced objects structured as a tree
 */

Back to top

nfextra_functions.txt · Last modified: by tiwaz