MIST units in polygon

From DCS World Wiki - Hoggitworld.com
Revision as of 23:12, 13 April 2018 by Grimes (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


mist.flagFunc.units_in_polygon

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_in_polygon(table vars )
Valid Input Values:

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

 vars = 
 {
 units = UnitNameTable units, 
 zone = table zone, 
 flag = number/string flag,
 stopFlag = number/string stopFlag, 
 maxalt = number maxalt, 
 req_num = number req_num, 
 interval = number interval, 
 toggle = boolean toggle,
 unitTableDef = table unitTableDef,
 }

units is a UnitNameTable- a table of unit names that follow a special set of rules (see the entry on UnitNameTables).

zone is a table of map points that defines the polygon shape (indexed numerically). See pointInPolygon for a good explanation.

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

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

maxalt is an optional variable that allows you to a specify a maximum altitude (above sea level) for the polygon zone. Altitude above ground level will likely be added in a future version of Mist.

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.

unitTableDef is an optional table containing the a unitNameTables definition. If present this value will be used to modify the units checked if new units are dynamically added to the mission. This value and capability is also used if the units variable is given a unitNameTables definition.

Return value:
nothing
Return example:
nothing
Usage Examples:

do

 mist.flagFunc.units_in_polygon{ 
   units = {'[blue][vehicle]'}, 
   zone = mist.getGroupPoints('forest1'), 
   flag = 11 
 }

end

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

once units listed in units are inside the polygon zone defined by the map points listed in zone. This process will keep running, and flag will keep being set true as long as the unit(s)-in-zone 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 units or zone_units is passed as a unitNameTable definition table then that information will be added to the optional variables unitTableDef and zUnitTableDef. 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