Create a set of RPs based on a contact

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
vettim89
Posts: 3745
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

Create a set of RPs based on a contact

Post by vettim89 »

SO this is a bit weird but I was working on a scenario where I want a recon aircraft to go snoop a potential contact when it pops up based on ESM data, but I don;t want it to get close enough to be engaged.

To be specific: Tu-95 Bear D is out over the North Atlantic and it picks up radar emissions consistent with an E-2. I want the Bear to move a little closer but not close enough that it gets jumped by fighters.

So we have Tool_Range and it seems that I could use that to get an point where I want the Bear's patrol zone to be but the question is ho do I create the RPs to be fed into the mission?

Hope I was clear enough on what I am trying to do
"We have met the enemy and they are ours" - Commodore O.H. Perry
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Create a set of RPs based on a contact

Post by KnightHawk75 »

Do you mean all the steps or are you just asking literally just which function do you use to generate the reference point to add into the patrol or support mission?

The latter is ScenEdit_AddReferencePoint(...), then you update the reference points for the patrol mission involved with ScenEdit_SetMission(...), the patrolmission or supportmission options which has a sub-table of RP names in the patrolzone and prosecutionZone properties. Keep in mind you'll need 1146.1 or higher that corrects a bug if you're trying to update the patrolzone and prosecutionZone simultaneously in a single call, otherwise you'll need to make two calls one to update the patrolzone, and a separate call to update only prosecutionZone. In figuring out where said location points should be you want to look at World_GetPointFromBearing(table) - 'table' isn't documented in terms of all it's parameters but I've provided the parameters below in some additional comments.

If the former (detailed steps), there are probably 1/2 dozen different approaches you can take for this depending on how much effort you want to put into it, what you're goal is, and how much intelligence you want embed.

-
I'll throw out some unasked for thoughts, they assume however you want\need at some point to revert back to the original mission state at some point, and that this just involves trying to either better classify the contact and\or are trying to pickup a particular new contact (the e-2's carrier?) based on moving closer to the first contact.

Instead of creating new rp's you can probably just adjust the existing one's locations to extend toward the contact, you'll have to figure out which one(s) are best to adjust first though, probably by just measuring all associated with the mission and finding the one or two closest to the contact. In doing that though you'll need to remember where the original positions where so you can restore them later after you've made better detection\classification of whatever it is you want the bear-D to accomplish with moving closer, so store that\those locations in a key (to preserve across play sessions if needed).

Another approach is to create a temporary new mission to go get closer to the target and then once a certain classification\detection level is made on said target to a certain level flip them back to the old mission and remove the new one - keep in mind though if you have multiple available aircraft for that mission once you assign the bearD to the new one the game may launch it's replacement for the old one - so either you have to manage or otherwise plan around it. All depends on what you're going for or works best for your particular situation. Though creating a new mission might be easier than trying to create new rp's and figuring out in what order the existing + new rp's need to be in for the zone to stay valid. I've never tried to figure out correct order via lua and geometry, probably can be done, but off hand it seems like a challenge.

A third method that comes to mind is not even play around with the mission or RP's and just directing the unit out of it's patrol\support area temporarily via manual course waypoint to close closer to the specific contact. So if contact is say detected something like < 500nm out but > 100nm out, and say at bearing 265'ish, just get a point say 1/3rd (or whatever) the distance at that bearing via World_GetPointFromBearing({LATITUDE=BearDUnit.latitude,LONGITUDE=BearDUnit.longitude,BEARING=TheBearing,DISTANCE=(TheDistance *.33)}) and set a waypoint toward that location. Optionally then activate\create another event or script that's checking say every 5 seconds for the detection of whatever it is you want (be it further classification on the e-2 or detection of particulate new contacts like a carrier). When said detection matches whatever it is you want, remove the waypoint\course on the Bear D and it should automatically turn around and go back into it's patrol zone a few seconds later. Then delete or disable the associated detection tracking (be it an event or your own custom script working off a contactguid or be it looking for a specific contact\ship etc).

As for avoiding it being engaged, there are probably a half dozen approaches there as well depending on how complex you want to get, but I'm assuming you just meant you want to keep it a generic xxx nm away from the contact, which you can control to fair degree with the waypoint or patrol\support mission zone locations.

Err I already got way more verbose than intended, so I'll stop there.
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Create a set of RPs based on a contact

Post by KnightHawk75 »

Attaching a sample Test_ChangeWaypointAndRPOnDetection.scen (requires CMO b1142.2 or higher), that shows both the adjust existing RP method, and the send unit off on course toward contact. Including one of many ways you can turn said unit around, and reset RP changed back to original once a particular thing is detected - in this case a surface ship in a particular area at the classification level of type.

Should give you an idea of how to extend\change it for your own purposes.
Attachments
Test_Chang..etection.zip
(48.34 KiB) Downloaded 25 times
User avatar
vettim89
Posts: 3745
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

RE: Create a set of RPs based on a contact

Post by vettim89 »

I think you got the basic idea. This question is based on the Dance of the Vampires thread on the front page.

So imagine a scenario where the Soviets are trying to attack a NATO CVBG. They will send their Bear Ds down ahead of the strike to try and get a approximate fix on the NATO TF. Now if the human player is the Soviets he/she will likely try to be sneaky slowly creeping the Bears into the area the enemy TF is in and as the Tu-22 and Tu-16 formations approach pop the Bears up to get a fix then run away.

If the human player is NATO he/she will likely chose to either go EMCON silent or put up E-2s in active mode at some distance from the TF. There are advantages and disadvantages to both.

So the challenge to me as the scenario designer for a NATO human player is to have the Soviet AI controlled Bears be as wily and cagey as a human player would be. If a NATO AI player decides to go active with his E-2s then a Soviet human player would likely send his Bears over in that direction while trying to avoid detection until the strike aircraft are in position. I am thinking of ways where the Human NATO player will have to counter a more intelligent AI controlled set of Bear Ds.

I hope this makes sense

"We have met the enemy and they are ours" - Commodore O.H. Perry
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Create a set of RPs based on a contact

Post by KnightHawk75 »

ORIGINAL: vettim89

I think you got the basic idea. This question is based on the Dance of the Vampires thread on the front page.

So imagine a scenario where the Soviets are trying to attack a NATO CVBG. They will send their Bear Ds down ahead of the strike to try and get a approximate fix on the NATO TF. Now if the human player is the Soviets he/she will likely try to be sneaky slowly creeping the Bears into the area the enemy TF is in and as the Tu-22 and Tu-16 formations approach pop the Bears up to get a fix then run away.

If the human player is NATO he/she will likely chose to either go EMCON silent or put up E-2s in active mode at some distance from the TF. There are advantages and disadvantages to both.

So the challenge to me as the scenario designer for a NATO human player is to have the Soviet AI controlled Bears be as wily and cagey as a human player would be. If a NATO AI player decides to go active with his E-2s then a Soviet human player would likely send his Bears over in that direction while trying to avoid detection until the strike aircraft are in position. I am thinking of ways where the Human NATO player will have to counter a more intelligent AI controlled set of Bear Ds.

I hope this makes sense

It does make sense and where I figured you were going in the general sense. Will be challenging making the Bear smart enough to avoid getting wrecked by a human NATO player if the e-2 is active with any sort of cap nearby who bothers to investigates contacts though if the ROE is shoot on sight. Then again in the sample I used modern gear on the blue side, maybe they're is a better shot with mid to late 80's era gear on blue side instead of 2010's. Maybe a decently timed distraction, or equipment malfunction for NATO adds to making it possible.
stww2
Posts: 281
Joined: Tue May 23, 2017 4:58 am

RE: Create a set of RPs based on a contact

Post by stww2 »

This discussion is actually really interesting. While it is obvious to any human that carrier-based AEW radiating=nearby CVBG, as a player I have always assumed that the AI was too dim to make this connection. So when I deploy E-2s, I rarely care about their position relative to the carrier, since I don't think there is any possibility that the E-2's presence would provide a clue to the AI as to where the carrier is.

Might have to rethink some of my tactics if scenario designers start making the AI this crafty.
Post Reply

Return to “Lua Legion”