Jump to content

Autonomous CAP and GCI AI fighter script


SNAFU

Recommended Posts

@Silk,

Hi Silk,

Found a couple more for you,

 

Lines 2440 and 2567 numberofredCAPzones and numberofblueCAPzones.

 

You changed the capitalisation on this vars which makes them a different var but forgot to change the actual original declarations up at line 52&53 so effectively your new vars would have a nil value and cause the script to not work although it may not crash.

 

Cheers,

Stoney

 

 

PS Will likely have the revised WW2 and modern version of the script uploaded later tonight/tomorrow morning with all changes and bugfixes so far integrated. Have to give the script a quick test and then will upload. That Spawnmode/spawnmode thing was a good catch Silk! That is the benefit and downfall of these declare vars on the run languages, easy to quickly create a new var but if you aren't careful a nightmare to debug. At work here I'd have got a compile error on that one. lol.


Edited by Stonehouse
PS
Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Ok tested the WW2 one.Someone else please check and report back. I haven't had time to do more than a quick check of the modern version but went through it very carefully comparing it back to the WW2 one in winmerge so think it's ok. Again someone please test and report back. Everything seems ok for including GCI vectoring, intercepts and engagements and spawning of new flights when required. Also now have GCI flights conforming to the spawn mode.

 

New versions attached:

MIST3_4_GCI-CAP20140707.lua

GCICAPWW220140707.lua


Edited by Stonehouse
Fixed the GCI spawn issue
Link to comment
Share on other sites

New issue found when spawnmode set to parking. I'm using Mozdok for a red airbase in my test mission and discovered that it is possible to get a traffic jam on the taxi way there. I ended up with CAP flight 6 and CAP flight 8 aircraft interspersed and neither would continue to the runway. This meant no more flights could take off from this field.

 

Any thoughts on how a solution might approach this? or generally ideas on a workaround (other than not using parking)?

 

<edit> tried changing the scheduling of interceptmain for red and blue to +20 and +10 respectively which should slow the spawn rates down a bit I'm thinking and reduce the chances for multiple spawns at the same airbase happening close together. However I have also now seen the issue for GCI aircraft. I think what happened is before they could finish taxiing their airspace was cleared - if they were airborne then they would RTB but because they were not I think they got stuck. This was at Sukhumi.


Edited by Stonehouse
Link to comment
Share on other sites

Yeah it was ramp start - so engines off in the bays, runway I think puts them on the piano keys ready to roll or about to go onto the active.

 

Figured the significance of CAP6 and CAP8. It has this random algorithm to pick the next airbase to spawn at from the 3 base but tries to avoid the same as the prior one. So I figure with the logic as is, CAP6 spawned at Mozdok and then CAP 7 somewhere else but then CAP8 picked Mozdok again. Problem is that it must be zipping through things so fast that CAP6 barely was able to start it's engines and begin to taxi and the two units ended up intermingled on the taxiways and each one was giving way to the other. That's why I tried to slow the cycles of the script down a bit as a workaround.

 

The GCI problem is not as easy as they actually were holding short of the active but never got the ok to move onto it seemingly. I don't know if it is a DCS bug with ATC not recognising that the unit they held for was never arriving or a problem with the script in that the airspace cleared and GCIs were no longer needed.

 

Probably the easiest way is to figure out a clean up logic that despawns aircraft that sit still too long on the ground.

Link to comment
Share on other sites

love it....I changes only a few things to fit my needs....airfields ofcourse...task interval....but the main thing I did to make it fit almost all of the little missions I've built for private use is i added more EWR unit types.....I unlocked the A-50 then added the search radar for the Sa-10, Sa-11, and Sa-3....this works well and you dont need to use the 100 mile LOS radar towers....

 

 

the Sa-3 SR work great because it cant see 1000 miles and it cant shoot 100 miles...but if you get close it will shoot at you....and the shorter search radar make it so you can sneak into enemy territory...

 

....anyways, not ground brreaking and I know it does not help with bughunting....just figured I would show my EWRunittype line for those that wish to try it...

 

if possibleEWRunittype == "55G6 EWR" or possibleEWRunittype == "1L13 EWR" or possibleEWRunittype == "A-50" or possibleEWRunittype == "S-300PS 64H6E sr" or possibleEWRunittype == "S-300PS 40B6MD sr" or possibleEWRunittype == "SA-11 Buk SR 9S18M1" or possibleEWRunittype == "p-19 s-125 sr"

It only takes two things to fly, Airspeed and Money.

Link to comment
Share on other sites

I'm probably going to add a 4th airfield when I get a sec which will minimise the taxiway issues and I had a idea for deleting stuck units today so that might happen too. Another thing I would like to do is modularise the code - there is a lot of common code repeated throughout the script and it would be nice to put some of it at least into common functions that are called instead of slabs of near identical code as it would simplify working on the script a lot. I'd like to finish turning my test mission into a full blown one too lol.

 

Just curious Davis, it sounds like you are seeing the caps and gci flights get vectored onto intruders that are picked up by radar and engage those units same as I see. Is that correct?

 

Cheers,

Stonehouse

Link to comment
Share on other sites

yes i get intercepts.....I can retreat from enemy territory and see the intercept flights return to their CAP orbit or RTB....I get intercept spawns when CAP flights get overwhelmed or destroyed....

 

 

...small DCS bugs with the group respawn function through mist here and there when adding flights to test your script....and a landing pattern bug when to many cap or intercept flights try to land at the same airfield....but the script itself seems to work properly....

It only takes two things to fly, Airspeed and Money.

Link to comment
Share on other sites

Ok due to work being very very very slow this afternoon I sneaked in a bit of scripting, it looks like work to people in the office anyway lol. Obviously can't do it often though.

 

Anyway below is the new WW2 version, it has been tested for crashes as I emailed it home and coached my son through adding it to my test mission (lucky he's on holiday at present after all) and it has been running without serious issues for the last 3 or so hours. Doesn't mean there are no bugs just that I don't think they are major if there are any.

 

Changes are to add a 4th airfield and implement a clean up of AI aircraft that get stuck on taxiways using the airfieldwreckagecleanup function.

 

Hope it works for everyone. I will merge the changes into the modern version over the weekend so it will be out soon too.

 

Cheers,

Stonehouse

 

<edit> updated version of the modern era script also available below (note I've not had time to test this but simply gone through in win merge applying the same changes)

GCICAPWW2201407010.lua

MIST3_4_GCI-CAP20140710.lua


Edited by Stonehouse
Link to comment
Share on other sites

  • 3 weeks later...

I'm noticing now that when i added a KC-135 tanker to the show that the CAP flights will refuel instead of landing and new flights spawning....adding alot of time between non combat spawns...modern version of the script....

 

 

 

....F-18c does not go to the tanker...it lands...


Edited by Davis0079

It only takes two things to fly, Airspeed and Money.

Link to comment
Share on other sites

Still at work but I had a spare moment so got your mission down and looked at it in Notepad++ and noticed two things. First I have a minor tweak to do in the script because I accidently left the skins for the CAP aircraft set to the WW2 P51 skins but this would not cause you an issue as if it cannot find the skin for the plane in mission it simply gives it the default but it's untidy so I will fix it and upload it again tonight. I did actually test run this version of the script and flew against the CAP fighters for several hours over the weekend so I know this is not your problem.

 

The second thing which I feel may be your problem is that you have named your cap zones redcapzone1 etc but the script is looking for redCAPzone1 etc and ditto for blue. I am unable to confirm this until I get home this evening (which is about another 8 or 9 hours from now) but if you see this post and have time you might give it a go and see if the issue is resolved.

 

Cheers,

Stonehouse

Link to comment
Share on other sites

Ok the zone names were the issue and one other observation is that instead of ONCE triggers for Mist, GCICAP and any other scripts that are prerequisites for other things should go on a MISSION START trigger.

 

Your mission with renamed zones and mission start trigger attached below with the updated version of the script too.

 

Cheers,

Stonehouse

gci_cap_korea_27_07_2014.miz

Link to comment
Share on other sites

Certainly it is although by the 1950s the P51 is strictly a CAS aircraft in real life. If fact RAAF 77 Sqd was one of the few still using it in Korea.

 

But if you wanted it as an option all you need to do is alter one of the Sabre CAP slots to a P51D (have a look at the WW2 version of the script to get the values. There is a separate section for CAP and interceptors) with different fuel amount and the skin you want (you need to have the skin available in your game or otherwise you just get the default P51 skin)

 

Unfortunately that is a weak area of the script in that changing plane types requires an edit on the script. There are a few of us mucking about with this script since Snafu went on leave and it was mentioned back up the thread as something to fix if someone can come up with a viable approach.


Edited by Stonehouse
Link to comment
Share on other sites

Ok the zone names were the issue and one other observation is that instead of ONCE triggers for Mist, GCICAP and any other scripts that are prerequisites for other things should go on a MISSION START trigger.

 

Your mission with renamed zones and mission start trigger attached below with the updated version of the script too.

 

Cheers,

Stonehouse

 

*sigh*

 

just a comment from an objective third party observer.. sure would be "nice" if we (the end users) could have a functional mission editor without having to be a computer programmer

 

 

 

again... *sigh*

 

[edit - i am NOT an "objective" third party observer - i freely admit that : ) ]

i7-4790K | Asus Sabertooth Z97 MkI | 16Gb DDR3 | EVGA GTX 980 | TM Warthog | MFG Crosswind | Panasonic TC-58AX800U

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

It's the script and how it was designed that is the root cause. If we could figure out a smarter way then it wouldn't matter what the zone name capitalisation was like but it's basically doing string compares ie so "A" doesn't equal "a".


Edited by Stonehouse
Link to comment
Share on other sites

  • Recently Browsing   0 members

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