Jump to content

Recommended Posts

Posted (edited)

Hi Lua scripting Gurrus,

 

 

I would like to detect if a flight (let'say it is named "TOTO") entered a DCS area. I think the best way is to use the DCS function searchObjects. To learn how it works I ran the exemple in the documentation namely:

local foundUnits = {}  

local sphere = trigger.misc.getZone('town')  

local volS = {
   id = world.VolumeType.SPHERE,
   params = {
     point = sphere.point,
     radius = sphere.radius
   }  }

local ifFound = function(foundItem, val)
    foundUnits[#foundUnits + 1] = foundItem:getName
    return true
end

and put world.searchObjects(Object.Category.UNIT, volS, ifFound) in a DCS trigger runing continuously 

  

 

 

 

Of course I have an area named "town" and planes entering this area but as soon as I run the mission, DCS complains : Parameter #2 (function) missed

I tried different things but I am still sticked with this error.

 

 

As I am not very familiar with handler may be I am doing something wrong... Could someone show me the code that would just write on screen "TOTO entered town" when this event occurs.

 

Thanks in advance

Edited by CougarFFW04
  • 3 years later...
  • Recently Browsing   0 members

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