Difference between revisions of "DCS func getFuel"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
 
 
Line 3: Line 3:
 
|fName= getFuel
 
|fName= getFuel
  
|vNum= 1.2.0
+
|vNum= 1.2.3
  
 
|par1= [[DCS_Class_Unit|Unit]]
 
|par1= [[DCS_Class_Unit|Unit]]
Line 53: Line 53:
 
}}
 
}}
 
[[Category:Class Functions|getFuel]]
 
[[Category:Class Functions|getFuel]]
 +
[[Category:Game Patch 1.2.3|getFuel]]

Latest revision as of 00:05, 21 March 2022

Scripting Root

Envrioment: Mission Scripting
Function: getFuel Added with: 1.2.3
Member Of: Unit
Syntax: number Unit.getFuel(Class Self )
Description: Returns a percentage of the current fuel remaining in an aircraft's inventory based on the maximum possible fuel load. Value ranges from 0.00 to 1.00. If external fuel tanks are present the value may display above 1.0. Fuel is always drained from the external tanks before moving to internal tanks.

Ground vehicles and ships will always return a value of 1.


Return Value: number
Return Example: 0.85
Examples: The following is the fuel returned for a flight of 4 F-15C. The flight lead has 0 external fuel tanks with each subsequent wingman adding a 610 Gal external fuel tank to their payload.
 local flightFuel = {}
 for i, unitObject in pairs(Group.getByName('flight'):getUnits()) do
   flightFuel[i] = Unit.getFuel(unitObject)
 end

Returns the following:

Unit 1 Fuel: 1
Unit 2 Fuel: 1.3026511669159
Unit 3 Fuel: 1.6053023338318
Unit 4 Fuel: 1.9079535007477
Related Functions: Unit Functions: isActive, getPlayerName, getID, getNumber, getCategoryEx, getObjectID, getController, getGroup, getCallsign, getLife, getLife0, getFuel, getAmmo, getSensors, hasSensors, getRadar, getDrawArgumentValue, getNearestCargos, enableEmission, getDescentCapacity

Object Functions: isExist, destroy, getCategory, getTypeName, getDesc, hasAttribute, getName, getPoint, getPosition, getVelocity, inAir

Coalition Object Functions: getCoalition, getCountry

Notes: