Difference between revisions of "MIST units in moving zones"

From DCS World Wiki - Hoggitworld.com
 
(No difference)

Latest revision as of 23:12, 13 April 2018


mist.flagFunc.units_in_moving_zones

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

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

 vars = 
 {
 units = UnitNameTable units, 
 zone_units = UnitNameTable zone_units, 
 flag = number/string flag, 
 radius = number radius,
 stopFlag = number/string stopFlag, 
 zone_type = string zone_type, 
 req_num = number req_num, 
 interval = number interval, 
 toggle = boolean toggle,
 unitTableDef = table unitTableDef, 
 zUnitTableDef = table zUnitTableDef,
 }

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

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

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

radius is the radius, in meters, of all the zones drawn around each unit in zone_units.

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 used to define the units value.

zUnitTableDef is an optional table containing the a unitNameTables definition used to define the zone_units value.

Return value:
nothing
Return example:
nothing
Usage Examples:

do

 mist.flagFunc.units_in_moving_zones{ 
   units = {'[blue]'}, 
   zone_units = {'[red]'}, 
   flag = 500, 
   radius = 10000, 
   stopflag = 9999, 
   req_num = 4, 
   zone_type = 'sphere', 
   interval = 10, 
 } 

end

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

once units listed in units are inside any of the moving zones around the units listed in 16

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