Jump to content

Autonomous CAP and GCI AI fighter script


SNAFU

Recommended Posts

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Yes I have definitely seen (and felt) that happen during testing my ww2 version of the script.

 

I revisited this script this morning and found I'd forgotten most of it but it bought up a question for Silk. I realised on looking and trying to add your change that I'd done something for this too on my last attempt (you can see it if you look for var CAPspawnalt in the ww2 version of the script a couple of posts up) but never tested it enough to know whether it truly had fixed the runway use and I was more interested in the height first Cap flights spawned at - which always spawn at the front lines - and the runway side was more a hoped for beneficial side effect. My version took land height into account due to mentions of airborne spawns hitting terrain on spawn.

 

Anyway I guess I'm just curious to see if your solution came about because mine didn't work and to say regardless to pinch the idea of land height checks and add it to yours.

 

Please don't get me wrong I've got no ego involved in this and feel it's all about collaborative effort by people to get the best result for the community and it doesn't bother me if you took my version and corrected or improved it. I just felt bad if mine was fine and you'd spent hours on your version because you didn't realise I'd worked on it.

 

Cheers,

Stoney


Edited by Stonehouse
question about script
Link to comment
Share on other sites

no worries, I didn't base my changes off yours cause i came across the official one first, i didn't find this thread until i actually started to use the 3rd party scripts in my mission. Tested my changes and they do take off great and work fine, although BARO would be better waypoint then RADIO for sure. and while i am very novice at scripting to add this fix was extremley easy to see and find it took me only a few minutes to realize how to fix it and required no testing before implementing the change. When i make further edits (which i'm sure i will) i will definetly share my changes with this thread... ultimatley i would like to have SNAFU implement all changes and fixes we come up with to the script for future users.

 

as for anything i script myself I always leave it open to modification as well provided credit is given to original author (much like this script) unfortunately until I get a few more issues solved I can't release my latest version of my missionfile... its been weeks since i updated Operation Perched Eagle (v2.16) and I'm testing a lot before pushing out and publishing (v2.50)

 

I learned my lesson releasing something too soon (with good intentions of wanting to share my work) but i fear now that so many ppl ran broken versions of OPE that they maybe reluctant to try out the latest (even tho it should be the most polished and working of all the versions)

 

anyways I will keep plugging away at these scripts sometime tmrw


Edited by =LFC=Chameleon_Silk
Link to comment
Share on other sites

Some new versions incorporating Rivvern's, Silk's and my own changes. Acknowledgments given in the start of the script, hope you are both ok with me adding your corrections to the files below.

 

Basic change log:

b6_1x -fixed runway usage

-spawns and waypoints now consider terrain height

-bort numbers on aircraft

-logic around airbase selection corrected

-numberofspawnedandactiveinterceptorgroups initialisation

-parameterise hiding of enemy aircraft

-attempt to improve scope of some variables

-added table of correct airfield names that are available to use above

-changed back using BARO

 

My issue regarding the enemy cap not spawning was completely resolved by using the correct airbase name. Thanks to Ajax, ENO and David0079 in this thread http://forums.eagle.ru/showthread.php?t=108476&page=11

 

Both the modern and WW2 version attached below. Please note the WW2 version is currently Germany and UK so if you want to have US aircraft you will need to change each instance of UK to be USA and change the skins for blue aircraft. The version attached below uses 457 squadron and some RNZAF skins.

 

Please test and post back feedback. Hopefully I've not missed or stuffed up any of the changes that have been added.

 

Thanks,

Stonehouse

GCICAPWW220140702.lua

MIST3_4_GCI-CAP20140702.lua

  • Like 1
Link to comment
Share on other sites

awesome thanks Stonehouse, I will test out next couple of days hopefully when I have some free time

 

will also post the version I'm using that uses F-4's and MiG-23MLDs with mainly IR missiles that operate under 4.5k meters for those who want a ground attack aircraft mission where the ground attack aren't just blown away by AMRAAMS and R-24ETs.

 

Will also try and seperate the country selection and plane selection to be settable at the very top of the script as well as altitude height for CAP -- i think these fixes would allow for more flexibility when other people want to change the script to suit their needs.

 

Out of curiosity though have you noticed the CAP engage player planes?

Link to comment
Share on other sites

I definitely did earlier in my testing in prior months however beyond testing the spawning side of things I have not had time to test much further with the above versions. In my earlier tests they were quite aggressive once you crossed the border and would follow you back home if they had fuel to do so.

Link to comment
Share on other sites

Keep in mind my version is using 60's aircraft but it has more fixes then WW2 version until Stonehouse updates his (if and when he decides to implement my fixes and added features into his)

 

remember that MIST 3.4 must be loaded before hand for this script to work.

 

Modifications for b6_2x by Chameleon_Silk, look for --YY tags

 

- added interceptor and CAP country parameter

- added min and maximum CAP and intercept altitude parameter

- fixed numberofCAPzones and Spawnmode and interceptorgroup capital problem (now matches style already used and avoids problems that maybe occuring)

- changed to MiG-23MLD and F-4E with mainly IR missiles

- added param to change behaviour of first wave of fighters at mission start, will take off from airbase or start airborne in zone.

 

 

PROBLEMS

- CAP flights seem to not be engaging anything

FIXED - In my version there appears to be some pylon problems

- GCI, didn't see any fighters take off after border incursion

 

posted just so that we can keep new fixes and revisions comming.

 

New parameters below

 

cap_max_altitude = 4300                            --YY added this stuff to easily control CAP altitudes and country selection
cap_min_altitude = 3400                            -- keep in mind that the country selected and plane type must make sense or else you may break the script like having an american mig-23.. probably will not work.
redinterceptorcountry = country.id.RUSSIA            -- select countries for interceptor planes as of right now only 1 country per side can be used but could be expanded upon by a scripter
blueinterceptorcountry = country.id.USA
bluecapcountry = country.id.USA                        -- select countries for CAP planes as of right now only 1 country per side can be used but could be expanded upon by a scripter
redcapcountry = country.id.RUSSIA
startairborne = 0                                    -- 1 for flight to start airborne at script init, 0 for taking off from airfield at start

EDITED: Reuploaded script to fix my pylon problems

Mistv3_4.lua

SNAFU_SIXTIES_GCI_CAP_Vb6_2X.lua


Edited by =LFC=Chameleon_Silk
Link to comment
Share on other sites

Cool, I will have a look at this over the weekend if I can get some time.

 

I must admit that my very first thought when you said "parameterise aircraft" was that pylon configuration will be a headache.

 

From what I've understood so far the engagement is set via the reset task function which changes the ROE somewhere in it's guts. Perhaps try lowering the time interval between instances of the function being run?

 

 

Cheers,

Stonehouse

 

PS I guess just a general thought is that at some point down the track it would be probably be a good idea to merge all the different fixes and work on one version so the community doesn't have to muck about switching things about. The only real difference between the WW2 version and the other one I put up for instance is the aircraft and countries. So if your parameterisation gets all bugs ironed out Silk it's just one version for all periods.


Edited by Stonehouse
PS
Link to comment
Share on other sites

yea well i was thinking of adding your pylons and aircraft into mine and just having a parameter for WW2 mode or 60s aircraft this however will make the script grow a lot and make it a bit harder to follow... should be pretty easy to add your WW2 stuff into mine this way although probably could be done more elegantly then I will end up having it.

 

I will try and get this done before you take a look at it this weekend because it would be much easier if both our versions were combined for future fixes and its a pain to have to take stuff from one into the other, I want very much this script to be fully functional.

 

EDIT: just realized why my pylons are wrong the Migs are rocking sparrows and the F-4s have R-60Ms *WHOOPS*


Edited by =LFC=Chameleon_Silk
Link to comment
Share on other sites

You should merge your scripts so its possible to choose which aircraft era you want in the mission:

 

local AircraftEra = "60s" --"60s", "WWII", "Modern" "Civilian" for example

 

Not sure how it would be scriptwise but this would be better than having lots of different scripts around.

[sIGPIC][/sIGPIC]

 

We are looking for Swedish members!

http://www.masterarms.se

Link to comment
Share on other sites

BUG:

- CAP flights seem to not be engaging anything

 

This is a big flaw. You can march right into enemy territory and the CAPs dont give a damn. Would be great if this could be fixed. Ive tried to find the "engage" mechanism in the script but lack the knowledge to understand it.

[sIGPIC][/sIGPIC]

 

We are looking for Swedish members!

http://www.masterarms.se

Link to comment
Share on other sites

hmm ok very strange. Sample track attached of a c130 which time warped back to WW2 and unknowingly flew across a border to a bad end.

 

You can see the flight of Dora's swing into pursuit. The only weird thing is that in the end a single flight member engages while the others shoot off to parts elsewhere. There are likely bugs still present as I'd expect the whole flight to engage but something seems to vector them onto the target. Perhaps try the modern version of the script I uploaded and see if that has the caps engage. If it does then start to look for differences between my version and the version that doesn't work?

testcapintercept.trk

Link to comment
Share on other sites

still working on fixing the CAP flights, the theory is if the interceptors are engaging that perhaps having it engage targets in zone and using a zone radius will work.

 

I can see the spot where the CAP is getting its engage orders (in waypoint 1) but not sure why they are not actually engaging might have to insert a new set of triggerzones (or 1) that signfies where they are authorized to attack and the CAP zones now simply where they will patrol when not engaged.... these are just thoughts on the matter.

 

I will make merging the script priority once i get them to engage, my GCI did take off last test so thats a good sign.

 

added new parameter to set cap and interceptor minimum and maximum speeds.

Link to comment
Share on other sites

You should merge your scripts so its possible to choose which aircraft era you want in the mission:

 

local AircraftEra = "60s" --"60s", "WWII", "Modern" "Civilian" for example

 

Not sure how it would be scriptwise but this would be better than having lots of different scripts around.

 

The problem is that each config of pylons and stores has it's own CLSID which is a long presumably unique number that acts as a key to lookup an internal DCS aircraft stores tables so you almost need to think of doing it a different way. I wonder if it is possible to add an AI aircraft of a known unit id to the mission which is on late activation with no trigger (ie never spawns) and the script gets the pylon config from that unit?

 

 

eg aircraft called blueconfig1 for it's unit name and the script goes looking for blueconfig1 and retrieves it's loadout and skin and type and role (eg CAP) and then uses that as a template for spawning aircraft.

 

You might be able to then have different configs and roles and perhaps sometime down the track the script could spawn cas missions when enemy vehicles are detected crossing the borders?

 

 

 

@Silk,

I was looking through your changes in the 60's version but have some questions on a few things:

 

 


  • numberofredCAPzones v's numberredcapzones

numberofredcapzones is a variable defined at the start of the script and assigned a value there. By changing it to numberofredCAPzones @line 2440 and other places it becomes a different variable and I'm unable to find where you set the value. So unless I'm just blind through being overtired and just can't see where you set it this would mean it is probably set a nil value - I could be wrong but if not I think this would break the script. Without checking I assume you did the same for blue.

 

 


  • starting the first lot of aircraft airborne

From what I've seen the first set of cap aircraft already start airborne and there is specific logic there for that so I'm puzzled - does this not work for you or is it that you are after starting the first set of GCI launched interceptors airborne but want subsequent waves to launch as per the RNW variables?


Edited by Stonehouse
Link to comment
Share on other sites

BUG:

- CAP flights seem to not be engaging anything

 

This is a big flaw. You can march right into enemy territory and the CAPs dont give a damn. Would be great if this could be fixed. Ive tried to find the "engage" mechanism in the script but lack the knowledge to understand it.

 

It seems different/extra parameters were added to the unit/route/point/task sub-tables going from 1.2.6 to 1.2.7 (I think--at least this is when I noticed the differences). It might be a good idea to create a test mission with a CAP group that performs like you want then looking at the mission file. (This is what I have to do, I certainly don't know enough to create the proper table structure from scratch.)

 

I compared my ScrambleCAP script (which seems to work pretty well) to the relevant portions of the GCI-CAP script and noticed some (possibly) significant differences. Perhaps these parts of script should be revisited? I don't fully understand what each of these parameters mean, so I'm not sure if the differences are important or not.

 

--GCI-CAP_b6
CAPPatrolpointstable[i]["task"]["params"]["tasks"][1] = 
   {
       ["number"] = 1,
       ["auto"] = [color=Red]false[/color],
       ["id"] = "[color=Red]WrappedAction[/color]",
       ["enabled"] = true,
       ["params"] = 
       {
           ["action"] = 
           {
               ["id"] = "Option",
               ["params"] = 
               {
                   ["value"] = 3,
                   ["name"] = 0,
               }, -- end of ["params"]
           }, -- end of ["action"]
       }, -- end of ["params"]
   }, -- end of [1]

--ScrambleCAP
group["route"]["points"][1]["task"]["params"]["tasks"][1] = 
   {
       ["enabled"] = true,
       ["auto"] = [color=Red]true[/color],
       ["id"] = "[color=Red]EngageTargets[/color]",
       ["number"] = 1,
       ["key"] = "CAP",
       ["params"] =
       {
[color=Red]            ["targetTypes"] =
           {
               [1] = "Air",
           }, -- end of ["targetTypes"]
[/color]            ["priority"] = 0,
       }, -- end of ["params"]
   }, -- end of [1]

Link to comment
Share on other sites

yup ajax i think your on the right track and thats exactly what im trying to do is use a dissected mission file with a known CAP mission that works and bringing it over to the script just havent had much time to work on it.

 

  • numberofredCAPzones v's numberredcapzones

 

  • starting the first lot of aircraft airborne

caught an error i didn't adjust the variable to add the fixed CAPS, throughout the script i've been correcting variables that were not capitalized to match the ones they were supposed to be i.e - numberofredCAPzones was numberofredcapzones, I believe this was unintentional and from my understanding of LUA would mean that a nil value would occur and break the script from just a capital typo... so i've fixed numberofredCAPzones at top of script to match the correct variable, thanks for spotting it.

 

You can now choose if the first aircraft when mission begins are airborne in the designated cap areas or if they start at airfield about to take off when mission begins, looks cool too since you will see the flights go up if your stationed at the same airbase... this should not effect GCI interceptions or any other CAP flights, I just expanded on the script there to check the parameter and adjust the location of the spawn and RNW as appropriate, before it would just check if it was the first flight and automatically warp and place them in the CAP area but I wanted them to start at the base. Instead of removing already orking code to make first spawn at base and not airborne i decided would be best to add the option to choose as a feature.

 

I've also seperated speed for CAP and GCI flights so its now possible to set a fast interception and a slow cap for instance.

 

I'm fully confident we will have this script working great at some point (it already looks damn good just need em to engage tongue.gif)


Edited by =LFC=Chameleon_Silk
Link to comment
Share on other sites

@Silk,

Hi Silk, started merging your changes into my prior versions and fyi noticed you had a bug at 2616 where for the CAP starting in the air you've given the CAP spawn alt as land height. ie they will crash

 

You declare vars cap_max_altitude and cap_min_altitude but then use cap_max_alt and cap_min_alt (which have a value of zero so the caps crash) - I've changed all the references to cap_max_alt and cap_min_alt

 

 

Also just a general question, I'm not sure I understand the reason behind your changes in capitalisation of variable names as it seems just for asthetics? Which is fine and I have no issues with that but just in case, capitalisation as far as I know does not change the scope of the var or how it works and sometimes I get the impression that's how you are thinking - which could be an entirely wrong impression and one of the problems of communicating via forum posts as you miss a lot of the cues you normally get when you talk to someone over a phone or face to face. So sorry if I've misunderstood.

 

@Ajax,

Thanks for the CAP engagement related comments. While I don't see problems on my end with caps engaging - which could be happenstance - I will add your changes and see what happens.

 

Cheers,

Stonehouse


Edited by Stonehouse
Link to comment
Share on other sites

Yeah, just been play testing again. I sent about 15 C130s over the border and ended up with 12 shot down and about 50 FW190s in play between caps and gcis. They then followed a crippled C130 over the border and a huge furball erupted just west of Beslan.

 

So I wonder if the people who don't see engagements happening are see any sign that caps are being vectored to their targets?

 

If you don't then perhaps the problem is not the script but that your borders or radars etc are not set up properly? Because if there is a problem there then the intruders are not picked up and no caps will intercept them

 

Pics of what happens for me below

Screen_140706_140746.thumb.jpg.5d0b2c25f856106fbfc04e702dead160.jpg

Screen_140706_140701.thumb.jpg.030e4abe81e239e13ec44a9c577b3610.jpg

Link to comment
Share on other sites

you should always have variables maintain the same capitalization as it creates confusion if you change it from one spot to the other in many cases LUA is cap sensitive (but maybe only with keywords and some other things) but still bad habit to change it mid script or to follow one template and then to change it later (almost as if more then one person wrote that portion of the script)

 

thanks for the fix on my altitude thing, a lot of the reason I am missing this stuff is because i haven't had much time to work or test it, i just kinda edit it and then run it once.

Link to comment
Share on other sites

1.Must the redAF name be airfield name? Can I set it to any string, but make it identical to the trigger zone name in ME?

 

2.Does it mean that although the redAF name is e.g. 'Beslan', but I can put the zone above Sochi right?

[sIGPIC][/sIGPIC]

My DCS Mods, Skins, Utilities and Scripts

 

| Windows 10 | i7-4790K | GTX 980Ti Hybrid | 32GB RAM | 3TB SSD |

| TM Warthog Stick | CH Pro Throttle + Pro Pedal | TIR5 Pro | TM MFD Cougar | Gun Camera: PrtScn |

Link to comment
Share on other sites

Yes in the first case and no in the second is what I believe. It will actually use your airfield name to get attributes and set spawn points. That's why it is important to get that name matching the DCS airfield name or else various things won't work.

 

Likewise it uses the co-ords of the zone to perform various functions and expects the zone over the correct airfield is my understanding.

 

Cap zones can be away from the airfields though


Edited by Stonehouse
lol sorry misread uboats post
Link to comment
Share on other sites

Ok so it is from a standards/asthetics viewpoint, no problem.

 

lol yes I guess it does look like a few people worked on it now.

 

 

you should always have variables maintain the same capitalization as it creates confusion if you change it from one spot to the other in many cases LUA is cap sensitive (but maybe only with keywords and some other things) but still bad habit to change it mid script or to follow one template and then to change it later (almost as if more then one person wrote that portion of the script)

 

thanks for the fix on my altitude thing, a lot of the reason I am missing this stuff is because i haven't had much time to work or test it, i just kinda edit it and then run it once.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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