VR-Forces 5.0.3 Lua Function Documentation

aggregateUtils

(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)

AggregateUtils is a collection of tables and functions that provide useful capabilities and definitions related to aggregates.
THESE FUNCTIONS ARE ONLY USEFUL WHEN THE AGGREGATE-LEVEL SMS IS BEING USED.
To use them, the script must start with

	 require "aggregateUtils"

Function List

CombatEffectiveness.getCombatEffectivenessForAmmunition (ammoFraction) Converts an ammunition percentage to combat effectiveness level
CombatEffectiveness.getCombatEffectivenessForFuel (fuelFraction) Converts a fuel percentage to combat effectiveness level
CombatEffectiveness.getCombatEffectivenessForHealth (healthFraction) Converts a health percentage to combat effectiveness level
CombatEffectiveness.getCombatEffectivenessForLubricant (lubricantFraction) Converts a lubricant percentage to combat effectiveness level
CombatEffectiveness.getCombatEffectivenessForOil (oilFraction) Converts an oil percentage to combat effectiveness level
categoryForNumberAircraft (number) Returns a category value to be used in an Entity Type of an air aggregate such that the Entity Type will specify the given number of aircraft.
engineeringObjectEffectiveModifier (engineeringObj, baseModifier) Alters the base modifier of an engineering object based on the current effectiveness of the object due to its completion percentage.
engineeringObjectEffectiveValue (engineeringObj, baseValue) Alters the base value of an engineering object based on the current effectiveness of the object due to its completion percentage.
getPostureTableFromString (postureString) Given a comma- or space- delimited set of posture names in one long string, create a table with the posture names as keys and true as the values.
getSector (entity, location, sectors) From the given entity, returns the name of the sector in which another point lies.
numberAircraftInEntityType (entityTypeCategory) Returns the number of aircraft that is specified by the category field in an aggregate air entity type.
postureAllowsWeaponUse (weaponInfo, myPosture) Checks to see if the given weapon in the IF-Power table can be used in the current posture.
qraLevels.duration (name) Provides the time that the aircraft can stay on a given level of QRA, in seconds.
qraLevels.getName (index) Provides the name of the QRA level given the enumeration index.
qraLevels.response (name) Provides the response time in seconds, given the name of the QRA level.


Functions

CombatEffectiveness.getCombatEffectivenessForAmmunition (ammoFraction)
Converts an ammunition percentage to combat effectiveness level

Parameters:

  • ammoFraction:
CombatEffectiveness.getCombatEffectivenessForFuel (fuelFraction)
Converts a fuel percentage to combat effectiveness level

Parameters:

  • fuelFraction:
CombatEffectiveness.getCombatEffectivenessForHealth (healthFraction)
Converts a health percentage to combat effectiveness level

Parameters:

  • healthFraction:
CombatEffectiveness.getCombatEffectivenessForLubricant (lubricantFraction)
Converts a lubricant percentage to combat effectiveness level

Parameters:

  • lubricantFraction:
CombatEffectiveness.getCombatEffectivenessForOil (oilFraction)
Converts an oil percentage to combat effectiveness level

Parameters:

  • oilFraction:
categoryForNumberAircraft (number)
Returns a category value to be used in an Entity Type of an air aggregate such that the Entity Type will specify the given number of aircraft. Uses the convention that the category field has an echelon type in its 3 least significant bits, and a number of aircraft in the upper 5 bits.
Also assumes the following echelons for given numbers of aircraft:
1 - single aircraft (value 1)
2-6 - flight (value 3)
7-15 - squadron (value 4)
16+ - group (value 5)

Parameters:

  • number:
engineeringObjectEffectiveModifier (engineeringObj, baseModifier)
Alters the base modifier of an engineering object based on the current effectiveness of the object due to its completion percentage. This function should be used for modifiers, where a value of 1 means "no effect".

Parameters:

  • engineeringObj:
  • baseModifier:
engineeringObjectEffectiveValue (engineeringObj, baseValue)
Alters the base value of an engineering object based on the current effectiveness of the object due to its completion percentage. This function should be used for values, where a value of 0 means "no effect".

Parameters:

  • engineeringObj:
  • baseValue:
getPostureTableFromString (postureString)
Given a comma- or space- delimited set of posture names in one long string, create a table with the posture names as keys and true as the values.

Parameters:

  • postureString:
getSector (entity, location, sectors)
From the given entity, returns the name of the sector in which another point lies. The return sector is "Front", "Rear", or "Flank". Sectors is a table with Front and Rear keys, with the values being the size of those sectors.

Parameters:

  • entity:
  • location:
  • sectors:
numberAircraftInEntityType (entityTypeCategory)
Returns the number of aircraft that is specified by the category field in an aggregate air entity type. Uses the convention that the category field has an echelon type in its 3 least significant bits, and a number of aircraft in the upper 5 bits.

Parameters:

  • entityTypeCategory:
postureAllowsWeaponUse (weaponInfo, myPosture)
Checks to see if the given weapon in the IF-Power table can be used in the current posture. The first argument is the IF-Power table entry for the weapon.

Parameters:

  • weaponInfo:
  • myPosture:
qraLevels.duration (name)
Provides the time that the aircraft can stay on a given level of QRA, in seconds. Input is the name of the QRA level. If the name is not valid, -1 will be returned.

Parameters:

  • name:
qraLevels.getName (index)
Provides the name of the QRA level given the enumeration index.

Parameters:

  • index:
qraLevels.response (name)
Provides the response time in seconds, given the name of the QRA level. If the name is not valid, -1 will be returned.

Parameters:

  • name:

Copyright© 2023 MAK Technologies, Inc. All rights reserved.