Jump to content

Detecting Helicopters Landing in a Zone and disembarking troops


Recommended Posts

Posted

Hi Guys

 

I am trying to find an easy way to detect when a helicopter (from any number of helicopters) has landed and disembarked troops; without using lots of OR conditions!

 

I am using both extracted troops and picked up troops (from a pickup zone) using CTTS v1.4 in 1.2.7 Open Beta.

 

Any suggestions, would be greatly appreciated?

Rig: MSI Mag X570 Tomahawk| AMD 5600 | 32 GB DDR3 | M2 NVME Gen4 1TB SSD | Samsung EVo 850 2TB, 500 & 256 GB SSD | Gigabyte AORUS GTX 1080Ti | Samsung 24" (1920x1200) |

2 x Iiyama 22" T2250MTS touch screen (1920x1080) | 2 x 6.4" LCD | Cougar MFDs | Thrustmaster Warthog | CH Pro Pedals | Windows 10

 

[sIGPIC][/sIGPIC]

Posted

There is a lua predicate script floating around in here. Search lua predicate helicopter landing or something like that and you'll find it. I think st3v3 made it. I use it too but don't have immediate access to right now.

 

It won't say if you release troops or not but that is a good start. There is also a mod you need to do to the ctts to get troops generated by ctts to be detected in mist. I will have to look around for it but I think it's in the original ctts thread.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Posted

@ENO:

 

Thanks for this. I think the LUA Predicate code you are referring to is this:

 

 

local group = 'yourgroupnamehere' --Enter the groupname from the ME here

 

group = Group.getByName(group)

if group ~= nil then

group = group:getUnits()[1]

if group:inAir() then

return false

else

return true

end

else --If Group does not exist

return true

end

return false

 

 

I really need this to test for any helicopter in a defined list of helicopter groups so not sure how to get this to work.

 

I have already modified CTTS with that fix thanks.

Rig: MSI Mag X570 Tomahawk| AMD 5600 | 32 GB DDR3 | M2 NVME Gen4 1TB SSD | Samsung EVo 850 2TB, 500 & 256 GB SSD | Gigabyte AORUS GTX 1080Ti | Samsung 24" (1920x1200) |

2 x Iiyama 22" T2250MTS touch screen (1920x1080) | 2 x 6.4" LCD | Cougar MFDs | Thrustmaster Warthog | CH Pro Pedals | Windows 10

 

[sIGPIC][/sIGPIC]

Posted

@Suchaz:

 

I will look to see if this helps.

 

Thanks:thumbup:

Rig: MSI Mag X570 Tomahawk| AMD 5600 | 32 GB DDR3 | M2 NVME Gen4 1TB SSD | Samsung EVo 850 2TB, 500 & 256 GB SSD | Gigabyte AORUS GTX 1080Ti | Samsung 24" (1920x1200) |

2 x Iiyama 22" T2250MTS touch screen (1920x1080) | 2 x 6.4" LCD | Cougar MFDs | Thrustmaster Warthog | CH Pro Pedals | Windows 10

 

[sIGPIC][/sIGPIC]

Posted

OK so I have made some progress, thanks to suggestions so far.

 

1. I have used mist.flagFunc.units_in_zones to set a flag when one of helis is in the LZ zone.

 

do

mist.flagFunc.units_in_zones{

units = {'HeliAssault1 (Red)', 'HeliAssault2 (Blue)', 'HeliAssault3 (Green)', 'HeliAssault4 (White)', 'HeliAssault5 (Red)', 'HeliAssault6 (Blue)', 'HeliAssault7 (Green)', 'HeliAssault8 (White)'},

zones = {'Ambush 1 Red LZ'},

flag = 81,

zone_type = 'sphere'

}

end

 

2. I have also used ENOs suggested ST3v3f LUA Predicate code :thumbup: combined with condition for flag 81 to ascertain when heli is on ground in a zone.

 

 

local HeliGroup = {'HeliAssault1 (Red)', 'HeliAssault2 (Blue)', 'HeliAssault3 (Green)', 'HeliAssault4 (White)', 'HeliAssault5 (Red)', 'HeliAssault6 (Blue)', 'HeliAssault7 (Green)', 'HeliAssault8 (White)'} --Enter the list of groups to be tested from the ME here

local group = ''

 

for i = 1, #HeliGroup do

group = Group.getByName(HeliGroup)

if group ~= nil then --If Group exists

group = group:getUnits()[1]

if group:inAir() then

return false --Group is in air

else

return true --Group is not in air (has landed)

end

else --If Group does not exist

return true

end

return false

end

 

 

However, this fires as soon as skids or wheels hit the ground in the LZ zone and not when the heli is stationary or after troops are disembarked. Any suggestions for achieving this last bit of the puzzle?

Rig: MSI Mag X570 Tomahawk| AMD 5600 | 32 GB DDR3 | M2 NVME Gen4 1TB SSD | Samsung EVo 850 2TB, 500 & 256 GB SSD | Gigabyte AORUS GTX 1080Ti | Samsung 24" (1920x1200) |

2 x Iiyama 22" T2250MTS touch screen (1920x1080) | 2 x 6.4" LCD | Cougar MFDs | Thrustmaster Warthog | CH Pro Pedals | Windows 10

 

[sIGPIC][/sIGPIC]

  • 4 months later...
Posted

I just now happened to see this post while searching for something else. Here is a lua predicate I came up with to do most of what you want to do. (It doesn't check for disembarked troops.) It will only return true if any of the specified units 1) lands in the zone safely and 2) comes to a stop. Obviously, you will have to change the unit names to the ones you use in your mission.

local function anyUnitLandedInZone(units, zone, checkLanded, checkStopped)

   local stopSpeed   = 1.0 -- m/s
   local landed      = false
   local inZone      = false
   local alive       = false
   local stopped     = false
   local i

   for i=1,#units do
       local group = Group.getByName(units[i])
       if group then
           local unit = group:getUnit(1)
           if unit and unit:isActive() then
           
               -- is unit in zone?
               local unitPos = unit:getPoint()
               local z = trigger.misc.getZone(zone)
               if z then
                   local dx = unitPos.x - z.point.x
                   local dy = unitPos.z - z.point.z
                   local d = math.sqrt(dx*dx + dy*dy)
                   if d < z.radius then inZone = true end
               end
               
               -- has unit landed?
               if checkLanded then
                   local inAir = unit:inAir()
                   if not inAir then landed = true end
               else
                   landed = true
               end
               
               -- is unit still alive?
               local life = unit:getLife()
               if life > 1 then alive = true end
               
               -- has unit stopped?
               if checkStopped then
                   local v = unit:getVelocity()
                   local s = math.sqrt(v.x*v.x + v.y*v.y + v.z*v.z)
                   if s < stopSpeed then stopped = true end
               else
                   stopped = true
               end
               
               --return true if conditions met
               if landed and inZone and alive and stopped then
                   return true
               end
               
           end
       end
   end
   return false
end

return anyUnitLandedInZone( { 'Cicada-1-Lead'  ,
                             'Cicada-2'       ,
                             'Cicada-3'       ,
                             'Cicada-4'       ,
                             'Vespa-1-Lead'   ,
                             'Vespa-2'        ,
                             'Vespa-3'        ,
                             'Vespa-4'        ,
                             'Vulture-1-Lead' ,
                             'Vulture-2'      ,
                             'Vulture-3'      ,
                             'Vulture-4'      , } , 'FarpLandingZone', false, false )

  • Recently Browsing   0 members

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