Difference between revisions of "DCS func getDrawArgumentValue"

From DCS World Wiki - Hoggitworld.com
Line 41: Line 41:
  
 
   local u = Unit.getByName('whoopwhoop')
 
   local u = Unit.getByName('whoopwhoop')
     if u:getDrawArgument(43) == 1 then
+
     if u:getDrawArgumentValue(43) == 1 then
 
       -- left gunner door open
 
       -- left gunner door open
 
     else
 
     else

Revision as of 23:22, 18 May 2021

Scripting Root

Envrioment: Mission Scripting
Function: getDrawArgumentValue Added with: 1.2.0
Member Of: Unit, Static Object
Syntax: number Unit.getDrawArgumentValue(Class Self , number arg )
Description: Returns the current value for an animation argument on the external model of the given object. Each model animation has an id tied to with different values representing different states of the model. Animation arguments can be figured out by opening the respective 3d model in the modelviewer.


For example you can determine the rotation and orientation of the barrel of a Tanks cannon by checking its animation arguments. More practically you can determine whether or not a helicopters doors are open.

If draw argument value is invalid for the unit in question a value of 0 will be returned.


Return Value: number
Return Example: -1 to +1
Examples: When checking the Huey
 local u = Unit.getByName('whoopwhoop')
   if u:getDrawArgumentValue(43) == 1 then
      -- left gunner door open
   else
      -- left gunner door closed
 end
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: