Difference between revisions of "DCS func getFuel"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
(No difference)

Revision as of 00:12, 12 April 2018

Scripting Root

Envrioment: Mission Scripting
Function: getFuel Added with: 1.2.0
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: