Jump to content

Recommended Posts

Posted (edited)

Hi,

 

Was writing a script to allow a carrier ( transport helicopter ) to be escorted by other helicopters for defense... And found out nothing works... There seems to be no escort function working when it is activated by a script.

 

So i went to look into the editor and guess what: it seems that the escort task has vanished for helicopters :mad:

 

? BUG ? -> pls check and confirm if i either am not understanding something or it is a mistake to be corrected.

 

Find underlying the first picture, showing an attempt to make a helicopter group escort another helicopter group. The task Escort is not in the list anymore, it seems. Although the type of the main group task is set to Escort.

 

9pei.jpg

 

The second picture shows that the Escort task is available for planes:

 

i35s.jpg

 

Is this normal mission editor behaviour?

 

Also, it seems that activating an escort AI task through scripting does not work at all. One note, the helicopters are dynamically spawned, although i get for each unit a valid groupId after spawing...

 

 
EscortCount = 0
function EscortCarrier ( CarrierGroup, EscortPrefix )
env.info(( 'EscortCarrier: ' ))
env.info(( 'EscortCarrier: CarrierGroup = ' .. CarrierGroup:getName() ))
env.info(( 'EscortCarrier: EscortPrefix = ' .. EscortPrefix ))
 local EscortGroup = {}
local EscortUnits
local EscortGroupName

--Get the Group Data with Mist
EscortGroup = mist.getGroupData( EscortPrefix .. '000' )
  
if EscortGroup ~= nil then
  EscortGroup.route = {}
 EscortGroup.route.points = mist.getGroupRoute(EscortPrefix.."000", true)
  EscortCount = EscortCount + 1
 EscortGroupName = string.format( EscortPrefix .. '%03d', EscortCount )
 EscortGroup.name = EscortGroupName
 EscortGroup.groupName = EscortGroupName
   
 local EscortUnits = #EscortGroup.units
 for u = 1, EscortUnits do
  EscortGroup.units[u].unitName = string.format( EscortPrefix .. '%03d-%02d', EscortCount, u )
 end
   
 EscortGroup.groupId = 4500 + EscortCount
  mist.dynAdd( EscortGroup )
 
 EscortGroup = Group.getByName( EscortGroupName )
 env.info(( 'Carrier: Escort ID' .. CarrierGroup:getID() ))
  local controllerGroup = EscortGroup:getController()
  local EscortZonePos = {}
 EscortZonePos.x = 0
 EscortZonePos.y = 0
 EscortZonePos.z = -40
[color=red]  controllerGroup:pushTask( { id = 'Escort', 
                             params = { groupId = CarrierGroup:getID(),
                   pos = EscortZonePos, 
             lastWptIndexFlag = false,
           } 
         } 
       )
[/color]
 if  controllerGroup:hasTask() then
  env.info('EscortCarrier: hastask on ' )
 else
  env.info('EscortCarrier: hastask off ' )
 end
   
end

 env.info(( 'EscortCarrier: end' ))
end

Edited by FlightControl

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

  • 2 months later...
Posted

Could you share the solution?

RTX 2070 8GB | 32GB DDR4 2666 RAM | AMD Ryzen 5 3600 4.2Ghz | Asrock X570 | CH Fighterstick/Pro Throttle | TM MFDs | TrackIR 5

  • Recently Browsing   0 members

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