Jump to content

Better control of wingman tasking


Subferro

Recommended Posts

I’m trying to wrap my head around tasking for AI wingmen and keep not finding the right solution, so I wanted to see if anyone else had ways to make this work.

 

I have a mission that dynamically spawns ground targets to engage (Using Moose, so the specific group does not exist in the mission editor) and I want to be able to command the AI to attack it after it spawns. I’ve tried (I think) all combinations “Attack my target” just gets ignored regardless of where my sensors are, attack ground units sends him on a wild goose chase for some Air Defence unit no where near our current location. I tried scripting in a “attackGroup” task to assign the spawned target to my group and that didn’t help. I issued a “Attack Primary and Rejoin”, and all he does is break off to follow our waypoint route. The targets spawn at random points along our route, so he ends up flying all over Georgia and never actually goes after the target.

 

Is there some way to script a better method of assigning targets to my own wingmen? Or maybe a better way to set up waypoints and tasks in the editor so that this gets pushed above everything else when I give the command?

 

I should mention this is with the Harrier. Using the A10 I can assign my SPI or assign to attack armor, which get better results.

Link to comment
Share on other sites

There is. I'm using Moose spawned unit and let the player command an AI plane (Moose spawned) to attack a group (also Moose spawned), or a specific unit in the group with a weapon of the players choice. I'm sure you could use the same method to give the same order to your wingman.

Link to comment
Share on other sites

Yes, sure. It'll take a while for me to isolate just those functions from the script though.

 

If you want to see how they play out try the mission Operation Titan Angel in user files and fiddle around with it.

 

If you don't have the A-10C just open the mission in the editor and just replace any of the Hawg flights with an aircraft you own.

Link to comment
Share on other sites

Yes! That worked perfectly. Well, almost. He attacked the intended target, but would only make one pass despite having additional weapons onboard. Even trying to reissue the attack task didn’t work. There was also a weird moment where after his pass he claimed he was RTB, but as soon as his missile hit he rejoined. I’ll chalk that up to General AI weirdness.

 

The only one pass thing may be because the AI harrier doesn’t like a mixed loadout. I tried in a different test mission with an AI hornet loaded up with all LMAV and he did fine.


Edited by Subferro
Link to comment
Share on other sites

Well in a simple mission with a pre-existing group he does fine even with a mixed loadout, but in the mission I’m making with a dynamic spawned group it only makes one pass. I can sometimes get him to reattack by triggering the script again, but’s it hit or miss... I really can’t figue out why it works in one mission and not the other

Link to comment
Share on other sites

So, this is how I have it set up in Operation Titan Angel. I'll try to make sense.

 

RedTargetGroup is the enemy group object.

ReaperGroup is a friendly MQ-9 group object.

 

ReaperEngageSpecificSubMenu = MENU_COALITION:New( coalition.side.BLUE, "Engage specific target", ReaperEngageSubMenu )

 

if (RedTargetGroup:GetUnit(1) ~= nil) then

 

local Unit1 = RedTargetGroup:GetUnit(1)

local Unit1Type = Unit1:GetTypeName()

ReaperEngageUnit1SubMenu = MENU_COALITION:New( coalition.side.BLUE, "Target 1: " .. Unit1Type, ReaperEngageSpecificSubMenu )

if ReaperAGM114 < 4 then

ReaperEngageUnit1MenuItemAGM = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Engage " .. Unit1Type .. " with AGM-114", ReaperEngageUnit1SubMenu, ReaperEngageUnit1AGM )

end

if ReaperGBU12 < 2 then

ReaperEngageUnit1MenuItemGBU = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Engage " .. Unit1Type .. " with GBU-12", ReaperEngageUnit1SubMenu, ReaperEngageUnit1GBU )

end

end

 

if (RedTargetGroup:GetUnit(2) ~= nil) then

 

local Unit2 = RedTargetGroup:GetUnit(2)

local Unit2Type = Unit2:GetTypeName()

ReaperEngageUnit2SubMenu = MENU_COALITION:New( coalition.side.BLUE, "Target 2: " .. Unit2Type, ReaperEngageSpecificSubMenu )

if ReaperAGM114 < 4 then

ReaperEngageUnit2MenuItemAGM = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Engage " .. Unit2Type .. " with AGM-114", ReaperEngageUnit2SubMenu, ReaperEngageUnit2AGM )

end

if ReaperGBU12 < 2 then

ReaperEngageUnit2MenuItemGBU = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Engage " .. Unit2Type .. " with GBU-12", ReaperEngageUnit2SubMenu, ReaperEngageUnit2GBU )

end

end

 

if (RedTargetGroup:GetUnit(3) ~= nil) then

 

local Unit3 = RedTargetGroup:GetUnit(3)

local Unit3Type = Unit3:GetTypeName()

ReaperEngageUnit3SubMenu = MENU_COALITION:New( coalition.side.BLUE, "Target 3: " .. Unit3Type, ReaperEngageSpecificSubMenu )

if ReaperAGM114 < 4 then

ReaperEngageUnit3MenuItemAGM = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Engage " .. Unit3Type .. " with AGM-114", ReaperEngageUnit3SubMenu, ReaperEngageUnit3AGM )

end

if ReaperGBU12 < 2 then

ReaperEngageUnit3MenuItemGBU = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Engage " .. Unit3Type .. " with GBU-12", ReaperEngageUnit3SubMenu, ReaperEngageUnit3GBU )

end

end

 

This is just the first three units in the enemy group. Continue this for as many units as the group might consist of.

 

ReaperAGM114 and ReaperGBU12 counts how many AGM-114 or GBU-12 the Reaper has fired, so the menu item won't be added if the Reaper doesn't have enough munitions for the requested attack.

 

Say the player wants the Reaper to attack Unit1 with an AGM-114, then the function ReaperEngageUnit1AGM() runs.

 

function ReaperEngageUnit1AGM()

ReaperAttackUnit = 1

ReaperEngageUnitAGM()

end

 

This function sets ReaperAttackUnit to 1 and runs the function ReaperEngageUnitAGM()

 

function ReaperEngageUnitAGM()

 

if ReaperAttackUnit == 1 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(1)

elseif ReaperAttackUnit == 2 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(2)

elseif ReaperAttackUnit == 3 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(3)

elseif ReaperAttackUnit == 4 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(4)

elseif ReaperAttackUnit == 5 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(5)

elseif ReaperAttackUnit == 6 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(6)

elseif ReaperAttackUnit == 7 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(7)

elseif ReaperAttackUnit == 8 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(8)

elseif ReaperAttackUnit == 9 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(9)

elseif ReaperAttackUnit == 10 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(10)

elseif ReaperAttackUnit == 11 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(11)

elseif ReaperAttackUnit == 12 then

ReaperRedTargetUnit = RedTargetGroup:GetUnit(12)

end

 

SCHEDULER:New(nil,function()

 

local AGM114Task = ReaperGroup:TaskAttackUnit(ReaperRedTargetUnit, true, 1, 1, 180, 1750, true, 131072 )

ReaperGroup:PushTask( AGM114Task )

 

end,{},5)

MESSAGE:New( "Reaper Command: Engaging with AGM-114.", 3):ToBlue()

 

end

 

And this is where the Reaper gets in to action. ReaperGroup will attack the unit selected. It will engage from 1750 meters above the target with weapon type 131072 (see https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag).

 

I wrote this a long time ago and I can see right away that there are improvements to be made to the code above but seeing as how it works and there are new things to discover I probably never will get around to making it more streamlined :)

Link to comment
Share on other sites

Well I don’t know exactly what I changed but I got it working. I was just about to try your method of assigning individual units, but then made a couple changes to the script and somehow it worked. Consistently even. I moved the definition of the Wingman variable out of the function that tasked him with attacking and thought that was what fixed it but after testing it on a much smaller mission that made no difference. No clue what did it but he now engages until he’s Winchester and then rejoins. I’ll take it!

Link to comment
Share on other sites

Been following this thread with interest.

 

 

Spent all weekend working on getting my wingman to work as a separate group, but that won't work when flying off a carrier. (Adding a second group always starts a flight deck fire.)

 

 

What I've learned, though, is that if your dash-2 is in the same group as the player, and you lead him past the target in visual range, you can then send him off to attack it. (He'll make some approximately right engagement calls - "In", "Missile away", "Off" - so you can call him to rejoin after he engages.)

 

 

I'm beginning to think that the only way to do this is to keep the mission on the small side and use AI PUSH TASK to make the current target group the only non-invisible enemy group on the map.

Very Respectfully,

Kurt "Yoda" Kalbfleisch

London

"In my private manual I firmly believed the only time there was too much fuel aboard any aircraft was if it was fire." --Ernest K. Gann

 

Link to comment
Share on other sites

Well I think I finally have it working. I definitely agree that making them a separate group is probably the only way to make it consistent, but since my small mission with just my group and an enemy group worked flawlessly I thought there had to be a way. I discovered my wingman would ignore commands through the normal radio path as well, and respond “Unable” when asked to attack any ground target. And then it clicked. Aside from complexity which I couldn’t get rid of, the big difference between missions where this worked and where it didn’t was presence of air defense units. My wingman was just being over cautious. I checked and the “REACTION TO THREAT” option was defaulting to “Allow Abort”. Changed it to “Passive Defense” and so far so good.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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