Jump to content

DCS func knowTarget (Edit pushTask)


CougarFFW04

Recommended Posts

On 1/23/2020 at 2:54 AM, CougarFFW04 said:

Hi Hardcard.

It works !!! Thanks so much.

The DCS coordinates are sometime a bit confusing for me as sometime y is z...

You rock!!!

And a few monthsssssss  later digging this again 🤪

So for exemple the following works

local pil01 = Unit.getByName('TestStr-1'):getController()
local bat01 = StaticObject.getByName('Targ01')
local bat01_vec2 = { x = bat01:getPoint().x , y = bat01:getPoint().z } -- Conversion to Vec2 coordinate format
local Strike_Task01 = { id = 'AttackMapObject', params = { point = bat01_vec2, groupAttack = false, expend = "HALF", attackQty = 1} }
pil01:pushTask(Strike_Task01)

local pil02 = Unit.getByName('TestStr-2'):getController()
local bat02 = StaticObject.getByName('Targ02')
local bat02_vec2 = { x = bat02:getPoint().x , y = bat02:getPoint().z } -- Conversion to Vec2 coordinate format
local Strike_Task02 = { id = 'AttackMapObject', params = { point = bat02_vec2, groupAttack = false, expend = "HALF", attackQty = 1} }
pil02:pushTask(Strike_Task02)

In the sens that the 2 F15 (loaded with 4 Mk84 each) bomb their respective targets

However I am facing 2 problems :

- first they release 2 Mk84 on their target in the first pass as I expect BUT then they come back for a second pass... That I don't want because they are supposed to bomb another taget later. I thought that the attackQty = 1 parameter would fix it but it doesn't

- second, once they are free of amo (after the second pass), instead of of resuming their FP, they head to the closest airbase and land... I tried to set the command "switch to Wpt" assigning their next FP wpt but it doesn't work either...

Any idea how to fix these 2 ?

Thanks


Edited by CougarFFW04
Link to comment
Share on other sites

  • CougarFFW04 changed the title to DCS func knowTarget (Edit pushTask)

1. You might need to specify the weapon type in order for expend to be valid. weaponType = 2147485680 ought to do the trick. Additionally the boolean for attackQtyLimit should be required for the limit to be used. That was missing from the wiki for some tasks. 

2. I know there are some quirks to assigning tasks to a unit controller and trying to get certain expected behavior out of the AI. I'd have to search through the archives because I did test this several years ago for splitting up a bunch of JDAM targets so the AI can engage quicker. I vaguely recall I assigned the task I wanted the group leader to do to the group controller and then iterate through the other group members to push their own set of tasks to their unit controllers. Might have been something along the lines of pushing a unit task to each unit overrides the group mission task. If the group leader still has their own mission task then the rest of the flight is aware of it and is able to reform on the leader. Otherwise they have no unit level mission and RTB. 

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

unit_push_task_fall_back.miz

Found it. Interestingly the flight originally had an orbit task and when every unit was given a pushTask to attack, when they completed it they all formed back on the leader doing an orbit. However the orbit positions had changed completely. Removing the orbit task saw the whole group RTB to nearest. Anyway my memory was correct. It assigned a task to the group controller and then to the remaining 3 unit controllers. 

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

1 hour ago, Grimes said:

1. You might need to specify the weapon type in order for expend to be valid. weaponType = 2147485680 ought to do the trick. Additionally the boolean for attackQtyLimit should be required for the limit to be used. That was missing from the wiki for some tasks.

Hi Grimes,

Nice to see you as usual in the starting blocks to answer all questions about DCS scripting engine 🤗👍

Oki for weaponType. I do see where it does come from in the wiki

So I must add attackQtyLimit = true Right ?

I am going to have a look at your mission and will come back to you if problems.

Thanks a lot

Link to comment
Share on other sites

So  I had a look at your .miz

It sounds that your script is embeded in the .miz but I think I have identified the parts dealing with the group and the one dealing with the units.

So if I catch you I must do something like that:
 

-- Dealing with group controler
local pil01 = Group.getByName('Ford-3'):getController()
local bat01 = StaticObject.getByName('Targ01')
local bat01_vec2 = { x = bat01:getPoint().x , y = bat01:getPoint().z } -- Conversion to Vec2 coordinate format
local Strike_Task01 = { id = 'AttackMapObject', params = { point = bat01_vec2, groupAttack = false, expend = "HALF", weaponType = 2147485680, attackQtyLimit = true, attackQty = 1} }
pil01:pushTask(Strike_Task01)

-- Dealing with units controlers
local pil02 = Unit.getByName('Ford-3-2'):getController()
local bat02 = StaticObject.getByName('Targ02')
local bat02_vec2 = { x = bat02:getPoint().x , y = bat02:getPoint().z } -- Conversion to Vec2 coordinate format
local Strike_Task02 = { id = 'AttackMapObject', params = { point = bat02_vec2, groupAttack = false, expend = "HALF", weaponType = 2147485680, attackQtyLimit = true, attackQty = 1} }
pil02:pushTask(Strike_Task02)

-- and so on (or in a loop)...

I have added the weaponType = 2147485680, attackQtyLimit = true in the task parameters.

Right ?

 

Edit : tested, works !!!

@Grimes : you rock 🤗👍


Edited by CougarFFW04
Link to comment
Share on other sites

  • Recently Browsing   0 members

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