Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Getting fighters to descend when targeted/defensive

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Getting fighters to descend when targeted/defensive Page: [1]
Login
Message << Older Topic   Newer Topic >>
Getting fighters to descend when targeted/defensive - 10/21/2021 11:32:28 AM   
Struan76


Posts: 36
Joined: 9/3/2019
Status: offline
This might have already been addressed - how to do I get fighters to descend 5kft and hold manual altitude when targeted (eg engaged defensive).

Currently if I use this basic script the fighter will climb back up to some pre-set altitude (eg station alt).

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
end


The 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.
Post #: 1
RE: Getting fighters to descend when targeted/defensive - 10/21/2021 11:50:14 AM   
Struan76


Posts: 36
Joined: 9/3/2019
Status: offline
Would also like to ensure this only iterates once per shot, can't figure out how to make that work in Event Editor (current event trigger using 'Unit Remains in Area', which means the targeted fighter keeps trying to descend as long as there are missiles in flight).


(in reply to Struan76)
Post #: 2
RE: Getting fighters to descend when targeted/defensive - 11/2/2021 11:05:34 PM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
quote:

Possible?

---
Should be.

quote:

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.

---
That may be where the boggle is, kinda can't let the ai take control _and_ still override alt (least most the time as I recall), you either let it engage and do it's thing, or do everything yourself has been my experience - ie with engaged offensive or defensive they take on a mind of their own most of the time based on the profiles involved.

(in reply to Struan76)
Post #: 3
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Getting fighters to descend when targeted/defensive Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.563