MIST units in zones

From DCS World Wiki - Hoggitworld.com


mist.flagFunc.units_in_zones

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

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

 vars = 
 {
 units = UnitNameTable units, 
 zones = table zones, 
 flag = number/string flag,
 stopFlag = number/string stopFlag, 
 zone_type = string zone_type, 
 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).

zones is a table of zone names (indexed numerically)

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.

zone_type 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.

req_num is an optional variable that defines the shape of the zones. The following are the allowed values for zone_type:

 'cylinder' - cylindrical shaped zone extending to +/- infinity in altitude. 
 'sphere' - spherical zone. 

If not specified, it defaults to 'cylinder'.

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_zones{ 
   units = {'Chevy11', 'Chevy12', 'Chevy13', 'Chevy14'}, 
   zones = {'Mozdok', 'Krymsk', 'Anapa', 'Mineral'}, 
   flag = 100, 
   zone_type = 'sphere' 
 }

end

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

once units from units are inside any one of a series of zones listed in zones. This process will keep running, and flag will keep being set true as long as the unit(s)-in-zone(s) 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