Difference between revisions of "DCS func getResourceMap"

From DCS World Wiki - Hoggitworld.com
(Created page with "{{Template:dcs_funcs |fName= getResourceMap |vNum= 2.8.8 |par1= Airbase |par2= |par3= |par4= |desc= Returns the wsType of every object that exis...")
 
 
Line 37: Line 37:
 
|rtnType= table
 
|rtnType= table
  
|rtnExample=  
+
|rtnExample= A table indexed by string of the object name containing the wsType table associated with the object.
 +
{
 +
  ["S-60_Type59_Artillery"] = { [1] = 2, [2] = 16, [3] = 26, [4] = 259, },
 +
  ["Daimler_AC"] = { [1] = 2, [2] = 17, [3] = 26, [4] = 7, },
 +
  ["weapons.shells.KDA_35_FAPDS"] = { [1] = 0, [2] = 0, [3] = 0, [4] = 0, },
 +
  ["weapons.missiles.P_24T"] = { [1] = 4, [2] = 4, [3] = 7, [4] = 26,
 +
}
  
 
|reqType1= Class
 
|reqType1= Class

Latest revision as of 23:08, 16 August 2023

Scripting Root

Envrioment: Mission Scripting
Function: getResourceMap Added with: 2.8.8
Member Of: Airbase
Syntax: table Airbase.getResourceMap(Class self )
Description: Returns the wsType of every object that exists in DCS. A wsType is a table consisting of 4 entries indexed numerically. It can be used to broadly categorize object types. The table can be broken down as: {mainCategory, subCat1, subCat2, index}

A vague breakdown of the wsTypes:

  1 : Aircraft
     1: Airplanes
         1: Fighters
         2: Fast Bombers
         3: Interceptors
         4: Bombers
         5: Misc support
         6: Attack 
     2: Helicopters
  2 : Vehicles
  3 : Ships
  4 : Weapons


For example all 3 A-10 aircraft in game will have a wsType of {1, 1, 6, n} where n is whichever index the unit happens to be in.

There are several items that have a wsType of {0, 0, 0, 0}. Typically these include shells, static objects, and turrets.


Return Value: table
Return Example: A table indexed by string of the object name containing the wsType table associated with the object.

{

  ["S-60_Type59_Artillery"] = { [1] = 2, [2] = 16, [3] = 26, [4] = 259, }, 
  ["Daimler_AC"] = { [1] = 2, [2] = 17, [3] = 26, [4] = 7, }, 
  ["weapons.shells.KDA_35_FAPDS"] = { [1] = 0, [2] = 0, [3] = 0, [4] = 0, }, 
  ["weapons.missiles.P_24T"] = { [1] = 4, [2] = 4, [3] = 7, [4] = 26, 

}

Examples:
Related Functions: Warehouse Functions: addItem, getItemCount, setItem, removeItem, addLiquid, getLiquidAmount, setLiquidAmount, removeLiquid, getOwner, getInventory
Notes: