DCS func isTargetDetected

From DCS World Wiki - Hoggitworld.com

Scripting Root

Envrioment: Mission Scripting
Function: isTargetDetected Added with: 1.2.4
Member Of: Controller
Syntax: multiple Controller.isTargetDetected(Class self , Object Target , enum detectionType1, enum detectionType2, enum detectionType3 ...)
Description: Returns multiple entries that define a number of values if the target is detected by the Unit or group associated with the controller.

Values returned are:

 boolean detected, -- boolean value if the target is detected
 boolean visible, -- boolean value if target is visible by line of sight
 ModelTime lastTime, -- the last model time that the target was detected
 boolean type, -- if the type of target is known
 boolean distance, -- if distance to the target is known
 Vec3 lastPos, -- last known position of the target
 Vec3 lastVel -- last know velocity vector of the target

Function is available at the unit level for all unit types.

When used with a Group Controller the function will return expected values only with Ground and Ship groups.

Return Value: multiple
Return Example:
Examples: local detected , visible , lastTime , type , distance , lastPos , lastVel = uCon:isTargetDetected(target)
Related Functions: Controller: setTask, resetTask, pushTask, popTask, hasTask, setCommand, setOption, setOnOff, knowTarget, isTargetDetected, getDetectedTargets
Notes: Detection Types
  OPTIC   2
  RADAR   4
  IRST    8
  RWR     16
  DLINK   32