Currently if I use this basic script the fighter will climb back up to some pre-set altitude (eg station alt).
Code: Select all
local function dragdefend()
     local unit = SE_GetUnit({name='J-11D Flanker B [Su-27SK Copy]', guid='JUKBGX-0HMCITSF58TL8'})
     local block = 5000/3.208
         if unit.firedOn then
         local newalt = unit.altitude-block
         SE_SetUnit({unitname=unit.name, manualaltitude=newalt})
         print (newalt..'m')
         end
 endThe idea is for fighters to gain energy when in a defensive turn - dropping a block. I have a much longer code sample that sets all the behaviours based on crank logic (eg start high finish low) but that is based on first shot opportunity. I want to make it so a fighter that is shot conducts the standard AI defensive routine but also descends 5,000ft. Possible? The aforementioned code I turn off the Automatic Evasion function. But I quite like everything the AI does, apart from the altitude, so I'd prefer just to have the code force the altitude change.
 
					 
					