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...