Module Zone

Core -- ZONE classes define zones within your mission of various forms, with various capabilities.

Banner Image


There are essentially two core functions that zones accomodate:

  • Test if an object is within the zone boundaries.
  • Provide the zone behaviour. Some zones are static, while others are moveable.

The object classes are using the zone classes to test the zone boundaries, which can take various forms:

  • Test if completely within the zone.
  • Test if partly within the zone (for Group#GROUP objects).
  • Test if not in the zone.
  • Distance to the nearest intersecting point of the zone.
  • Distance to the center of the zone.
  • ...

Each of these ZONE classes have a zone name, and specific parameters defining the zone type:

  • #ZONE_BASE: The ZONE_BASE class defining the base for all other zone classes.
  • #ZONE_RADIUS: The ZONE_RADIUS class defined by a zone name, a location and a radius.
  • #ZONE: The ZONE class, defined by the zone name as defined within the Mission Editor.
  • #ZONE_UNIT: The ZONE_UNIT class defines by a zone around a Unit#UNIT with a radius.
  • #ZONE_GROUP: The ZONE_GROUP class defines by a zone around a Group#GROUP with a radius.
  • #ZONE_POLYGON: The ZONE_POLYGON class defines by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.

Author: FlightControl

Contributions:


Global(s)

ZONE

ZONE class, extends Zone#ZONE_RADIUS

The ZONE class, defined by the zone name as defined within the Mission Editor.

ZONE_BASE

ZONE_BASE class, extends Base#BASE

This class is an abstract BASE class for derived classes, and is not meant to be instantiated.

ZONE_GROUP

ZONE_GROUP class, extends Zone#ZONE_RADIUS

The ZONE_GROUP class defines by a zone around a Group#GROUP with a radius.

ZONE_POLYGON

ZONE_POLYGON class, extends Zone#ZONEPOLYGONBASE

The ZONE_POLYGON class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.

ZONE_POLYGON_BASE

ZONEPOLYGONBASE class, extends Zone#ZONE_BASE

The ZONEPOLYGONBASE class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.

ZONE_RADIUS

ZONE_RADIUS class, extends Zone#ZONE_BASE

The ZONE_RADIUS class defined by a zone name, a location and a radius.

ZONE_UNIT

ZONE_UNIT class, extends Zone#ZONE_RADIUS

The ZONE_UNIT class defined by a zone around a Unit#UNIT with a radius.

Type ZONE

ZONE:FindByName(ZoneName)

Find a zone in the _DATABASE using the name of the zone.

ZONE:New(ZoneName)

Constructor of ZONE, taking the zone name.

Type ZONE_BASE

ZONE_BASE:BoundZone()

Bound the zone boundaries with a tires.

ZONE_BASE:GetBoundingSquare()

Get the bounding square the zone.

ZONE_BASE:GetCoordinate()

Returns a Point#COORDINATE of the zone.

ZONE_BASE:GetName()

Returns the name of the zone.

ZONE_BASE:GetPointVec2(Height)

Returns a Point#POINT_VEC2 of the zone.

ZONE_BASE:GetPointVec3(Height)

Returns a Point#POINT_VEC3 of the zone.

ZONE_BASE:GetRandomPointVec2()

Define a random Point#POINT_VEC2 within the zone.

ZONE_BASE:GetRandomPointVec3()

Define a random Point#POINT_VEC3 within the zone.

ZONE_BASE:GetRandomVec2()

Define a random DCSTypes#Vec2 within the zone.

ZONE_BASE:GetVec2()

Returns the DCSTypes#Vec2 coordinate of the zone.

ZONE_BASE:GetVec3(Height)

Returns the DCSTypes#Vec3 of the zone.

ZONE_BASE:GetZoneMaybe()

Get the zone taking into account the randomization probability of a zone to be selected.

ZONE_BASE:GetZoneProbability()

Get the randomization probability of a zone to be selected.

ZONE_BASE:IsCoordinateInZone(Coordinate)

Returns if a Coordinate is within the zone.

ZONE_BASE:IsPointVec2InZone(PointVec2)

Returns if a PointVec2 is within the zone.

ZONE_BASE:IsPointVec3InZone(PointVec3)

Returns if a PointVec3 is within the zone.

ZONE_BASE:IsVec2InZone(Vec2)

Returns if a Vec2 is within the zone.

ZONE_BASE:IsVec3InZone(Vec3)

Returns if a Vec3 is within the zone.

ZONE_BASE:New(ZoneName)

ZONE_BASE constructor

ZONE_BASE:SetName(ZoneName)

Sets the name of the zone.

ZONE_BASE:SetZoneProbability(ZoneProbability)

Set the randomization probability of a zone to be selected.

ZONE_BASE:SmokeZone(SmokeColor)

Smokes the zone boundaries in a color.

ZONE_BASE.ZoneName

Name of the zone.

ZONE_BASE.ZoneProbability

A value between 0 and 1. 0 = 0% and 1 = 100% probability.

Type ZONE_BASE.BoundingSquare

ZONE_BASE.BoundingSquare.x1

The lower x coordinate (left down)

ZONE_BASE.BoundingSquare.x2

The higher x coordinate (right up)

ZONE_BASE.BoundingSquare.y1

The lower y coordinate (left down)

ZONE_BASE.BoundingSquare.y2

The higher y coordinate (right up)

Type ZONE_GROUP

ZONE_GROUP:GetRandomPointVec2(inner, outer)

Returns a Point#POINT_VEC2 object reflecting a random 2D location within the zone.

ZONE_GROUP:GetRandomVec2()

Returns a random location within the zone of the Group.

ZONE_GROUP:GetVec2()

Returns the current location of the Group.

ZONE_GROUP:New(ZoneName, ZoneGROUP, Radius)

Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius.

Type ZONE_POLYGON

ZONE_POLYGON:FindByName(ZoneName)

Find a polygon zone in the _DATABASE using the name of the polygon zone.

ZONE_POLYGON:New(ZoneName, ZoneGroup)

Constructor to create a ZONE_POLYGON instance, taking the zone name and the Group#GROUP defined within the Mission Editor.

ZONE_POLYGON:NewFromGroupName(ZoneName, GroupName)

Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Group#GROUP defined within the Mission Editor.

Type ZONE_POLYGON_BASE

ZONE_POLYGON_BASE:BoundZone(UnBound)

Smokes the zone boundaries in a color.

ZONE_POLYGON_BASE:Flush()

Flush polygon coordinates as a table in DCS.log.

ZONE_POLYGON_BASE:GetBoundingSquare()

Get the bounding square the zone.

ZONE_POLYGON_BASE:GetRandomCoordinate()

Return a Point#COORDINATE object representing a random 3D point at landheight within the zone.

ZONE_POLYGON_BASE:GetRandomPointVec2()

Return a Point#POINT_VEC2 object representing a random 2D point at landheight within the zone.

ZONE_POLYGON_BASE:GetRandomPointVec3()

Return a Point#POINT_VEC3 object representing a random 3D point at landheight within the zone.

ZONE_POLYGON_BASE:GetRandomVec2()

Define a random DCSTypes#Vec2 within the zone.

ZONE_POLYGON_BASE:GetVec2()

Returns the center location of the polygon.

ZONE_POLYGON_BASE:IsVec2InZone(Vec2)

Returns if a location is within the zone.

ZONE_POLYGON_BASE:New(ZoneName, PointsArray)

Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon.

ZONE_POLYGON_BASE:SmokeZone(SmokeColor)

Smokes the zone boundaries in a color.

Type ZONE_RADIUS

ZONE_RADIUS:BoundZone(Points, UnBound, CountryID)

Bounds the zone with tires.

ZONE_RADIUS:CountScannedCoalitions()
ZONE_RADIUS:FlareZone(FlareColor, Points, Azimuth, AddHeight)

Flares the zone boundaries in a color.

ZONE_RADIUS:GetRadius()

Returns the radius of the zone.

ZONE_RADIUS:GetRandomCoordinate(inner, outer)

Returns a Point#COORDINATE object reflecting a random 3D location within the zone.

ZONE_RADIUS:GetRandomPointVec2(inner, outer)

Returns a Point#POINT_VEC2 object reflecting a random 2D location within the zone.

ZONE_RADIUS:GetRandomPointVec3(inner, outer)

Returns a Point#POINT_VEC3 object reflecting a random 3D location within the zone.

ZONE_RADIUS:GetRandomVec2(inner, outer)

Returns a random Vec2 location within the zone.

ZONE_RADIUS:GetRandomVec3(inner, outer)

Returns Returns a random Vec3 location within the zone.

ZONE_RADIUS:GetScannedCoalition(Coalition)

Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone.

ZONE_RADIUS:GetScannedScenery()
ZONE_RADIUS:GetScannedSceneryType(SceneryType)
ZONE_RADIUS:GetScannedUnits()
ZONE_RADIUS:GetVec2()

Returns the DCSTypes#Vec2 of the zone.

ZONE_RADIUS:GetVec3(Height)

Returns the DCSTypes#Vec3 of the ZONE_RADIUS.

ZONE_RADIUS:IsAllInZoneOfCoalition(Coalition)

Is All in Zone of Coalition?

ZONE_RADIUS:IsAllInZoneOfOtherCoalition(Coalition)

Is All in Zone of Other Coalition?

ZONE_RADIUS:IsNoneInZone()

Is None in Zone?

ZONE_RADIUS:IsNoneInZoneOfCoalition(Coalition)

Is None in Zone of Coalition?

ZONE_RADIUS:IsSomeInZoneOfCoalition(Coalition)

Is Some in Zone of Coalition?

ZONE_RADIUS:IsVec2InZone(Vec2)

Returns if a location is within the zone.

ZONE_RADIUS:IsVec3InZone(Vec3)

Returns if a point is within the zone.

ZONE_RADIUS:New(ZoneName, Vec2, Radius)

Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius.

ZONE_RADIUS.Radius

The radius of the zone.

ZONE_RADIUS:Scan(ObjectCategories, Coalition)

Scan the zone for the presence of units of the given ObjectCategories.

ZONE_RADIUS.ScanData
ZONE_RADIUS:SearchZone(ObjectCategories, EvaluateFunction)

Searches the zone

ZONE_RADIUS:SetRadius(Radius)

Sets the radius of the zone.

ZONE_RADIUS:SetVec2(Vec2)

Sets the DCSTypes#Vec2 of the zone.

ZONE_RADIUS:SmokeZone(SmokeColor, Points, AddHeight, AddOffSet, AngleOffset)

Smokes the zone boundaries in a color.

ZONE_RADIUS.Vec2

The current location of the zone.

Type ZONE_UNIT

ZONE_UNIT:GetRandomVec2()

Returns a random location within the zone.

ZONE_UNIT:GetVec2()

Returns the current location of the Unit#UNIT.

ZONE_UNIT:GetVec3(Height)

Returns the DCSTypes#Vec3 of the ZONE_UNIT.

ZONE_UNIT.LastVec2
ZONE_UNIT:New(ZoneName, ZoneUNIT, Radius)

Constructor to create a ZONE_UNIT instance, taking the zone name, a zone unit and a radius.

ZONE_UNIT.ZoneUNIT

Global(s)

#ZONE ZONE

ZONE class, extends Zone#ZONE_RADIUS

The ZONE class, defined by the zone name as defined within the Mission Editor.

This class implements the inherited functions from #ZONE_RADIUS taking into account the own zone format and properties.

ZONE constructor

  • ZONE.New(): Constructor. This will search for a trigger zone with the name given, and will return for you a ZONE object.

Declare a ZONE directly in the DCS mission editor!

You can declare a ZONE using the DCS mission editor by adding a trigger zone in the mission editor.

Then during mission startup, when loading Moose.lua, this trigger zone will be detected as a ZONE declaration. Within the background, a ZONE object will be created within the Database. The ZONE name will be the trigger zone name.

So, you can search yourself for the ZONE object by using the ZONE.FindByName() method. In this example, local TriggerZone = ZONE:FindByName( "DefenseZone" ) would return the ZONE object that was created at mission startup, and reference it into the TriggerZone local object.

Refer to mission ZON-110 for a demonstration.

This is especially handy if you want to quickly setup a SET_ZONE... So when you would declare local SetZone = SET_ZONE:New():FilterPrefixes( "Defense" ):FilterStart(), then SetZone would contain the ZONE object DefenseZone as part of the zone collection, without much scripting overhead!!!

#ZONE_BASE ZONE_BASE

ZONE_BASE class, extends Base#BASE

This class is an abstract BASE class for derived classes, and is not meant to be instantiated.

Each zone has a name:

Each zone implements two polymorphic functions defined in Zone#ZONE_BASE:

A zone has a probability factor that can be set to randomize a selection between zones:

  • ZONE_BASE.SetZoneProbability(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% )
  • ZONE_BASE.GetZoneProbability(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% )
  • ZONE_BASE.GetZoneMaybe(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate.

A zone manages vectors:

A zone has a bounding square:

A zone can be marked:

#ZONE_GROUP ZONE_GROUP

ZONE_GROUP class, extends Zone#ZONE_RADIUS

The ZONE_GROUP class defines by a zone around a Group#GROUP with a radius.

The current leader of the group defines the center of the zone. This class implements the inherited functions from Zone#ZONE_RADIUS taking into account the own zone format and properties.

#ZONE_POLYGON ZONE_POLYGON

ZONE_POLYGON class, extends Zone#ZONEPOLYGONBASE

The ZONE_POLYGON class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.

This class implements the inherited functions from Zone#ZONE_RADIUS taking into account the own zone format and properties.

Declare a ZONE_POLYGON directly in the DCS mission editor!

You can declare a ZONEPOLYGON using the DCS mission editor by adding the ~ZONEPOLYGON tag in the group name.

So, imagine you have a group declared in the mission editor, with group name DefenseZone~ZONE_POLYGON. Then during mission startup, when loading Moose.lua, this group will be detected as a ZONEPOLYGON declaration. Within the background, a ZONEPOLYGON object will be created within the Database using the properties of the group. The ZONEPOLYGON name will be the group name without the ~ZONEPOLYGON tag.

So, you can search yourself for the ZONE_POLYGON by using the ZONE_POLYGON.FindByName() method. In this example, local PolygonZone = ZONE_POLYGON:FindByName( "DefenseZone" ) would return the ZONE_POLYGON object that was created at mission startup, and reference it into the PolygonZone local object.

Mission ZON-510 shows a demonstration of this feature or method.

This is especially handy if you want to quickly setup a SETZONE... So when you would declare local SetZone = SET_ZONE:New():FilterPrefixes( "Defense" ):FilterStart(), then SetZone would contain the ZONEPOLYGON object DefenseZone as part of the zone collection, without much scripting overhead!!!

#ZONE_POLYGON_BASE ZONE_POLYGON_BASE

ZONEPOLYGONBASE class, extends Zone#ZONE_BASE

The ZONEPOLYGONBASE class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.

This class implements the inherited functions from Zone#ZONE_RADIUS taking into account the own zone format and properties. This class is an abstract BASE class for derived classes, and is not meant to be instantiated.

Zone point randomization

Various functions exist to find random points within the zone.

#ZONE_RADIUS ZONE_RADIUS

ZONE_RADIUS class, extends Zone#ZONE_BASE

The ZONE_RADIUS class defined by a zone name, a location and a radius.

This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.

ZONE_RADIUS constructor

Manage the radius of the zone

Manage the location of the zone

Zone point randomization

Various functions exist to find random points within the zone.

#ZONE_UNIT ZONE_UNIT

ZONE_UNIT class, extends Zone#ZONE_RADIUS

The ZONE_UNIT class defined by a zone around a Unit#UNIT with a radius.

This class implements the inherited functions from #ZONE_RADIUS taking into account the own zone format and properties.

Type Zone

Type ZONE

Field(s)

ZONE:FindByName(ZoneName)

Find a zone in the _DATABASE using the name of the zone.

Parameter

  • #string ZoneName : The name of the zone.

Return value

#ZONE_BASE: self

ZONE:New(ZoneName)

Constructor of ZONE, taking the zone name.

Parameter

  • #string ZoneName : The name of the zone as defined within the mission editor.

Return value

#ZONE:

Type ZONE_BASE

Field(s)

ZONE_BASE:BoundZone()

Bound the zone boundaries with a tires.

ZONE_BASE:GetBoundingSquare()

Get the bounding square the zone.

Return value

#nil: The bounding square.

ZONE_BASE:GetCoordinate()

Returns a Point#COORDINATE of the zone.

Return value

Core.Point#COORDINATE: The Coordinate of the zone.

ZONE_BASE:GetName()

Returns the name of the zone.

Return value

#string: The name of the zone.

ZONE_BASE:GetPointVec2(Height)

Returns a Point#POINT_VEC2 of the zone.

Parameter

  • Dcs.DCSTypes#Distance Height : The height to add to the land height where the center of the zone is located.

Return value

Core.Point#POINT_VEC2: The PointVec2 of the zone.

ZONE_BASE:GetPointVec3(Height)

Returns a Point#POINT_VEC3 of the zone.

Parameter

  • Dcs.DCSTypes#Distance Height : The height to add to the land height where the center of the zone is located.

Return value

Core.Point#POINT_VEC3: The PointVec3 of the zone.

ZONE_BASE:GetRandomPointVec2()

Define a random Point#POINT_VEC2 within the zone.

Return value

Core.Point#POINT_VEC2: The PointVec2 coordinates.

ZONE_BASE:GetRandomPointVec3()

Define a random Point#POINT_VEC3 within the zone.

Return value

Core.Point#POINT_VEC3: The PointVec3 coordinates.

ZONE_BASE:GetRandomVec2()

Define a random DCSTypes#Vec2 within the zone.

Return value

Dcs.DCSTypes#Vec2: The Vec2 coordinates.

ZONE_BASE:GetVec2()

Returns the DCSTypes#Vec2 coordinate of the zone.

Return value

#nil:

ZONE_BASE:GetVec3(Height)

Returns the DCSTypes#Vec3 of the zone.

Parameter

  • Dcs.DCSTypes#Distance Height : The height to add to the land height where the center of the zone is located.

Return value

Dcs.DCSTypes#Vec3: The Vec3 of the zone.

ZONE_BASE:GetZoneMaybe()

Get the zone taking into account the randomization probability of a zone to be selected.

Return values

  1. #ZONE_BASE: The zone is selected taking into account the randomization probability factor.

  2. #nil: The zone is not selected taking into account the randomization probability factor.

Usage:


local ZoneArray = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }

-- We set a zone probability of 70% to the first zone and 30% to the second zone.
ZoneArray[1]:SetZoneProbability( 0.5 )
ZoneArray[2]:SetZoneProbability( 0.5 )

local ZoneSelected = nil

while ZoneSelected == nil do
  for _, Zone in pairs( ZoneArray ) do
    ZoneSelected = Zone:GetZoneMaybe()
    if ZoneSelected ~= nil then
      break
    end
  end
end

-- The result should be that Zone1 would be more probable selected than Zone2.
ZONE_BASE:GetZoneProbability()

Get the randomization probability of a zone to be selected.

Return value

#number: A value between 0 and 1. 0 = 0% and 1 = 100% probability.

ZONE_BASE:IsCoordinateInZone(Coordinate)

Returns if a Coordinate is within the zone.

Parameter

Return value

#boolean: true if the coordinate is within the zone.

ZONE_BASE:IsPointVec2InZone(PointVec2)

Returns if a PointVec2 is within the zone.

Parameter

Return value

#boolean: true if the PointVec2 is within the zone.

ZONE_BASE:IsPointVec3InZone(PointVec3)

Returns if a PointVec3 is within the zone.

Parameter

Return value

#boolean: true if the PointVec3 is within the zone.

ZONE_BASE:IsVec2InZone(Vec2)

Returns if a Vec2 is within the zone.

Parameter

Return value

#boolean: true if the Vec2 is within the zone.

ZONE_BASE:IsVec3InZone(Vec3)

Returns if a Vec3 is within the zone.

Parameter

Return value

#boolean: true if the Vec3 is within the zone.

ZONE_BASE:New(ZoneName)

ZONE_BASE constructor

Parameter

  • #string ZoneName : Name of the zone.

Return value

#ZONE_BASE: self

ZONE_BASE:SetName(ZoneName)

Sets the name of the zone.

Parameter

  • #string ZoneName : The name of the zone.

Return value

#ZONE_BASE:

ZONE_BASE:SetZoneProbability(ZoneProbability)

Set the randomization probability of a zone to be selected.

Parameter

  • ZoneProbability : A value between 0 and 1. 0 = 0% and 1 = 100% probability.

ZONE_BASE:SmokeZone(SmokeColor)

Smokes the zone boundaries in a color.

Parameter

#string ZONE_BASE.ZoneName

Name of the zone.

#number ZONE_BASE.ZoneProbability

A value between 0 and 1. 0 = 0% and 1 = 100% probability.

Type ZONE_BASE.BoundingSquare

The ZONE_BASE.BoundingSquare

Field(s)

Dcs.DCSTypes#Distance ZONE_BASE.BoundingSquare.x1

The lower x coordinate (left down)

Dcs.DCSTypes#Distance ZONE_BASE.BoundingSquare.x2

The higher x coordinate (right up)

Dcs.DCSTypes#Distance ZONE_BASE.BoundingSquare.y1

The lower y coordinate (left down)

Dcs.DCSTypes#Distance ZONE_BASE.BoundingSquare.y2

The higher y coordinate (right up)

Type ZONE_GROUP

Field(s)

ZONE_GROUP:GetRandomPointVec2(inner, outer)

Returns a Point#POINT_VEC2 object reflecting a random 2D location within the zone.

Parameters

  • #number inner : (optional) Minimal distance from the center of the zone. Default is 0.

  • #number outer : (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.

Return value

Core.Point#POINT_VEC2: The Point#POINT_VEC2 object reflecting the random 3D location within the zone.

ZONE_GROUP:GetRandomVec2()

Returns a random location within the zone of the Group.

Return value

Dcs.DCSTypes#Vec2: The random location of the zone based on the Group location.

ZONE_GROUP:GetVec2()

Returns the current location of the Group.

Return value

Dcs.DCSTypes#Vec2: The location of the zone based on the Group location.

ZONE_GROUP:New(ZoneName, ZoneGROUP, Radius)

Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius.

Parameters

Return value

#ZONE_GROUP: self

Type ZONE_POLYGON

Field(s)

ZONE_POLYGON:FindByName(ZoneName)

Find a polygon zone in the _DATABASE using the name of the polygon zone.

Parameter

  • #string ZoneName : The name of the polygon zone.

Return value

#ZONE_POLYGON: self

ZONE_POLYGON:New(ZoneName, ZoneGroup)

Constructor to create a ZONE_POLYGON instance, taking the zone name and the Group#GROUP defined within the Mission Editor.

The Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.

Parameters

  • #string ZoneName : Name of the zone.

  • Wrapper.Group#GROUP ZoneGroup : The GROUP waypoints as defined within the Mission Editor define the polygon shape.

Return value

#ZONE_POLYGON: self

ZONE_POLYGON:NewFromGroupName(ZoneName, GroupName)

Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Group#GROUP defined within the Mission Editor.

The Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.

Parameters

  • #string ZoneName : Name of the zone.

  • #string GroupName : The group name of the GROUP defining the waypoints within the Mission Editor to define the polygon shape.

Return value

#ZONE_POLYGON: self

Type ZONE_POLYGON_BASE

Field(s)

ZONE_POLYGON_BASE:BoundZone(UnBound)

Smokes the zone boundaries in a color.

Parameter

  • #boolean UnBound : If true, the tyres will be destroyed.

Return value

#ZONEPOLYGONBASE: self

ZONE_POLYGON_BASE:Flush()

Flush polygon coordinates as a table in DCS.log.

Return value

#ZONEPOLYGONBASE: self

ZONE_POLYGON_BASE:GetBoundingSquare()

Get the bounding square the zone.

Return value

#ZONEPOLYGONBASE.BoundingSquare: The bounding square.

ZONE_POLYGON_BASE:GetRandomCoordinate()

Return a Point#COORDINATE object representing a random 3D point at landheight within the zone.

Return value

Core.Point#COORDINATE:

ZONE_POLYGON_BASE:GetRandomPointVec2()

Return a Point#POINT_VEC2 object representing a random 2D point at landheight within the zone.

Return value

Point#POINT_VEC2

ZONE_POLYGON_BASE:GetRandomPointVec3()

Return a Point#POINT_VEC3 object representing a random 3D point at landheight within the zone.

Return value

Point#POINT_VEC3

ZONE_POLYGON_BASE:GetRandomVec2()

Define a random DCSTypes#Vec2 within the zone.

Return value

Dcs.DCSTypes#Vec2: The Vec2 coordinate.

ZONE_POLYGON_BASE:GetVec2()

Returns the center location of the polygon.

Return value

Dcs.DCSTypes#Vec2: The location of the zone based on the Group location.

ZONE_POLYGON_BASE:IsVec2InZone(Vec2)

Returns if a location is within the zone.

Source learned and taken from: https://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

Parameter

Return value

#boolean: true if the location is within the zone.

ZONE_POLYGON_BASE:New(ZoneName, PointsArray)

Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon.

The Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected.

Parameters

Return value

#ZONEPOLYGONBASE: self

ZONE_POLYGON_BASE:SmokeZone(SmokeColor)

Smokes the zone boundaries in a color.

Parameter

Return value

#ZONEPOLYGONBASE: self

Type ZONE_POLYGON_BASE.BoundingSquare

Type ZONE_POLYGON_BASE.ListVec2

A points array.

Type ZONE_RADIUS

The ZONE_RADIUS class, defined by a zone name, a location and a radius.

Field(s)

ZONE_RADIUS:BoundZone(Points, UnBound, CountryID)

Bounds the zone with tires.

Parameters

  • #number Points : (optional) The amount of points in the circle.

  • #boolean UnBound : If true the tyres will be destroyed.

  • CountryID :

Return value

#ZONE_RADIUS: self

ZONE_RADIUS:CountScannedCoalitions()
ZONE_RADIUS:FlareZone(FlareColor, Points, Azimuth, AddHeight)

Flares the zone boundaries in a color.

Parameters

  • Utilities.Utils#FLARECOLOR FlareColor : The flare color.

  • #number Points : (optional) The amount of points in the circle.

  • Dcs.DCSTypes#Azimuth Azimuth : (optional) Azimuth The azimuth of the flare.

  • #number AddHeight : (optional) The height to be added for the smoke.

Return value

#ZONE_RADIUS: self

ZONE_RADIUS:GetRadius()

Returns the radius of the zone.

Return value

Dcs.DCSTypes#Distance: The radius of the zone.

ZONE_RADIUS:GetRandomCoordinate(inner, outer)

Returns a Point#COORDINATE object reflecting a random 3D location within the zone.

Parameters

  • #number inner : (optional) Minimal distance from the center of the zone. Default is 0.

  • #number outer : (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.

Return value

Core.Point#COORDINATE:

ZONE_RADIUS:GetRandomPointVec2(inner, outer)

Returns a Point#POINT_VEC2 object reflecting a random 2D location within the zone.

Parameters

  • #number inner : (optional) Minimal distance from the center of the zone. Default is 0.

  • #number outer : (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.

Return value

Core.Point#POINT_VEC2: The Point#POINT_VEC2 object reflecting the random 3D location within the zone.

ZONE_RADIUS:GetRandomPointVec3(inner, outer)

Returns a Point#POINT_VEC3 object reflecting a random 3D location within the zone.

Parameters

  • #number inner : (optional) Minimal distance from the center of the zone. Default is 0.

  • #number outer : (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.

Return value

Core.Point#POINT_VEC3: The Point#POINT_VEC3 object reflecting the random 3D location within the zone.

ZONE_RADIUS:GetRandomVec2(inner, outer)

Returns a random Vec2 location within the zone.

Parameters

  • #number inner : (optional) Minimal distance from the center of the zone. Default is 0.

  • #number outer : (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.

Return value

Dcs.DCSTypes#Vec2: The random location within the zone.

ZONE_RADIUS:GetRandomVec3(inner, outer)

Returns Returns a random Vec3 location within the zone.

Parameters

  • #number inner : (optional) Minimal distance from the center of the zone. Default is 0.

  • #number outer : (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.

Return value

Dcs.DCSTypes#Vec3: The random location within the zone.

ZONE_RADIUS:GetScannedCoalition(Coalition)

Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone.

Returns nil if there are none ot two Coalitions in the zone! Returns one Coalition if there are only Units of one Coalition in the Zone. Returns the Coalition for the given Coalition if there are units of the Coalition in the Zone

Parameter

  • Coalition :

Return value

#table:

ZONE_RADIUS:GetScannedScenery()
ZONE_RADIUS:GetScannedSceneryType(SceneryType)

Parameter

  • SceneryType :

ZONE_RADIUS:GetScannedUnits()
ZONE_RADIUS:GetVec2()

Returns the DCSTypes#Vec2 of the zone.

Return value

Dcs.DCSTypes#Vec2: The location of the zone.

ZONE_RADIUS:GetVec3(Height)

Returns the DCSTypes#Vec3 of the ZONE_RADIUS.

Parameter

  • Dcs.DCSTypes#Distance Height : The height to add to the land height where the center of the zone is located.

Return value

Dcs.DCSTypes#Vec3: The point of the zone.

ZONE_RADIUS:IsAllInZoneOfCoalition(Coalition)

Is All in Zone of Coalition?

Parameter

  • Coalition :

Return value

#boolean:

Usage:

   self.Zone:Scan()
   local IsGuarded = self.Zone:IsAllInZoneOfCoalition( self.Coalition )
ZONE_RADIUS:IsAllInZoneOfOtherCoalition(Coalition)

Is All in Zone of Other Coalition?

You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.

Parameter

  • Coalition :

Return value

#boolean:

Usage:

   self.Zone:Scan()
   local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition )
ZONE_RADIUS:IsNoneInZone()

Is None in Zone?

You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.

Return value

#boolean:

Usage:

   self.Zone:Scan()
   local IsEmpty = self.Zone:IsNoneInZone()
ZONE_RADIUS:IsNoneInZoneOfCoalition(Coalition)

Is None in Zone of Coalition?

You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.

Parameter

  • Coalition :

Return value

#boolean:

Usage:

   self.Zone:Scan()
   local IsOccupied = self.Zone:IsNoneInZoneOfCoalition( self.Coalition )
ZONE_RADIUS:IsSomeInZoneOfCoalition(Coalition)

Is Some in Zone of Coalition?

You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.

Parameter

  • Coalition :

Return value

#boolean:

Usage:

   self.Zone:Scan()
   local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition )
ZONE_RADIUS:IsVec2InZone(Vec2)

Returns if a location is within the zone.

Parameter

Return value

#boolean: true if the location is within the zone.

ZONE_RADIUS:IsVec3InZone(Vec3)

Returns if a point is within the zone.

Parameter

Return value

#boolean: true if the point is within the zone.

ZONE_RADIUS:New(ZoneName, Vec2, Radius)

Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius.

Parameters

Return value

#ZONE_RADIUS: self

Dcs.DCSTypes#Distance ZONE_RADIUS.Radius

The radius of the zone.

ZONE_RADIUS:Scan(ObjectCategories, Coalition)

Scan the zone for the presence of units of the given ObjectCategories.

Note that after a zone has been scanned, the zone can be evaluated by:

Parameters

  • ObjectCategories :

  • Coalition :

Usage:

   self.Zone:Scan()
   local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition )
ZONE_RADIUS.ScanData
ZONE_RADIUS:SearchZone(ObjectCategories, EvaluateFunction)

Searches the zone

Parameters

  • ObjectCategories : A list of categories, which are members of Object.Category

  • EvaluateFunction :

ZONE_RADIUS:SetRadius(Radius)

Sets the radius of the zone.

Parameter

Return value

Dcs.DCSTypes#Distance: The radius of the zone.

ZONE_RADIUS:SetVec2(Vec2)

Sets the DCSTypes#Vec2 of the zone.

Parameter

Return value

Dcs.DCSTypes#Vec2: The new location of the zone.

ZONE_RADIUS:SmokeZone(SmokeColor, Points, AddHeight, AddOffSet, AngleOffset)

Smokes the zone boundaries in a color.

Parameters

  • Utilities.Utils#SMOKECOLOR SmokeColor : The smoke color.

  • #number Points : (optional) The amount of points in the circle.

  • #number AddHeight : (optional) The height to be added for the smoke.

  • #number AddOffSet : (optional) The angle to be added for the smoking start position.

  • AngleOffset :

Return value

#ZONE_RADIUS: self

Dcs.DCSTypes#Vec2 ZONE_RADIUS.Vec2

The current location of the zone.

Type ZONE_UNIT

Field(s)

ZONE_UNIT:GetRandomVec2()

Returns a random location within the zone.

Return value

Dcs.DCSTypes#Vec2: The random location within the zone.

ZONE_UNIT:GetVec2()

Returns the current location of the Unit#UNIT.

Return value

Dcs.DCSTypes#Vec2: The location of the zone based on the Unit#UNITlocation.

ZONE_UNIT:GetVec3(Height)

Returns the DCSTypes#Vec3 of the ZONE_UNIT.

Parameter

  • Dcs.DCSTypes#Distance Height : The height to add to the land height where the center of the zone is located.

Return value

Dcs.DCSTypes#Vec3: The point of the zone.

ZONE_UNIT.LastVec2
ZONE_UNIT:New(ZoneName, ZoneUNIT, Radius)

Constructor to create a ZONE_UNIT instance, taking the zone name, a zone unit and a radius.

Parameters

Return value

#ZONE_UNIT: self

Wrapper.Unit#UNIT ZONE_UNIT.ZoneUNIT