Jump to content

Need little help with isTargetDetected


xXMustangXx

Recommended Posts

Hello,

 

I have a AI CAP Flight "CAP1" with

ROE = weapons Hold and

Reaction to threat = Ignore reaction

ORBIT

On advance Waypoints

 

is there a way to use isTargetDetected (or another function) to push task into weapons free and allow abort mission when hard locked, and ONLY when hard locked, by an specific group?

 

Thank you!

Link to comment
Share on other sites

Like this?

 

local detected = Group.getByName('player')

if Group.getByName('Badguys'):getController():isTargetDetected(detected, 'RADAR') == true then

trigger.action.setUserFlag("1", true)

end

PC: i7-13700K - MSI RTX 4080 Gaming X Trio - 32GB DDR5 6200 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + Acer XB271HU - TrackIR5 - Rift S

Link to comment
Share on other sites

In this case the script does not work, no problem instead if it is the AI that detect you or the AI that detect another AI.

PC: i7-13700K - MSI RTX 4080 Gaming X Trio - 32GB DDR5 6200 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + Acer XB271HU - TrackIR5 - Rift S

Link to comment
Share on other sites

  • 1 year later...

Hello,

I tried arround with this function using this scipt repetitive action, so in general it works so far.

The issue with the first script is that it isn't working for group level for "air units" (source: https://wiki.hoggitworld.com/view/DCS_func_isTargetDetected)

Quote

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.

 

However, I never get the case that the distance is known

local player = Unit.getByName('Player1')
local badguy = Unit.getByName('Badguys1')
if badguy ~= nil and player ~=nil and badguy:isExist() and player:isExist() then
   local detections = Controller.Detection
   local controller = badguy:getController()
   local detected , visible , lastTime , type , distance , lastPos , lastVel = controller:isTargetDetected(player) 
   trigger.action.outText('Detections: ' 
   .. (controller:isTargetDetected(player, detections.VISUAL) and 'Visual ' or ' - ')  
   .. (controller:isTargetDetected(player, detections.OPTIC) and 'Optic ' or ' - ') 
   .. (controller:isTargetDetected(player, detections.RADAR) and 'Radar ' or ' - ') 
   .. (controller:isTargetDetected(player, detections.IRST) and 'IRST ' or ' - ')  
   .. (controller:isTargetDetected(player, detections.RWR) and 'RWR ' or ' - ')  
   .. (controller:isTargetDetected(player, detections.DLINK) and 'DLINK ' or ' - '), 1)

   if detected then
      trigger.action.outText('You have been detected somehow ' .. (distance and 'and your distance is known.' or 'but your distance is not known.') , 1 )
   else
      trigger.action.outText('You havn\'t been detected so far', 1 )
   end
end

My expactation is if the detection is done by radar the range should be known but thats not the case or is there any mistake?

Best Regards

Topper

 

detection.miz


Edited by Topper81
  • Like 1
Link to comment
Share on other sites

  • 1 month later...
On 2/22/2022 at 12:56 AM, Topper81 said:

...My expactation is if the detection is done by radar the range should be known but thats not the case or is there any mistake?...

FWIW, distance doesn't work (never returns true with radar detection) with "Controller.isTargetDetected" function (bug !?), but does work with "Controller.getDetectedTargets" function (distance become true - known - when radar detection range allows to know it).

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
On 4/11/2022 at 11:49 AM, toutenglisse said:

FWIW, distance doesn't work (never returns true with radar detection) with "Controller.isTargetDetected" function (bug !?), but does work with "Controller.getDetectedTargets" function (distance become true - known - when radar detection range allows to know it).

I tested it and it's still not working. isTargetDetected doesn't return distance.

getDetectedTargets does return distance but once it detects the target once, it will never stop detecting it until the target is destroyed.

LRAUmB3.jpg


Edited by Ignition
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...