xXMustangXx Posted March 18, 2020 Posted March 18, 2020 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!
Majinbot Posted March 18, 2020 Posted March 18, 2020 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 - Gigabyte RTX 5080 GAMING OC - 64GB DDR5 6400 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + LG OLED 32GS95UE - TrackIR5 - Quest 3
xXMustangXx Posted March 18, 2020 Author Posted March 18, 2020 I tried it but nothing happened. Basically what Im trying to do is: when the player hard locks the AI plane it sets up a flag which in therm will trigger some other stuff... ( in this case just send a message to all) Here is how i used your script, any help will be appreciated ThanksMSTNG - Test - Hard lock detection.miz
Majinbot Posted March 19, 2020 Posted March 19, 2020 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 - Gigabyte RTX 5080 GAMING OC - 64GB DDR5 6400 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + LG OLED 32GS95UE - TrackIR5 - Quest 3
xXMustangXx Posted March 19, 2020 Author Posted March 19, 2020 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. Noted Thanks anyway, was worth the shot!
Topper81 Posted February 21, 2022 Posted February 21, 2022 (edited) 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 February 22, 2022 by Topper81 1
toutenglisse Posted April 11, 2022 Posted April 11, 2022 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). 1
Ignition Posted December 29, 2023 Posted December 29, 2023 (edited) 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. Edited December 29, 2023 by Ignition
Recommended Posts