Jump to content

Recommended Posts

Posted

Hello guys, 

 

I’ve been reading for hours and I can’t make it work...

 

 I have 50 CAS BLUE groups and a RED convoy , spawned dynamically somewhere on the map.
 

I need the BLUE units to engage it, problem I can’t use the attack group in the editor as it’s spawned dynamically. The convoy has group name « Convoy1 », is there a simple way to have the 50 groups detect and engage it ?


 

Also, can you simulate the detection of all the RED units in a zone and show them to all blue units on F10 map ? I want my E3 AWACS to act as a JSTAR.

 

thanks

 

Posted

Rename your 50 groups : 'Blue CAS 1' to 'Blue CAS 50' (to match script) and use this "do script" :

 

local target = Group.getByName('Convoy1')
local groupId = Group.getID(target)
local Task = {
["id"] = "AttackGroup",
["params"] = {
["groupId"] = groupId,
},
}
for i = 1,50 do
local groupName = 'Blue CAS ' .. i
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == true and #Group.getByName(groupName):getUnits() > 0 then
Group.getByName(groupName):getController():pushTask(Task)
end
end

 

I don't know for your last question.

  • Thanks 1
Posted (edited)

Thank you so much, do you know if it would be possible to do the same with a prefix ?  Like Cas ?

Because I named them casMig23-1...n, casMiG29-1...n and I already have so much lua with these names 


 

thanks 😊 
 

also they spawn randomly between 0s and 2h, is that an issue ? 

 

Edited by inconnudiscret
Posted

You can make a group table including every group with 'cas' prefix and run the "pushtask" through the table in a similar way.
Spawning randomly is not an issue - just run the "attackGroup" when new cas group spawns, linked by a function-scheduller (and directly refering to the correct group name).

Posted

Hi, I got it working, but only the first unit of each group is engaging my Convoy.

 

I use this, that I paste in each attack group 1st waypoint, under script

 

Is there a way to have a group attack ?

 

local target = Group.getByName('Convoy')
local groupId = Group.getID(target)
local Task = {
["id"] = "AttackGroup",
["params"] = {
["groupId"] = groupId,
["altitudeEnabled"] = true,
["altitude"] = 4500,
},
}

local groupName = 'Mig23-1'
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == true and #Group.getByName(groupName):getUnits() > 0 then
Group.getByName(groupName):getController():pushTask(Task)
end

 

Posted
4 hours ago, foba75gmail.com said:

Hi, I got it working, but only the first unit of each group is engaging my Convoy...

 

 

No idea. When I use this task on a multiple units flight (helos or airplanes), all are attacking. 

  • Recently Browsing   0 members

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