you need a piece of script for this, e.g.:
local function checkDistance(unit1, unit2, radius)
local p1 = unit1:getPoint()
local p2 = unit2:getPoint()
return (p1.x-p2.x)*(p1.x-p2.x) + (p1.z-p2.z)*(p1.z-p2.z) + (p1.y-p2.y)*(p1.y-p2.y) < radius*radius
end
world.addEventHandler({
onEvent = function(self, event)
if event.id == world.event.S_EVENT_SHOOTING_START then
local red1 = Unit.getByName("red1-1")
if red1 and checkDistance(event.initiator, red1, 1000) then
trigger.action.setUserFlag("shot_near_red1", 1)
end
end
end
})
this will react on shooting near "red1-1" unit and set a flag back to the ME you can work with (set ROE, switch waypoint, ..)
attached a demo mission, where red1 is doing orbit, and flees back home once blue shoots nearby
snippets-react-on-shot.miz