MIST units LOS

From DCS World Wiki - Hoggitworld.com


mist.flagFunc.units_LOS

Added with: Mist 1.0
Description
Sets a flag true when the a required number of units are inside of the specified polygon zone.
Syntax
nothing mist.flagFunc.units_LOS(table vars )
Valid Input Values:

vars tables have the following recognized fields( required entries in blue, optional in green):

 vars = 
 {
 unitSet1 = UnitNameTable unitSet1, 
 altOffSet1 = number altOffSet1, 
 unitSet2 = UnitNameTable unitSet2, 
 altOffSet2 = number altOffSet2, 
 flag = number/string flag,
 stopFlag = number/string stopFlag, 
 radius = number radius, 
 req_num = number req_num, 
 interval = number interval, 
 toggle = boolean toggle,
 unitTableDef1 = table unitTableDef1, 
 UnitTableDef2 = table UnitTableDef2,
 }

unitSet1 UnitNameTables- a tables of unit names that follow a special set of rules (see the entry on UnitNameTables).

altOffSet1 is the number of meters above the position of each unit from unitset1 that Line of Sight is checked from, cannot be 0.

unitSet2 UnitNameTables- a tables of unit names that follow a special set of rules (see the entry on UnitNameTables).

altOffSet2 is the number of meters above the position of each unit from unitset2 that Line of Sight is checked from, cannot be 0.

flag is the flag that will be set true if the conditions are true

stopFlag is an optional variable that allows you to specify a flag number that, if set true, will stop the process.

radius is an optional variable that allows you to a specify a maximum radius, in meters, out to which the LOS check occurs; beyond this radius, units will not be considered LOS.

req_num is an optional variable that allows you to specify the minimum number of units that must be in one (or more) of the zones before flag is set true. If req_num is not specified, it defaults to 1.

interval is an optional variable that allows you to specify how often (in seconds) the in-zone condition is checked; for lots of units in lots of zones (like hundreds of units in hundreds of different zones), it might be desirable to increase the interval to save computer processing time. If not specified, interval defaults to 1

toggle is an optional variable that if present will switch the flag value to false when the required conditions are not met. If not specified toggle defaults to false.

unitTableDef1 is an optional table containing the a unitNameTables definition used to define the unitset1 value.

UnitTableDef2 is an optional table containing the a unitNameTables definition used to define the unitset2 value.

Return value:
nothing
Return example:
nothing
Usage Examples:

do

 mist.flagFunc.units_LOS{ 
   unitset1 = {'[g]M1 PLT1', '[g]M1 PLT2', '[g]M2 PLT1'}, 
   altoffset1 = 3, 
   unitset2 = {'[red][vehicle]'}, 
   altoffset2 = 3, 
   flag = 10, 
   interval = 20 
 }

end

Notes:
nce this function is run, it will start a continuously evaluated process that will set flag flag true

once units listed in unitset1 are line-of-sight (LOS) to units listed in unitset2. This process will keep running, and flag will keep being set true as long as the line-of-sight conditions persist, unless the process is stopped with stopflag.

Mist 3.5 allows for strings to be used to define flags.

Mist 4.0 has modified this function to better adapt to added any units dynamically spawned into the mission. If unitset1 or unitset2 is passed as a unitNameTable definition table then that information will be added to the optional variables unitTableDef1 and unitTableDef2. Once present there will be a check whenever dynamically added units are spawned into the mission, if those units fit into the unitNameTable definition then they will also be checked by the function.

Related Functions
mapobjs_dead_polygon, Mapobjs_dead_zones, units_in_zones, units_in_moving_zones, units_in_polygon, units_LOS, group_alive, group_dead, group_alive_more_than, group_alive_less_than

Scripting Engine

MIST Root Page