Module Core.Zone
Core - Define zones within your mission of various forms, with various capabilities.
Features:
- Create radius zones.
- Create trigger zones.
- Create polygon zones.
- Create moving zones around a unit.
- Create moving zones around a group.
- Provide the zone behavior. Some zones are static, while others are moveable.
- Enquire if a coordinate is within a zone.
- Smoke zones.
- Set a zone probability to control zone selection.
- Get zone coordinates.
- Get zone properties.
- Get zone bounding box.
- Set/get zone name.
- Draw zones (circular and polygon) on the F10 map.
There are essentially two core functions that zones accommodate:
- Test if an object is within the zone boundaries.
- Provide the zone behavior. 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 Wrapper.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 Wrapper.Unit#UNIT with a radius.
- #ZONE_GROUP: The ZONE_GROUP class defines by a zone around a Wrapper.Group#GROUP with a radius.
- #ZONE_POLYGON: The ZONE_POLYGON class defines by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon.
- #ZONE_OVAL: The ZONE_OVAL class is defined by a center point, major axis, minor axis, and angle.
Demo Missions
Author: FlightControl
Contributions: Applevangelist, FunkyFranky, coconutcockpit
Global(s)
Global ZONE |
The ZONE class, defined by the zone name as defined within the Mission Editor. |
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 Core.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!!!
Global ZONE_AIRBASE |
The ZONE_AIRBASE class defines by a zone around a Wrapper.Airbase#AIRBASE with a radius. |
The ZONE_AIRBASE class defines by a zone around a Wrapper.Airbase#AIRBASE with a radius.
This class implements the inherited functions from #ZONE_RADIUS taking into account the own zone format and properties.
Global ZONE_BASE |
This class is an abstract BASE class for derived classes, and is not meant to be instantiated. |
This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
Each zone has a name:
- ZONE_BASE.GetName(): Returns the name of the zone.
- ZONE_BASE.SetName(): Sets the name of the zone.
Each zone implements two polymorphic functions defined in #ZONE_BASE:
- ZONE_BASE.IsVec2InZone(): Returns if a 2D vector is within the zone.
- ZONE_BASE.IsVec3InZone(): Returns if a 3D vector is within the zone.
- ZONE_BASE.IsPointVec2InZone(): Returns if a 2D point vector is within the zone.
- ZONE_BASE.IsPointVec3InZone(): Returns if a 3D point vector is within the zone.
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:
- ZONE_BASE.GetVec2(): Returns the 2D vector coordinate of the zone.
- ZONE_BASE.GetVec3(): Returns the 3D vector coordinate of the zone.
- ZONE_BASE.GetPointVec2(): Returns the 2D point vector coordinate of the zone.
- ZONE_BASE.GetPointVec3(): Returns the 3D point vector coordinate of the zone.
- ZONE_BASE.GetRandomVec2(): Define a random 2D vector within the zone.
- ZONE_BASE.GetRandomPointVec2(): Define a random 2D point vector within the zone.
- ZONE_BASE.GetRandomPointVec3(): Define a random 3D point vector within the zone.
A zone has a bounding square:
- ZONE_BASE.GetBoundingSquare(): Get the outer most bounding square of the zone.
A zone can be marked:
- ZONE_BASE.SmokeZone(): Smokes the zone boundaries in a color.
- ZONE_BASE.FlareZone(): Flares the zone boundaries in a color.
A zone might have additional Properties created in the DCS Mission Editor, which can be accessed:
*ZONE_BASE.GetProperty(): Returns the Value of the zone with the given PropertyName, or nil if no matching property exists. *ZONE_BASE.GetAllProperties(): Returns the zone Properties table.
Global ZONE_ELASTIC |
The ZONE_ELASTIC class defines a dynamic polygon zone, where only the convex hull is used. |
The ZONE_ELASTIC class defines a dynamic polygon zone, where only the convex hull is used.
Global ZONE_GROUP |
The ZONE_GROUP class defines by a zone around a Wrapper.Group#GROUP with a radius. |
The ZONE_GROUP class defines by a zone around a Wrapper.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_RADIUS taking into account the own zone format and properties.
Global ZONE_OVAL |
ZONE_OVAL class, extends #ZONE_BASEThe ZONE_OVAL class is defined by a center point, major axis, minor axis, and angle. |
ZONE_OVAL class, extends #ZONE_BASE
The ZONE_OVAL class is defined by a center point, major axis, minor axis, and angle.
This class implements the inherited functions from #ZONE_BASE taking into account the own zone format and properties.
Global ZONE_POLYGON |
The ZONE_POLYGON class defined by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon, OR by drawings made with the Draw tool - in the Mission Editor This class implements the inherited functions from #ZONE_RADIUS taking into account the own zone format and properties. |
The ZONE_POLYGON class defined by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon, OR by drawings made with the Draw tool - in the Mission Editor This class implements the inherited functions from #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 ZONE_POLYGON using the DCS mission editor by adding the #ZONE_POLYGON 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 ZONE_POLYGON declaration.
Within the background, a ZONE_POLYGON object will be created within the Core.Database using the properties of the group.
The ZONE_POLYGON name will be the group name without the #ZONE_POLYGON 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 SET_ZONE...
So when you would declare local SetZone = SET_ZONE:New():FilterPrefixes( "Defense" ):FilterStart()
,
then SetZone would contain the ZONE_POLYGON object DefenseZone
as part of the zone collection,
without much scripting overhead!
This class now also supports drawings made with the Draw tool in the Mission Editor. Any drawing made with Line > Segments > Closed, Polygon > Rect or Polygon > Free can be made into a ZONE_POLYGON.
This class has been updated to use a accurate way of generating random points inside the polygon without having to use trial and error guesses. You can also get the surface area of the polygon now, handy if you want measure which coalition has the largest captured area, for example.
Global ZONE_POLYGON_BASE |
The ZONE_POLYGON_BASE class defined by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon. |
The ZONE_POLYGON_BASE class defined by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon.
This class implements the inherited functions from #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_POLYGON_BASE.GetRandomVec2(): Gets a random 2D point in the zone.
- ZONE_POLYGON_BASE.GetRandomPointVec2(): Return a Core.Point#POINT_VEC2 object representing a random 2D point within the zone.
- ZONE_POLYGON_BASE.GetRandomPointVec3(): Return a Core.Point#POINT_VEC3 object representing a random 3D point at landheight within the zone.
Draw zone
- ZONE_POLYGON_BASE.DrawZone(): Draws the zone on the F10 map.
- ZONE_POLYGON_BASE.Boundary(): Draw a frontier on the F10 map with small filled circles.
Global ZONE_RADIUS |
The ZONE_RADIUS class defined by a zone name, a location and a radius. |
The ZONE_RADIUS class defined by a zone name, a location and a radius.
This class implements the inherited functions from #ZONE_BASE taking into account the own zone format and properties.
ZONE_RADIUS constructor
- ZONE_RADIUS.New(): Constructor.
Manage the radius of the zone
- ZONE_RADIUS.SetRadius(): Sets the radius of the zone.
- ZONE_RADIUS.GetRadius(): Returns the radius of the zone.
Manage the location of the zone
- ZONE_RADIUS.SetVec2(): Sets the DCS#Vec2 of the zone.
- ZONE_RADIUS.GetVec2(): Returns the DCS#Vec2 of the zone.
- ZONE_RADIUS.GetVec3(): Returns the DCS#Vec3 of the zone, taking an additional height parameter.
Zone point randomization
Various functions exist to find random points within the zone.
- ZONE_RADIUS.GetRandomVec2(): Gets a random 2D point in the zone.
- ZONE_RADIUS.GetRandomPointVec2(): Gets a Core.Point#POINT_VEC2 object representing a random 2D point in the zone.
- ZONE_RADIUS.GetRandomPointVec3(): Gets a Core.Point#POINT_VEC3 object representing a random 3D point in the zone. Note that the height of the point is at landheight.
Draw zone
- ZONE_RADIUS.DrawZone(): Draws the zone on the F10 map.
Global ZONE_UNIT |
ZONE_UNIT class, extends #ZONE_RADIUSThe ZONE_UNIT class defined by a zone attached to a Wrapper.Unit#UNIT with a radius and optional offsets. |
ZONE_UNIT class, extends #ZONE_RADIUS
The ZONE_UNIT class defined by a zone attached to a Wrapper.Unit#UNIT with a radius and optional offsets.
This class implements the inherited functions from #ZONE_RADIUS taking into account the own zone format and properties.
Global _ZONE_TRIANGLE |
ZONETRIANGLE class, extends #ZONE_BASEZONETRIANGLE class is a helper class for ZONE_POLYGON This class implements the inherited functions from #ZONE_BASE taking into account the own zone format and properties. |
ZONETRIANGLE class, extends #ZONE_BASE
ZONETRIANGLE class is a helper class for ZONE_POLYGON This class implements the inherited functions from #ZONE_BASE taking into account the own zone format and properties.
Type(s)
Fields and Methods inherited from ZONE | Description |
---|---|
Find a zone in the _DATABASE using the name of the zone. |
|
Constructor of ZONE taking the zone name. |
Fields and Methods inherited from ZONE_AIRBASE | Description |
---|---|
Get the airbase as part of the ZONE_AIRBASE object. |
|
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone. |
|
Returns the current location of the AIRBASE. |
|
Constructor to create a ZONE_AIRBASE instance, taking the zone name, a zone Wrapper.Airbase#AIRBASE and a radius. |
|
If |
|
If |
|
If |
Fields and Methods inherited from ZONE_BASE | Description |
---|---|
Bound the zone boundaries with a tires. |
|
Check every Checktime seconds, used for ZONE:Trigger() |
|
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value. |
|
Unique ID of the drawn zone on the F10 map. |
|
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value. |
|
Get 2D distance to a coordinate. |
|
Returns the zone Properties table. |
|
Get the bounding square the zone. |
|
Get color table of the zone. |
|
Get transparency Alpha value of zone. |
|
Get RGB color of zone. |
|
Returns a Core.Point#COORDINATE of the zone. |
|
Get draw coalition of zone. |
|
Get ID of the zone object drawn on the F10 map. |
|
Get fill color table of the zone. |
|
Get transparency Alpha fill value of zone. |
|
Get RGB fill color of zone. |
|
Returns the name of the zone. |
|
Returns a Core.Point#POINT_VEC2 of the zone. |
|
Returns a Core.Point#POINT_VEC3 of the zone. |
|
Returns the Value of the zone with the given PropertyName, or nil if no matching property exists. |
|
Define a random Core.Point#POINT_VEC2 within the zone. |
|
Define a random Core.Point#POINT_VEC3 within the zone. |
|
Define a random DCS#Vec2 within the zone. |
|
Get surface type of the zone. |
|
Returns the DCS#Vec2 coordinate of the zone. |
|
Returns the DCS#Vec3 of the zone. |
|
Get the zone taking into account the randomization probability of a zone to be selected. |
|
Get the randomization probability of a zone to be selected. |
|
Returns if a Coordinate is within the zone. |
|
Returns if a PointVec2 is within the zone. |
|
Returns if a PointVec3 is within the zone. |
|
Returns if a Vec2 is within the zone. |
|
Returns if a Vec3 is within the zone. |
|
ZONE_BASE constructor |
|
On After "EnteredZone" event. |
|
On After "LeftZone" event. |
|
Set the check time for ZONE:Trigger() |
|
Set color of zone. |
|
Set draw coalition of zone. |
|
Set fill color of zone. |
|
Sets the name of the zone. |
|
Set the randomization probability of a zone to be selected. |
|
Smokes the zone boundaries in a color. |
|
Type of surface. Only determined at the center of the zone! |
|
of any trigger zone properties from the ME. The key is the Name of the property, and the value is the property's Value. |
|
Start watching if the Object or Objects move into or out of a zone. |
|
Triggers the FSM event "TriggerStop". |
|
Remove the drawing of the zone from the F10 map. |
|
ID of zone. Only zones defined in the ME have an ID! |
|
Name of the zone. |
|
A value between 0 and 1. 0 = 0% and 1 = 100% probability. |
|
(Internal) Check the assigned objects for being in/out of the zone |
|
Triggers the FSM event "TriggerStop" after a delay. |
|
Draw coalition. |
|
(Internal) Check the assigned objects for being in/out of the zone |
Fields and Methods inherited from FSM | Description |
---|---|
Adds an End state. |
|
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task. |
|
Adds a score for the FSM to be achieved. |
|
ZONE_BASE:AddScoreProcess(From, Event, State, ScoreText, Score) |
Adds a score for the FSM_PROCESS to be achieved. |
Add a new transition rule to the FSM. |
|
Get current state. |
|
Returns the End states. |
|
Returns a table of the SubFSM rules defined within the FSM. |
|
Returns a table with the scores defined. |
|
Returns the start state of the FSM. |
|
Get current state. |
|
Returns a table with the Subs defined. |
|
Returns a table of the transition rules defined within the FSM. |
|
Check if FSM is in state. |
|
Load call backs. |
|
Creates a new FSM object. |
|
Sets the start state of the FSM. |
|
Add to map. |
|
Call handler. |
|
Create transition. |
|
Delayed transition. |
|
Event map. |
|
Go sub. |
|
Handler. |
|
Is end state. |
|
Sub maps. |
|
Check if can do an event. |
|
Check if cannot do an event. |
|
Check if FSM is in state. |
|
Fields and Methods inherited from ZONE_BASE.BoundingSquare | Description |
---|---|
The lower x coordinate (left down) |
|
The higher x coordinate (right up) |
|
The lower y coordinate (left down) |
|
The higher y coordinate (right up) |
Fields and Methods inherited from ZONE_ELASTIC | Description |
---|---|
Add a set of groups. |
|
Add a vertex (point) to the polygon. |
|
Add a vertex (point) to the polygon. |
|
Constructor to create a ZONE_ELASTIC instance. |
|
Start the updating scheduler. |
|
Stop the updating scheduler. |
|
Update the convex hull of the polygon. |
|
Create a convex hull. |
|
Points in 2D. |
|
Set of GROUPs. |
|
Set of OPSGROUPS. |
|
Set of UNITs. |
|
Scheduler ID for updating. |
Fields and Methods inherited from ZONE_GROUP | Description |
---|---|
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone. |
|
Returns a random location within the zone of the Wrapper.Group. |
|
Returns the current location of the Wrapper.Group. |
|
Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Wrapper.Group#GROUP and a radius. |
Fields and Methods inherited from ZONE_OVAL | Description |
---|---|
ZONE_OVAL:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly) |
Draw the zone on the F10 map. |
Gets the angle of the oval. |
|
Calculates the bounding box of the oval. |
|
Gets the major axis of the oval. |
|
Gets the minor axis of the oval. |
|
Define a random Core.Point#POINT_VEC2 within the zone. |
|
Define a random Core.Point#POINT_VEC2 within the zone. |
|
Returns a random Vec2 within the oval. |
|
Returns a the center point of the oval |
|
Checks if a point is contained within the oval. |
|
Creates a new ZONE_OVAL from a center point, major axis, minor axis, and angle. |
|
Constructor to create a ZONE_OVAL instance, taking the name of a drawing made with the draw tool in the Mission Editor. |
|
Find points on the edge of the oval |
|
Remove drawing from F10 map |
|
Fields and Methods inherited from ZONE_BASE | Description |
---|---|
Bound the zone boundaries with a tires. |
|
Check every Checktime seconds, used for ZONE:Trigger() |
|
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value. |
|
Unique ID of the drawn zone on the F10 map. |
|
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value. |
|
Get 2D distance to a coordinate. |
|
Returns the zone Properties table. |
|
Get the bounding square the zone. |
|
Get color table of the zone. |
|
Get transparency Alpha value of zone. |
|
Get RGB color of zone. |
|
Returns a Core.Point#COORDINATE of the zone. |
|
Get draw coalition of zone. |
|
Get ID of the zone object drawn on the F10 map. |
|
Get fill color table of the zone. |
|
Get transparency Alpha fill value of zone. |
|
Get RGB fill color of zone. |
|
Returns the name of the zone. |
|
Returns a Core.Point#POINT_VEC2 of the zone. |
|
Returns a Core.Point#POINT_VEC3 of the zone. |
|
Returns the Value of the zone with the given PropertyName, or nil if no matching property exists. |
|
Define a random Core.Point#POINT_VEC2 within the zone. |
|
Define a random Core.Point#POINT_VEC3 within the zone. |
|
Define a random DCS#Vec2 within the zone. |
|
Get surface type of the zone. |
|
Returns the DCS#Vec2 coordinate of the zone. |
|
Returns the DCS#Vec3 of the zone. |
|
Get the zone taking into account the randomization probability of a zone to be selected. |
|
Get the randomization probability of a zone to be selected. |
|
Returns if a Coordinate is within the zone. |
|
Returns if a PointVec2 is within the zone. |
|
Returns if a PointVec3 is within the zone. |
|
Returns if a Vec2 is within the zone. |
|
Returns if a Vec3 is within the zone. |
|
ZONE_BASE constructor |
|
On After "EnteredZone" event. |
|
On After "LeftZone" event. |
|
Set the check time for ZONE:Trigger() |
|
Set color of zone. |
|
Set draw coalition of zone. |
|
Set fill color of zone. |
|
Sets the name of the zone. |
|
Set the randomization probability of a zone to be selected. |
|
Smokes the zone boundaries in a color. |
|
Type of surface. Only determined at the center of the zone! |
|
of any trigger zone properties from the ME. The key is the Name of the property, and the value is the property's Value. |
|
Start watching if the Object or Objects move into or out of a zone. |
|
Triggers the FSM event "TriggerStop". |
|
Remove the drawing of the zone from the F10 map. |
|
ID of zone. Only zones defined in the ME have an ID! |
|
Name of the zone. |
|
A value between 0 and 1. 0 = 0% and 1 = 100% probability. |
|
(Internal) Check the assigned objects for being in/out of the zone |
|
Triggers the FSM event "TriggerStop" after a delay. |
|
Draw coalition. |
|
(Internal) Check the assigned objects for being in/out of the zone |
Fields and Methods inherited from FSM | Description |
---|---|
Adds an End state. |
|
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task. |
|
Adds a score for the FSM to be achieved. |
|
ZONE_OVAL:AddScoreProcess(From, Event, State, ScoreText, Score) |
Adds a score for the FSM_PROCESS to be achieved. |
Add a new transition rule to the FSM. |
|
Get current state. |
|
Returns the End states. |
|
Returns a table of the SubFSM rules defined within the FSM. |
|
Returns a table with the scores defined. |
|
Returns the start state of the FSM. |
|
Get current state. |
|
Returns a table with the Subs defined. |
|
Returns a table of the transition rules defined within the FSM. |
|
Check if FSM is in state. |
|
Load call backs. |
|
Creates a new FSM object. |
|
Sets the start state of the FSM. |
|
Add to map. |
|
Call handler. |
|
Create transition. |
|
Delayed transition. |
|
Event map. |
|
Go sub. |
|
Handler. |
|
Is end state. |
|
Sub maps. |
|
Check if can do an event. |
|
Check if cannot do an event. |
|
Check if FSM is in state. |
|
Fields and Methods inherited from ZONE_POLYGON | Description |
---|---|
Check if a certain coalition is inside a scanned zone. |
|
Count the number of different coalitions inside the zone. |
|
Find a polygon zone in the _DATABASE using the name of the polygon zone. |
|
Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone. |
|
Get scanned scenery table |
|
Get scanned scenery table |
|
Get scanned scenery types |
|
Get a set of scanned units. |
|
Get scanned set of scenery objects |
|
Get a set of scanned units. |
|
Count the number of different coalitions inside the zone. |
|
Is All in Zone of Coalition? |
|
Is All in Zone of Other Coalition? |
|
Is None in Zone? |
|
Is None in Zone of Coalition? |
|
Is Some in Zone of Coalition? |
|
Constructor to create a ZONE_POLYGON instance, taking the zone name and the Wrapper.Group#GROUP defined within the Mission Editor. |
|
Constructor to create a ZONE_POLYGON instance, taking the name of a drawing made with the draw tool in the Mission Editor. |
|
Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Wrapper.Group#GROUP defined within the Mission Editor. |
|
Constructor to create a ZONE_POLYGON instance, taking the zone name and an array of DCS#Vec2, forming a polygon. |
|
Scan the zone for the presence of units of the given ObjectCategories. |
|
Fields and Methods inherited from ZONE_POLYGON_BASE | Description |
---|---|
Smokes the zone boundaries in a color. |
|
ZONE_POLYGON_BASE:Boundary(Coalition, Color, Radius, Alpha, Segments, Closed) |
Draw a frontier on the F10 map with small filled circles. |
Draw the zone on the F10 map. |
|
ZONE_POLYGON_BASE:FlareZone(FlareColor, Segments, Azimuth, AddHeight) |
Flare the zone boundaries in a color. |
Flush polygon coordinates as a table in DCS.log. |
|
Get the bounding square the zone. |
|
Get the bounding 2D vectors of the polygon. |
|
Get the smallest radius encompassing all points of the polygon zone. |
|
Return a Core.Point#COORDINATE object representing a random 3D point at landheight within the zone. |
|
Return a Core.Point#POINT_VEC2 object representing a random 2D point at landheight within the zone. |
|
Return a Core.Point#POINT_VEC3 object representing a random 3D point at landheight within the zone. |
|
Define a random DCS#Vec2 within the zone. |
|
Get the surface area of this polygon |
|
Returns the center location of the polygon. |
|
Get a vertex of the polygon. |
|
Get a vertex of the polygon. |
|
Get a vertex of the polygon. |
|
Get a list of verticies of the polygon. |
|
Get a list of verticies of the polygon. |
|
Get a list of verticies of the polygon. |
|
Get the smallest rectangular zone encompassing all points points of the polygon zone. |
|
ZONE_POLYGON_BASE:GetZoneRadius(ZoneName, DoNotRegisterZone) |
Get the smallest circular zone encompassing all points of the polygon zone. |
Returns if a location is within the zone. |
|
Returns if a point is within the zone. |
|
Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of DCS#Vec2, forming a polygon. |
|
The polygon defined by an array of DCS#Vec2. |
|
Change/Re-draw the border of a Polygon Zone |
|
Change/Re-fill a Polygon Zone |
|
Remove junk inside the zone. |
|
Smokes the zone boundaries in a color. |
|
Update polygon points with an array of DCS#Vec2. |
|
Update polygon points with an array of DCS#Vec3. |
|
Calculates the surface area of the polygon. |
|
Triangulates the polygon. |
Fields and Methods inherited from ZONE_RADIUS | Description |
---|---|
Bounds the zone with tires. |
|
Check if a certain coalition is inside a scanned zone. |
|
Count the number of different coalitions inside the zone. |
|
ZONE_RADIUS:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly) |
Draw the zone circle on the F10 map. |
ZONE_RADIUS:FlareZone(FlareColor, Points, Azimuth, AddHeight) |
Flares the zone boundaries in a color. |
Returns the radius of the zone. |
|
Returns a Core.Point#COORDINATE object reflecting a random 3D location within the zone. |
|
ZONE_RADIUS:GetRandomCoordinateWithoutBuildings(inner, outer, distance, markbuildings, markfinal) |
Returns a Core.Point#COORDINATE object reflecting a random location within the zone where there are no map objects of type "Building". |
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone. |
|
Returns a Core.Point#POINT_VEC3 object reflecting a random 3D location within the zone. |
|
Returns a random Vec2 location within the zone. |
|
Returns Returns a random Vec3 location within the zone. |
|
Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone. |
|
Get scanned scenery table |
|
Get table of scanned scenery objects |
|
Get scanned scenery type |
|
Get a set of scanned groups. |
|
Get set of scanned scenery objects |
|
Get a set of scanned units. |
|
Get a table of scanned units. |
|
Returns the DCS#Vec2 of the zone. |
|
Returns the DCS#Vec3 of the ZONE_RADIUS. |
|
Is All in Zone of Coalition? |
|
Is All in Zone of Other Coalition? |
|
Is None in Zone? |
|
Is None in Zone of Coalition? |
|
Is Some in Zone of Coalition? |
|
Returns if a location is within the zone. |
|
Returns if a point is within the zone. |
|
Mark the zone with markers on the F10 map. |
|
Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius. |
|
The radius of the zone. |
|
Remove junk inside the zone using the |
|
Scan the zone for the presence of units of the given ObjectCategories. |
|
Searches the zone |
|
Sets the radius of the zone. |
|
Sets the DCS#Vec2 of the zone. |
|
ZONE_RADIUS:SmokeZone(SmokeColor, Points, AddHeight, AddOffSet, AngleOffset) |
Smokes the zone boundaries in a color. |
Update zone from a 2D vector. |
|
Update zone from a 2D vector. |
|
The current location of the zone. |
Fields and Methods inherited from ZONE_UNIT | Description |
---|---|
Returns a random location within the zone. |
|
Returns the current location of the Wrapper.Unit#UNIT. |
|
Returns the DCS#Vec3 of the ZONE_UNIT. |
|
Constructor to create a ZONE_UNIT instance, taking the zone name, a zone unit and a radius and optional offsets in X and Y directions. |
|
Fields and Methods inherited from ZONE_RADIUS | Description |
---|---|
Bounds the zone with tires. |
|
Check if a certain coalition is inside a scanned zone. |
|
Count the number of different coalitions inside the zone. |
|
ZONE_UNIT:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly) |
Draw the zone circle on the F10 map. |
Flares the zone boundaries in a color. |
|
Returns the radius of the zone. |
|
Returns a Core.Point#COORDINATE object reflecting a random 3D location within the zone. |
|
ZONE_UNIT:GetRandomCoordinateWithoutBuildings(inner, outer, distance, markbuildings, markfinal) |
Returns a Core.Point#COORDINATE object reflecting a random location within the zone where there are no map objects of type "Building". |
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone. |
|
Returns a Core.Point#POINT_VEC3 object reflecting a random 3D location within the zone. |
|
Returns a random Vec2 location within the zone. |
|
Returns Returns a random Vec3 location within the zone. |
|
Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone. |
|
Get scanned scenery table |
|
Get table of scanned scenery objects |
|
Get scanned scenery type |
|
Get a set of scanned groups. |
|
Get set of scanned scenery objects |
|
Get a set of scanned units. |
|
Get a table of scanned units. |
|
Returns the DCS#Vec2 of the zone. |
|
Returns the DCS#Vec3 of the ZONE_RADIUS. |
|
Is All in Zone of Coalition? |
|
Is All in Zone of Other Coalition? |
|
Is None in Zone? |
|
Is None in Zone of Coalition? |
|
Is Some in Zone of Coalition? |
|
Returns if a location is within the zone. |
|
Returns if a point is within the zone. |
|
Mark the zone with markers on the F10 map. |
|
Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius. |
|
The radius of the zone. |
|
Remove junk inside the zone using the |
|
Scan the zone for the presence of units of the given ObjectCategories. |
|
Searches the zone |
|
Sets the radius of the zone. |
|
Sets the DCS#Vec2 of the zone. |
|
ZONE_UNIT:SmokeZone(SmokeColor, Points, AddHeight, AddOffSet, AngleOffset) |
Smokes the zone boundaries in a color. |
Update zone from a 2D vector. |
|
Update zone from a 2D vector. |
|
The current location of the zone. |
Fields and Methods inherited from _ZONE_TRIANGLE | Description |
---|---|
Checks if a point is contained within the triangle. |
|
_ZONE_TRIANGLE:Draw(Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly) |
Draw the triangle |
_ZONE_TRIANGLE:Fill(Coalition, FillColor, FillAlpha, ReadOnly) |
Draw the triangle |
Returns a random Vec2 within the triangle. |
|
Fields and Methods inherited from ZONE_BASE | Description |
---|---|
Bound the zone boundaries with a tires. |
|
Check every Checktime seconds, used for ZONE:Trigger() |
|
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value. |
|
Unique ID of the drawn zone on the F10 map. |
|
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value. |
|
Get 2D distance to a coordinate. |
|
Returns the zone Properties table. |
|
Get the bounding square the zone. |
|
Get color table of the zone. |
|
Get transparency Alpha value of zone. |
|
Get RGB color of zone. |
|
Returns a Core.Point#COORDINATE of the zone. |
|
Get draw coalition of zone. |
|
Get ID of the zone object drawn on the F10 map. |
|
Get fill color table of the zone. |
|
Get transparency Alpha fill value of zone. |
|
Get RGB fill color of zone. |
|
Returns the name of the zone. |
|
Returns a Core.Point#POINT_VEC2 of the zone. |
|
Returns a Core.Point#POINT_VEC3 of the zone. |
|
Returns the Value of the zone with the given PropertyName, or nil if no matching property exists. |
|
Define a random Core.Point#POINT_VEC2 within the zone. |
|
Define a random Core.Point#POINT_VEC3 within the zone. |
|
Define a random DCS#Vec2 within the zone. |
|
Get surface type of the zone. |
|
Returns the DCS#Vec2 coordinate of the zone. |
|
Returns the DCS#Vec3 of the zone. |
|
Get the zone taking into account the randomization probability of a zone to be selected. |
|
Get the randomization probability of a zone to be selected. |
|
Returns if a Coordinate is within the zone. |
|
Returns if a PointVec2 is within the zone. |
|
Returns if a PointVec3 is within the zone. |
|
Returns if a Vec2 is within the zone. |
|
Returns if a Vec3 is within the zone. |
|
ZONE_BASE constructor |
|
_ZONE_TRIANGLE:OnAfterEnteredZone(From, Event, To, Controllable) |
On After "EnteredZone" event. |
_ZONE_TRIANGLE:OnAfterLeftZone(From, Event, To, Controllable) |
On After "LeftZone" event. |
Set the check time for ZONE:Trigger() |
|
Set color of zone. |
|
Set draw coalition of zone. |
|
Set fill color of zone. |
|
Sets the name of the zone. |
|
Set the randomization probability of a zone to be selected. |
|
Smokes the zone boundaries in a color. |
|
Type of surface. Only determined at the center of the zone! |
|
of any trigger zone properties from the ME. The key is the Name of the property, and the value is the property's Value. |
|
Start watching if the Object or Objects move into or out of a zone. |
|
Triggers the FSM event "TriggerStop". |
|
Remove the drawing of the zone from the F10 map. |
|
ID of zone. Only zones defined in the ME have an ID! |
|
Name of the zone. |
|
A value between 0 and 1. 0 = 0% and 1 = 100% probability. |
|
(Internal) Check the assigned objects for being in/out of the zone |
|
Triggers the FSM event "TriggerStop" after a delay. |
|
Draw coalition. |
|
(Internal) Check the assigned objects for being in/out of the zone |
Fields and Methods inherited from FSM | Description |
---|---|
Adds an End state. |
|
_ZONE_TRIANGLE:AddProcess(From, Event, Process, ReturnEvents) |
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task. |
Adds a score for the FSM to be achieved. |
|
_ZONE_TRIANGLE:AddScoreProcess(From, Event, State, ScoreText, Score) |
Adds a score for the FSM_PROCESS to be achieved. |
Add a new transition rule to the FSM. |
|
Get current state. |
|
Returns the End states. |
|
Returns a table of the SubFSM rules defined within the FSM. |
|
Returns a table with the scores defined. |
|
Returns the start state of the FSM. |
|
Get current state. |
|
Returns a table with the Subs defined. |
|
Returns a table of the transition rules defined within the FSM. |
|
Check if FSM is in state. |
|
Load call backs. |
|
Creates a new FSM object. |
|
Sets the start state of the FSM. |
|
Add to map. |
|
_ZONE_TRIANGLE:_call_handler(step, trigger, params, EventName) |
Call handler. |
Create transition. |
|
Delayed transition. |
|
Event map. |
|
Go sub. |
|
Handler. |
|
Is end state. |
|
Sub maps. |
|
Check if can do an event. |
|
Check if cannot do an event. |
|
Check if FSM is in state. |
|
Field(s)
Function(s)
Find a zone in the _DATABASE using the name of the zone.
Constructor of ZONE taking the zone name.
Defined in:
ZONE
Parameter:
#string ZoneName
The name of the zone as defined within the mission editor.
Return value:
self
Field(s)
If true
, airbase is an airdrome.
If true
, airbase is a helipad.
If true
, airbase is a ship.
Function(s)
Get the airbase as part of the ZONE_AIRBASE object.
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Defined in:
ZONE_AIRBASE
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:
The Core.Point#POINT_VEC2 object reflecting the random 3D location within the zone.
Returns the current location of the AIRBASE.
Defined in:
ZONE_AIRBASE
Return value:
The location of the zone based on the AIRBASE location.
Constructor to create a ZONE_AIRBASE instance, taking the zone name, a zone Wrapper.Airbase#AIRBASE and a radius.
Defined in:
ZONE_AIRBASE
Parameters:
#string AirbaseName
Name of the airbase.
DCS#Distance Radius
(Optional)The radius of the zone in meters. Default 4000 meters.
Return value:
self
Field(s)
Check every Checktime seconds, used for ZONE:Trigger()
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Create a new coordinate object.
Unique ID of the drawn zone on the F10 map.
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Type of surface. Only determined at the center of the zone!
of any trigger zone properties from the ME. The key is the Name of the property, and the value is the property's Value.
ID of zone. Only zones defined in the ME have an ID!
Name of the zone.
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Draw coalition.
Function(s)
Get 2D distance to a coordinate.
Defined in:
ZONE_BASE
Parameter:
Core.Point#COORDINATE Coordinate
Reference coordinate. Can also be a DCS#Vec2 or DCS#Vec3 object.
Return value:
#number:
Distance to the reference coordinate in meters.
Returns the zone Properties table.
Defined in:
ZONE_BASE
Return value:
#table:
The Key:Value table of TriggerZone properties of the zone.
Get the bounding square the zone.
Defined in:
ZONE_BASE
Return value:
#nil:
The bounding square.
Get color table of the zone.
Defined in:
ZONE_BASE
Return value:
#table:
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Get transparency Alpha value of zone.
Defined in:
ZONE_BASE
Return value:
#number:
Alpha value.
Get RGB color of zone.
Defined in:
ZONE_BASE
Return value:
#table:
Table with three entries, e.g. {1, 0, 0}, which is the RGB color code.
Returns a Core.Point#COORDINATE of the zone.
Defined in:
ZONE_BASE
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The Coordinate of the zone.
Get draw coalition of zone.
Defined in:
ZONE_BASE
Return value:
#number:
Draw coalition.
Get ID of the zone object drawn on the F10 map.
The ID can be used to remove the drawn object from the F10 map view via UTILS.RemoveMark(MarkID)
.
Defined in:
ZONE_BASE
Return value:
#number:
Unique ID of the
Get fill color table of the zone.
Defined in:
ZONE_BASE
Return value:
#table:
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Get transparency Alpha fill value of zone.
Defined in:
ZONE_BASE
Return value:
#number:
Alpha value.
Get RGB fill color of zone.
Defined in:
ZONE_BASE
Return value:
#table:
Table with three entries, e.g. {1, 0, 0}, which is the RGB color code.
Returns the name of the zone.
Defined in:
ZONE_BASE
Return value:
#string:
The name of the zone.
Returns a Core.Point#POINT_VEC2 of the zone.
Defined in:
ZONE_BASE
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The PointVec2 of the zone.
Returns a Core.Point#POINT_VEC3 of the zone.
Defined in:
ZONE_BASE
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The PointVec3 of the zone.
Returns the Value of the zone with the given PropertyName, or nil if no matching property exists.
Defined in:
ZONE_BASE
Parameter:
#string PropertyName
The name of a the TriggerZone Property to be retrieved.
Return value:
#string:
The Value of the TriggerZone Property with the given PropertyName, or nil if absent.
Usage:
local PropertiesZone = ZONE:FindByName("Properties Zone")
local Property = "ExampleProperty"
local PropertyValue = PropertiesZone:GetProperty(Property)
Define a random Core.Point#POINT_VEC2 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Define a random Core.Point#POINT_VEC3 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Define a random DCS#Vec2 within the zone.
Get surface type of the zone.
Returns the DCS#Vec2 coordinate of the zone.
Defined in:
ZONE_BASE
Return value:
#nil:
Returns the DCS#Vec3 of the zone.
Defined in:
ZONE_BASE
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The Vec3 of the zone.
Get the zone taking into account the randomization probability of a zone to be selected.
Defined in:
ZONE_BASE
Return values:
The zone is selected taking into account the randomization probability factor.
#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.
Get the randomization probability of a zone to be selected.
Defined in:
ZONE_BASE
Return value:
#number:
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Returns if a Coordinate is within the zone.
Defined in:
ZONE_BASE
Parameter:
Core.Point#COORDINATE Coordinate
The coordinate to test.
Return value:
#boolean:
true if the coordinate is within the zone.
Returns if a PointVec2 is within the zone.
(Name is misleading, actually takes a #COORDINATE)
Defined in:
ZONE_BASE
Parameter:
Core.Point#COORDINATE Coordinate
The coordinate to test.
Return value:
#boolean:
true if the PointVec2 is within the zone.
Returns if a PointVec3 is within the zone.
Defined in:
ZONE_BASE
Parameter:
Core.Point#POINT_VEC3 PointVec3
The PointVec3 to test.
Return value:
#boolean:
true if the PointVec3 is within the zone.
Returns if a Vec2 is within the zone.
Defined in:
ZONE_BASE
Parameter:
DCS#Vec2 Vec2
The Vec2 to test.
Return value:
#boolean:
true if the Vec2 is within the zone.
Returns if a Vec3 is within the zone.
Defined in:
ZONE_BASE
Parameter:
DCS#Vec3 Vec3
The point to test.
Return value:
#boolean:
true if the Vec3 is within the zone.
ZONE_BASE constructor
On After "EnteredZone" event.
An observed object has entered the zone.
Defined in:
ZONE_BASE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Controllable#CONTROLLABLE Controllable
The controllable entering the zone.
On After "LeftZone" event.
An observed object has left the zone.
Defined in:
ZONE_BASE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Controllable#CONTROLLABLE Controllable
The controllable leaving the zone.
Set the check time for ZONE:Trigger()
Defined in:
ZONE_BASE
Parameter:
#number seconds
Check every seconds for objects entering or leaving the zone. Defaults to 5 secs.
Return value:
self
Set color of zone.
Defined in:
ZONE_BASE
Parameters:
#table RGBcolor
RGB color table. Default {1, 0, 0}
.
#number Alpha
Transparency between 0 and 1. Default 0.15.
Return value:
self
Set draw coalition of zone.
Defined in:
ZONE_BASE
Parameter:
#number Coalition
Coalition. Default -1.
Return value:
self
Set fill color of zone.
Defined in:
ZONE_BASE
Parameters:
#table RGBcolor
RGB color table. Default {1, 0, 0}
.
#number Alpha
Transparacy between 0 and 1. Default 0.15.
Return value:
self
Sets the name of the zone.
Set the randomization probability of a zone to be selected.
Defined in:
ZONE_BASE
Parameter:
#number ZoneProbability
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Return value:
self
Smokes the zone boundaries in a color.
Start watching if the Object or Objects move into or out of a zone.
Defined in:
ZONE_BASE
Parameter:
Object or Objects to watch, can be of type UNIT, GROUP, CLIENT, or SET_UNIT, SET_GROUP, SET_CLIENT
Return value:
self
Usage:
-- Create a new zone and start watching it every 5 secs for a defined GROUP entering or leaving
local triggerzone = ZONE:New("ZonetoWatch"):Trigger(GROUP:FindByName("Aerial-1"))
-- This FSM function will be called when the group enters the zone
function triggerzone:OnAfterEnteredZone(From,Event,To,Group)
MESSAGE:New("Group has entered zone!",15):ToAll()
end
-- This FSM function will be called when the group leaves the zone
function triggerzone:OnAfterLeftZone(From,Event,To,Group)
MESSAGE:New("Group has left zone!",15):ToAll()
end
-- Stop watching the zone after 1 hour
triggerzone:__TriggerStop(3600)
Triggers the FSM event "TriggerStop".
Stops the ZONE_BASE Trigger.
Defined in:
ZONE_BASE
Remove the drawing of the zone from the F10 map.
Defined in:
ZONE_BASE
Parameter:
#number Delay
(Optional) Delay before the drawing is removed.
Return value:
self
(Internal) Check the assigned objects for being in/out of the zone
Defined in:
ZONE_BASE
Parameter:
#boolean fromstart
If true, do the init of the objects
Return value:
self
Triggers the FSM event "TriggerStop" after a delay.
Defined in:
ZONE_BASE
Parameter:
#number delay
Delay in seconds.
(Internal) Check the assigned objects for being in/out of the zone
Defined in:
ZONE_BASE
Parameters:
#string From
#string Event
#string to
To
Return value:
self
Field(s)
Check every Checktime seconds, used for ZONE:Trigger()
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Create a new coordinate object.
Unique ID of the drawn zone on the F10 map.
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Type of surface. Only determined at the center of the zone!
of any trigger zone properties from the ME. The key is the Name of the property, and the value is the property's Value.
ID of zone. Only zones defined in the ME have an ID!
Name of the zone.
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Draw coalition.
Function(s)
Adds an End state.
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
Core.Fsm#FSM_PROCESS Process
An sub-process FSM.
#table ReturnEvents
A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.
Return value:
The SubFSM.
Adds a score for the FSM to be achieved.
Defined in:
Parameters:
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Adds a score for the FSM_PROCESS to be achieved.
Defined in:
Parameters:
#string From
is the From State of the main process.
#string Event
is the Event of the main process.
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Add a new transition rule to the FSM.
A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
#string To
The To state.
Get current state.
Returns the End states.
Returns a table of the SubFSM rules defined within the FSM.
Returns a table with the scores defined.
Returns the start state of the FSM.
Get current state.
Returns a table with the Subs defined.
Returns a table of the transition rules defined within the FSM.
Check if FSM is in state.
Defined in:
Parameter:
#string State
State name.
Return value:
#boolean:
If true, FSM is in this state.
Load call backs.
Sets the start state of the FSM.
Add to map.
Call handler.
Defined in:
Parameters:
#string step
Step "onafter", "onbefore", "onenter", "onleave".
#string trigger
Trigger.
#table params
Parameters.
#string EventName
Event name.
Return value:
Value.
Create transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Delayed transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Event map.
Go sub.
Defined in:
Parameters:
#string ParentFrom
Parent from state.
#string ParentEvent
Parent event name.
Return value:
#table:
Subs.
Handler.
Is end state.
Defined in:
Parameter:
#string Current
Current state name.
Return values:
#table:
FSM parent.
#string:
Event name.
Sub maps.
Check if can do an event.
Defined in:
Parameter:
#string e
Event name.
Return values:
#boolean:
If true, FSM can do the event.
#string:
To state.
Check if cannot do an event.
Defined in:
Parameter:
#string e
Event name.
Return value:
#boolean:
If true, FSM cannot do the event.
Check if FSM is in state.
Defined in:
Parameters:
#string State
State name.
state
Return value:
#boolean:
If true, FSM is in this state.
The ZONE_BASE.BoundingSquare
Field(s)
Function(s)
Field(s)
Points in 2D.
Set of GROUPs.
Set of OPSGROUPS.
Set of UNITs.
Scheduler ID for updating.
Function(s)
Add a set of groups.
Positions of the group will be considered as polygon vertices when contructing the convex hull.
Add a vertex (point) to the polygon.
Defined in:
ZONE_ELASTIC
Parameter:
DCS#Vec2 Vec2
Point in 2D (with x and y coordinates).
Return value:
self
Add a vertex (point) to the polygon.
Defined in:
ZONE_ELASTIC
Parameter:
DCS#Vec3 Vec3
Point in 3D (with x, y and z coordinates). Only the x and z coordinates are used.
Return value:
self
Constructor to create a ZONE_ELASTIC instance.
Defined in:
ZONE_ELASTIC
Parameters:
#string ZoneName
Name of the zone.
DCS#Vec2 Points
(Optional) Fixed points.
Return value:
self
Start the updating scheduler.
Defined in:
ZONE_ELASTIC
Parameters:
#number Tstart
Time in seconds before the updating starts.
#number dT
Time interval in seconds between updates. Default 60 sec.
#number Tstop
Time in seconds after which the updating stops. Default nil
.
#boolean Draw
Draw the zone. Default nil
.
Return value:
self
Stop the updating scheduler.
Defined in:
ZONE_ELASTIC
Parameter:
#number Delay
Delay in seconds before the scheduler will be stopped. Default 0.
Return value:
self
Update the convex hull of the polygon.
This uses the Graham scan.
Defined in:
ZONE_ELASTIC
Parameters:
#number Delay
Delay in seconds before the zone is updated. Default 0.
#boolean Draw
Draw the zone. Default nil
.
Return value:
self
Create a convex hull.
Defined in:
ZONE_ELASTIC
Parameter:
#table pl
Points
Return value:
#table:
Points
Field(s)
Function(s)
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Defined in:
ZONE_GROUP
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:
The Core.Point#POINT_VEC2 object reflecting the random 3D location within the zone.
Returns a random location within the zone of the Wrapper.Group.
Defined in:
ZONE_GROUP
Return value:
The random location of the zone based on the Wrapper.Group location.
Returns the current location of the Wrapper.Group.
Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Wrapper.Group#GROUP and a radius.
Defined in:
ZONE_GROUP
Parameters:
#string ZoneName
Name of the zone.
Wrapper.Group#GROUP ZoneGROUP
The Wrapper.Group as the center of the zone.
DCS#Distance Radius
The radius of the zone.
Return value:
self
ZONE_OVAL created from a center point, major axis, minor axis, and angle.
Ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
Field(s)
Function(s)
Draw the zone on the F10 map.
- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
Defined in:
ZONE_OVAL
Parameters:
#number Coalition
Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
#table Color
RGB color table {r, g, b}, e.g. {1,0,0} for red.
#number Alpha
Transparency [0,1]. Default 1.
#table FillColor
RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as Color
value. -- doesn't seem to work
#number FillAlpha
Transparency [0,1]. Default 0.15. -- doesn't seem to work
#number LineType
Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
#boolean ReadOnly
(Optional) Mark is readonly and cannot be removed by users. Default false.
Return value:
self
Gets the angle of the oval.
Defined in:
ZONE_OVAL
Return value:
#number:
The angle of the oval
Calculates the bounding box of the oval.
The bounding box is the smallest rectangle that contains the oval.
Defined in:
ZONE_OVAL
Return value:
#table:
The bounding box of the oval
Gets the major axis of the oval.
Defined in:
ZONE_OVAL
Return value:
#number:
The major axis of the oval
Gets the minor axis of the oval.
Defined in:
ZONE_OVAL
Return value:
#number:
The minor axis of the oval
Define a random Core.Point#POINT_VEC2 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Define a random Core.Point#POINT_VEC2 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Returns a random Vec2 within the oval.
Defined in:
ZONE_OVAL
Return value:
#table:
The random Vec2
Returns a the center point of the oval
Defined in:
ZONE_OVAL
Return value:
#table:
The center Vec2
Checks if a point is contained within the oval.
Defined in:
ZONE_OVAL
Parameters:
#table point
The point to check
vec2
Return value:
True if the point is contained, false otherwise
Creates a new ZONE_OVAL from a center point, major axis, minor axis, and angle.
- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
Defined in:
ZONE_OVAL
Parameters:
#string name
Name of the zone.
#table vec2
The center point of the oval
#number major_axis
The major axis of the oval
#number minor_axis
The minor axis of the oval
#number angle
The angle of the oval
Return value:
The new oval
Constructor to create a ZONE_OVAL instance, taking the name of a drawing made with the draw tool in the Mission Editor.
- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
Defined in:
ZONE_OVAL
Parameter:
#string DrawingName
The name of the drawing in the Mission Editor
Return value:
self
Find points on the edge of the oval
Defined in:
ZONE_OVAL
Parameter:
#number num_points
How many points should be found. More = smoother shape
Return value:
#table:
Points on he edge
Field(s)
Function(s)
Get 2D distance to a coordinate.
Defined in:
Parameter:
Core.Point#COORDINATE Coordinate
Reference coordinate. Can also be a DCS#Vec2 or DCS#Vec3 object.
Return value:
#number:
Distance to the reference coordinate in meters.
Returns the zone Properties table.
Defined in:
Return value:
#table:
The Key:Value table of TriggerZone properties of the zone.
Get the bounding square the zone.
Get color table of the zone.
Defined in:
Return value:
#table:
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Get transparency Alpha value of zone.
Get RGB color of zone.
Defined in:
Return value:
#table:
Table with three entries, e.g. {1, 0, 0}, which is the RGB color code.
Returns a Core.Point#COORDINATE of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The Coordinate of the zone.
Get draw coalition of zone.
Get ID of the zone object drawn on the F10 map.
The ID can be used to remove the drawn object from the F10 map view via UTILS.RemoveMark(MarkID)
.
Get fill color table of the zone.
Defined in:
Return value:
#table:
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Get transparency Alpha fill value of zone.
Get RGB fill color of zone.
Defined in:
Return value:
#table:
Table with three entries, e.g. {1, 0, 0}, which is the RGB color code.
Returns the name of the zone.
Returns a Core.Point#POINT_VEC2 of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The PointVec2 of the zone.
Returns a Core.Point#POINT_VEC3 of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The PointVec3 of the zone.
Returns the Value of the zone with the given PropertyName, or nil if no matching property exists.
Defined in:
Parameter:
#string PropertyName
The name of a the TriggerZone Property to be retrieved.
Return value:
#string:
The Value of the TriggerZone Property with the given PropertyName, or nil if absent.
Usage:
local PropertiesZone = ZONE:FindByName("Properties Zone")
local Property = "ExampleProperty"
local PropertyValue = PropertiesZone:GetProperty(Property)
Define a random Core.Point#POINT_VEC2 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Define a random Core.Point#POINT_VEC3 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Define a random DCS#Vec2 within the zone.
Get surface type of the zone.
Returns the DCS#Vec2 coordinate of the zone.
Returns the DCS#Vec3 of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The Vec3 of the zone.
Get the zone taking into account the randomization probability of a zone to be selected.
Defined in:
Return values:
The zone is selected taking into account the randomization probability factor.
#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.
Get the randomization probability of a zone to be selected.
Defined in:
Return value:
#number:
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Returns if a Coordinate is within the zone.
Defined in:
Parameter:
Core.Point#COORDINATE Coordinate
The coordinate to test.
Return value:
#boolean:
true if the coordinate is within the zone.
Returns if a PointVec2 is within the zone.
(Name is misleading, actually takes a #COORDINATE)
Defined in:
Parameter:
Core.Point#COORDINATE Coordinate
The coordinate to test.
Return value:
#boolean:
true if the PointVec2 is within the zone.
Returns if a PointVec3 is within the zone.
Defined in:
Parameter:
Core.Point#POINT_VEC3 PointVec3
The PointVec3 to test.
Return value:
#boolean:
true if the PointVec3 is within the zone.
Returns if a Vec2 is within the zone.
Defined in:
Parameter:
DCS#Vec2 Vec2
The Vec2 to test.
Return value:
#boolean:
true if the Vec2 is within the zone.
Returns if a Vec3 is within the zone.
Defined in:
Parameter:
DCS#Vec3 Vec3
The point to test.
Return value:
#boolean:
true if the Vec3 is within the zone.
ZONE_BASE constructor
Defined in:
Parameter:
#string ZoneName
Name of the zone.
Return value:
self
On After "EnteredZone" event.
An observed object has entered the zone.
Defined in:
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Controllable#CONTROLLABLE Controllable
The controllable entering the zone.
On After "LeftZone" event.
An observed object has left the zone.
Defined in:
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Controllable#CONTROLLABLE Controllable
The controllable leaving the zone.
Set the check time for ZONE:Trigger()
Defined in:
Parameter:
#number seconds
Check every seconds for objects entering or leaving the zone. Defaults to 5 secs.
Return value:
self
Set color of zone.
Defined in:
Parameters:
#table RGBcolor
RGB color table. Default {1, 0, 0}
.
#number Alpha
Transparency between 0 and 1. Default 0.15.
Return value:
self
Set draw coalition of zone.
Defined in:
Parameter:
#number Coalition
Coalition. Default -1.
Return value:
self
Set fill color of zone.
Defined in:
Parameters:
#table RGBcolor
RGB color table. Default {1, 0, 0}
.
#number Alpha
Transparacy between 0 and 1. Default 0.15.
Return value:
self
Sets the name of the zone.
Defined in:
Parameter:
#string ZoneName
The name of the zone.
Return value:
Set the randomization probability of a zone to be selected.
Defined in:
Parameter:
#number ZoneProbability
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Return value:
self
Smokes the zone boundaries in a color.
Start watching if the Object or Objects move into or out of a zone.
Defined in:
Parameter:
Object or Objects to watch, can be of type UNIT, GROUP, CLIENT, or SET_UNIT, SET_GROUP, SET_CLIENT
Return value:
self
Usage:
-- Create a new zone and start watching it every 5 secs for a defined GROUP entering or leaving
local triggerzone = ZONE:New("ZonetoWatch"):Trigger(GROUP:FindByName("Aerial-1"))
-- This FSM function will be called when the group enters the zone
function triggerzone:OnAfterEnteredZone(From,Event,To,Group)
MESSAGE:New("Group has entered zone!",15):ToAll()
end
-- This FSM function will be called when the group leaves the zone
function triggerzone:OnAfterLeftZone(From,Event,To,Group)
MESSAGE:New("Group has left zone!",15):ToAll()
end
-- Stop watching the zone after 1 hour
triggerzone:__TriggerStop(3600)
Triggers the FSM event "TriggerStop".
Stops the ZONE_BASE Trigger.
Defined in:
Remove the drawing of the zone from the F10 map.
Defined in:
Parameter:
#number Delay
(Optional) Delay before the drawing is removed.
Return value:
self
(Internal) Check the assigned objects for being in/out of the zone
Defined in:
Parameter:
#boolean fromstart
If true, do the init of the objects
Return value:
self
Triggers the FSM event "TriggerStop" after a delay.
(Internal) Check the assigned objects for being in/out of the zone
Defined in:
Parameters:
#string From
#string Event
#string to
To
Return value:
self
Field(s)
Function(s)
Adds an End state.
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
Core.Fsm#FSM_PROCESS Process
An sub-process FSM.
#table ReturnEvents
A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.
Return value:
The SubFSM.
Adds a score for the FSM to be achieved.
Defined in:
Parameters:
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Adds a score for the FSM_PROCESS to be achieved.
Defined in:
Parameters:
#string From
is the From State of the main process.
#string Event
is the Event of the main process.
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Add a new transition rule to the FSM.
A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
#string To
The To state.
Get current state.
Returns the End states.
Returns a table of the SubFSM rules defined within the FSM.
Returns a table with the scores defined.
Returns the start state of the FSM.
Get current state.
Returns a table with the Subs defined.
Returns a table of the transition rules defined within the FSM.
Check if FSM is in state.
Defined in:
Parameter:
#string State
State name.
Return value:
#boolean:
If true, FSM is in this state.
Load call backs.
Sets the start state of the FSM.
Add to map.
Call handler.
Defined in:
Parameters:
#string step
Step "onafter", "onbefore", "onenter", "onleave".
#string trigger
Trigger.
#table params
Parameters.
#string EventName
Event name.
Return value:
Value.
Create transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Delayed transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Event map.
Go sub.
Defined in:
Parameters:
#string ParentFrom
Parent from state.
#string ParentEvent
Parent event name.
Return value:
#table:
Subs.
Handler.
Is end state.
Defined in:
Parameter:
#string Current
Current state name.
Return values:
#table:
FSM parent.
#string:
Event name.
Sub maps.
Check if can do an event.
Defined in:
Parameter:
#string e
Event name.
Return values:
#boolean:
If true, FSM can do the event.
#string:
To state.
Check if cannot do an event.
Defined in:
Parameter:
#string e
Event name.
Return value:
#boolean:
If true, FSM cannot do the event.
Check if FSM is in state.
Defined in:
Parameters:
#string State
State name.
state
Return value:
#boolean:
If true, FSM is in this state.
Field(s)
Function(s)
Check if a certain coalition is inside a scanned zone.
Defined in:
ZONE_POLYGON
Parameter:
#number Coalition
The coalition id, e.g. coalition.side.BLUE.
Return value:
#boolean:
If true, the coalition is inside the zone.
Count the number of different coalitions inside the zone.
Defined in:
ZONE_POLYGON
Return value:
#number:
Counted coalitions.
Find a polygon zone in the _DATABASE using the name of the polygon zone.
Defined in:
ZONE_POLYGON
Parameter:
#string ZoneName
The name of the polygon zone.
Return value:
self
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 to 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.
Defined in:
ZONE_POLYGON
Parameter:
Coalition
Return value:
#table:
Get scanned scenery table
Defined in:
ZONE_POLYGON
Return value:
#table:
Structured table of [type].[name].Wrapper.Scenery#SCENERY scenery objects.
Get scanned scenery table
Defined in:
ZONE_POLYGON
Return value:
#table:
Table of Wrapper.Scenery#SCENERY scenery objects.
Get scanned scenery types
Defined in:
ZONE_POLYGON
Parameter:
SceneryType
Return value:
#table:
Table of DCS scenery type objects.
Get a set of scanned units.
Get scanned set of scenery objects
Defined in:
ZONE_POLYGON
Return value:
#table:
Table of Wrapper.Scenery#SCENERY scenery objects.
Get a set of scanned units.
Count the number of different coalitions inside the zone.
Defined in:
ZONE_POLYGON
Return value:
#table:
Table of DCS units and DCS statics inside the zone.
Is All in Zone of Coalition?
Check if only the specified coalition is inside the zone and noone else.
Defined in:
ZONE_POLYGON
Parameter:
#number Coalition
Coalition ID of the coalition which is checked to be the only one in the zone.
Return value:
#boolean:
True, if only that coalition is inside the zone and no one else.
Usage:
self.Zone:Scan()
local IsGuarded = self.Zone:IsAllInZoneOfCoalition( self.Coalition )
Is All in Zone of Other Coalition?
Check if only one coalition is inside the zone and the specified coalition is not the one. You first need to use the ZONE_POLYGON.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.
Defined in:
ZONE_POLYGON
Parameter:
#number Coalition
Coalition ID of the coalition which is not supposed to be in the zone.
Return value:
#boolean:
True, if and only if only one coalition is inside the zone and the specified coalition is not it.
Usage:
self.Zone:Scan()
local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition )
Is None in Zone?
You first need to use the ZONE_POLYGON.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.
Defined in:
ZONE_POLYGON
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsEmpty = self.Zone:IsNoneInZone()
Is None in Zone of Coalition?
You first need to use the ZONE_POLYGON.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.
Defined in:
ZONE_POLYGON
Parameter:
Coalition
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsOccupied = self.Zone:IsNoneInZoneOfCoalition( self.Coalition )
Is Some in Zone of Coalition?
Check if more than one coalition is inside the zone and the specified coalition is one of them. You first need to use the ZONE_POLYGON.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.
Defined in:
ZONE_POLYGON
Parameter:
#number Coalition
ID of the coalition which is checked to be inside the zone.
Return value:
#boolean:
True if more than one coalition is inside the zone and the specified coalition is one of them.
Usage:
self.Zone:Scan()
local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition )
Constructor to create a ZONE_POLYGON instance, taking the zone name and the Wrapper.Group#GROUP defined within the Mission Editor.
The Wrapper.Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
Defined in:
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:
self
Constructor to create a ZONE_POLYGON instance, taking the name of a drawing made with the draw tool in the Mission Editor.
Defined in:
ZONE_POLYGON
Parameter:
#string DrawingName
The name of the drawing in the Mission Editor
Return value:
self
Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Wrapper.Group#GROUP defined within the Mission Editor.
The Wrapper.Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
Defined in:
ZONE_POLYGON
Parameter:
#string GroupName
The group name of the GROUP defining the waypoints within the Mission Editor to define the polygon shape.
Return value:
self
Constructor to create a ZONE_POLYGON instance, taking the zone name and an array of DCS#Vec2, forming a polygon.
Defined in:
ZONE_POLYGON
Parameters:
#string ZoneName
Name of the zone.
#ZONE_POLYGON_BASE.ListVec2 PointsArray
An array of DCS#Vec2, forming a polygon.
Return value:
self
Scan the zone for the presence of units of the given ObjectCategories.
Does not scan for scenery at the moment. Note that only after a zone has been scanned, the zone can be evaluated by:
- Core.Zone#ZONE_POLYGON.IsAllInZoneOfCoalition(): Scan the presence of units in the zone of a coalition.
- Core.Zone#ZONE_POLYGON.IsAllInZoneOfOtherCoalition(): Scan the presence of units in the zone of an other coalition.
- Core.Zone#ZONE_POLYGON.IsSomeInZoneOfCoalition(): Scan if there is some presence of units in the zone of the given coalition.
- Core.Zone#ZONE_POLYGON.IsNoneInZoneOfCoalition(): Scan if there isn't any presence of units in the zone of an other coalition than the given one.
- Core.Zone#ZONE_POLYGON.IsNoneInZone(): Scan if the zone is empty.
Defined in:
ZONE_POLYGON
Parameters:
ObjectCategories
An array of categories of the objects to find in the zone. E.g. {Object.Category.UNIT}
UnitCategories
An array of unit categories of the objects to find in the zone. E.g. {Unit.Category.GROUND_UNIT,Unit.Category.SHIP}
Usage:
myzone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
local IsAttacked = myzone:IsSomeInZoneOfCoalition( self.Coalition )
Field(s)
Function(s)
Smokes the zone boundaries in a color.
Defined in:
ZONE_POLYGON_BASE
Parameter:
#boolean UnBound
If true, the tyres will be destroyed.
Return value:
self
Draw a frontier on the F10 map with small filled circles.
Defined in:
ZONE_POLYGON_BASE
Parameters:
#number Coalition
(Optional) Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1= All.
#table Color
(Optional) RGB color table {r, g, b}, e.g. {1, 0, 0} for red. Default {1, 1, 1}= White.
#number Radius
(Optional) Radius of the circles in meters. Default 1000.
#number Alpha
(Optional) Alpha transparency [0,1]. Default 1.
#number Segments
(Optional) Number of segments within boundary line. Default 10.
#boolean Closed
(Optional) Link the last point with the first one to obtain a closed boundary. Default false
Return value:
self
Draw the zone on the F10 map.
Infinite number of points supported - ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Polygon.lua
Defined in:
ZONE_POLYGON_BASE
Parameters:
#number Coalition
Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
#table Color
RGB color table {r, g, b}, e.g. {1,0,0} for red.
#number Alpha
Transparency [0,1]. Default 1.
#table FillColor
RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as Color
value. -- doesn't seem to work
#number FillAlpha
Transparency [0,1]. Default 0.15. -- doesn't seem to work
#number LineType
Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
#boolean ReadOnly
(Optional) Mark is readonly and cannot be removed by users. Default false.s
IncludeTriangles
Return value:
self
Flare the zone boundaries in a color.
Defined in:
ZONE_POLYGON_BASE
Parameters:
Utilities.Utils#FLARECOLOR FlareColor
The flare color.
#number Segments
(Optional) Number of segments within boundary line. Default 10.
DCS#Azimuth Azimuth
(optional) Azimuth The azimuth of the flare.
#number AddHeight
(optional) The height to be added for the smoke.
Return value:
self
Flush polygon coordinates as a table in DCS.log.
Get the bounding square the zone.
Get the bounding 2D vectors of the polygon.
Get the smallest radius encompassing all points of the polygon zone.
Defined in:
ZONE_POLYGON_BASE
Return value:
#number:
Radius of the zone in meters.
Return a Core.Point#COORDINATE object representing a random 3D point at landheight within the zone.
Return a Core.Point#POINT_VEC2 object representing a random 2D point at landheight within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Return a Core.Point#POINT_VEC3 object representing a random 3D point at landheight within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Define a random DCS#Vec2 within the zone.
- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Polygon.lua
Get the surface area of this polygon
Defined in:
ZONE_POLYGON_BASE
Return value:
#number:
Surface area
Returns the center location of the polygon.
Defined in:
ZONE_POLYGON_BASE
Return value:
The location of the zone based on the Wrapper.Group location.
Get a vertex of the polygon.
Defined in:
ZONE_POLYGON_BASE
Parameter:
#number Index
Index of the vertex. Default 1.
Return value:
Vertex of the polygon.
Get a vertex of the polygon.
Defined in:
ZONE_POLYGON_BASE
Parameter:
#number Index
Index of the vertex. Default 1.
Return value:
Vertex of the polygon.
Get a vertex of the polygon.
Defined in:
ZONE_POLYGON_BASE
Parameter:
#number Index
Index of the vertex. Default 1.
Return value:
Vertex of the polygon.
Get a list of verticies of the polygon.
Defined in:
ZONE_POLYGON_BASE
Return value:
#table:
List of COORDINATES verticies defining the edges of the polygon.
Get a list of verticies of the polygon.
Defined in:
ZONE_POLYGON_BASE
Return value:
Get a list of verticies of the polygon.
Defined in:
ZONE_POLYGON_BASE
Return value:
#table:
List of DCS#Vec3 verticies defining the edges of the polygon.
Get the smallest rectangular zone encompassing all points points of the polygon zone.
Defined in:
ZONE_POLYGON_BASE
Parameters:
#string ZoneName
(Optional) Name of the zone. Default is the name of the polygon zone.
#boolean DoNotRegisterZone
(Optional) If true
, zone is not registered.
Return value:
The rectangular zone.
Get the smallest circular zone encompassing all points of the polygon zone.
Defined in:
ZONE_POLYGON_BASE
Parameters:
#string ZoneName
(Optional) Name of the zone. Default is the name of the polygon zone.
#boolean DoNotRegisterZone
(Optional) If true
, zone is not registered.
Return value:
The circular zone.
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
Defined in:
ZONE_POLYGON_BASE
Parameter:
DCS#Vec2 Vec2
The location to test.
Return value:
#boolean:
true if the location is within the zone.
Returns if a point is within the zone.
Defined in:
ZONE_POLYGON_BASE
Parameter:
DCS#Vec3 Vec3
The point to test.
Return value:
#boolean:
true if the point is within the zone.
Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of DCS#Vec2, forming a polygon.
The Wrapper.Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected.
Defined in:
ZONE_POLYGON_BASE
Parameters:
#string ZoneName
Name of the zone.
#ZONE_POLYGON_BASE.ListVec2 PointsArray
An array of DCS#Vec2, forming a polygon.
Return value:
self
Change/Re-draw the border of a Polygon Zone
Defined in:
ZONE_POLYGON_BASE
Parameters:
#table Color
RGB color table {r, g, b}, e.g. {1,0,0} for red.
#number Alpha
Transparency [0,1]. Default 1.
#number LineType
Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
Return value:
Change/Re-fill a Polygon Zone
Defined in:
ZONE_POLYGON_BASE
Parameters:
#table Color
RGB color table {r, g, b}, e.g. {1,0,0} for red.
#number Alpha
Transparency [0,1]. Default 1.
Return value:
self
Remove junk inside the zone.
Due to DCS limitations, this works only for rectangular zones. So we get the smallest rectangular zone encompassing all points points of the polygon zone.
Defined in:
ZONE_POLYGON_BASE
Parameter:
#number Height
Height of the box in meters. Default 1000.
Return value:
#number:
Number of removed objects.
Smokes the zone boundaries in a color.
Defined in:
ZONE_POLYGON_BASE
Parameters:
Utilities.Utils#SMOKECOLOR SmokeColor
The smoke color.
#number Segments
(Optional) Number of segments within boundary line. Default 10.
Return value:
self
Update polygon points with an array of DCS#Vec2.
Defined in:
ZONE_POLYGON_BASE
Parameter:
#ZONE_POLYGON_BASE.ListVec2 Vec2Array
An array of DCS#Vec2, forming a polygon.
Return value:
self
Update polygon points with an array of DCS#Vec3.
Defined in:
ZONE_POLYGON_BASE
Parameters:
#ZONE_POLYGON_BASE.ListVec3 Vec2Array
An array of DCS#Vec3, forming a polygon.
Vec3Array
Return value:
self
Calculates the surface area of the polygon.
The surface area is the sum of the areas of the triangles that make up the polygon. - ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Polygon.lua
Defined in:
ZONE_POLYGON_BASE
Return value:
#number:
The surface area of the polygon
Triangulates the polygon.
- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Polygon.lua
Defined in:
ZONE_POLYGON_BASE
Return value:
#table:
The #ZONETRIANGLE list that makes up the polygon
The ZONE_RADIUS class, defined by a zone name, a location and a radius.
Field(s)
Function(s)
Bounds the zone with tires.
Defined in:
ZONE_RADIUS
Parameters:
#number Points
(optional) The amount of points in the circle. Default 360.
DCS#country.id CountryID
The country id of the tire objects, e.g. country.id.USA for blue or country.id.RUSSIA for red.
#boolean UnBound
(Optional) If true the tyres will be destroyed.
Return value:
self
Check if a certain coalition is inside a scanned zone.
Defined in:
ZONE_RADIUS
Parameter:
#number Coalition
The coalition id, e.g. coalition.side.BLUE.
Return value:
#boolean:
If true, the coalition is inside the zone.
Count the number of different coalitions inside the zone.
Defined in:
ZONE_RADIUS
Return value:
#number:
Counted coalitions.
Draw the zone circle on the F10 map.
Defined in:
ZONE_RADIUS
Parameters:
#number Coalition
Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
#table Color
RGB color table {r, g, b}, e.g. {1,0,0} for red.
#number Alpha
Transparency [0,1]. Default 1.
#table FillColor
RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as Color
value.
#number FillAlpha
Transparency [0,1]. Default 0.15.
#number LineType
Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
#boolean ReadOnly
(Optional) Mark is readonly and cannot be removed by users. Default false.
Return value:
self
Flares the zone boundaries in a color.
Defined in:
ZONE_RADIUS
Parameters:
Utilities.Utils#FLARECOLOR FlareColor
The flare color.
#number Points
(optional) The amount of points in the circle.
DCS#Azimuth Azimuth
(optional) Azimuth The azimuth of the flare.
#number AddHeight
(optional) The height to be added for the smoke.
Return value:
self
Returns the radius of the zone.
Returns a Core.Point#COORDINATE object reflecting a random 3D location within the zone.
Defined in:
ZONE_RADIUS
Parameters:
#number inner
(Optional) Minimal distance from the center of the zone in meters. Default is 0 m.
#number outer
(Optional) Maximal distance from the outer edge of the zone in meters. Default is the radius of the zone.
#table surfacetypes
(Optional) Table of surface types. Can also be a single surface type. We will try max 100 times to find the right type!
Return value:
The random coordinate.
Returns a Core.Point#COORDINATE object reflecting a random location within the zone where there are no map objects of type "Building".
Does not find statics you might have placed there. Note This might be quite CPU intensive, use with care.
Defined in:
ZONE_RADIUS
Parameters:
#number inner
(Optional) Minimal distance from the center of the zone in meters. Default is 0m.
#number outer
(Optional) Maximal distance from the outer edge of the zone in meters. Default is the radius of the zone.
#number distance
(Optional) Minimum distance from any building coordinate. Defaults to 100m.
#boolean markbuildings
(Optional) Place markers on found buildings (if any).
#boolean markfinal
(Optional) Place marker on the final coordinate (if any).
Return value:
The random coordinate or nil
if cannot be found in 1000 iterations.
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Defined in:
ZONE_RADIUS
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:
The Core.Point#POINT_VEC2 object reflecting the random 3D location within the zone.
Returns a Core.Point#POINT_VEC3 object reflecting a random 3D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Defined in:
ZONE_RADIUS
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:
The Core.Point#POINT_VEC3 object reflecting the random 3D location within the zone.
Returns a random Vec2 location within the zone.
Defined in:
ZONE_RADIUS
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.
#table surfacetypes
(Optional) Table of surface types. Can also be a single surface type. We will try max 100 times to find the right type!
Return value:
The random location within the zone.
Returns Returns a random Vec3 location within the zone.
Defined in:
ZONE_RADIUS
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:
The random location within the zone.
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 to 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.
Defined in:
ZONE_RADIUS
Parameter:
Coalition
Return value:
#table:
Get scanned scenery table
Defined in:
ZONE_RADIUS
Return value:
#table:
Structured object table: [type].[name].SCENERY
Get table of scanned scenery objects
Defined in:
ZONE_RADIUS
Return value:
#table:
Table of SCENERY objects.
Get scanned scenery type
Defined in:
ZONE_RADIUS
Parameter:
SceneryType
Return value:
#table:
Table of DCS scenery type objects.
Get a set of scanned groups.
Get set of scanned scenery objects
Defined in:
ZONE_RADIUS
Return value:
#table:
Table of Wrapper.Scenery#SCENERY scenery objects.
Get a set of scanned units.
Get a table of scanned units.
Defined in:
ZONE_RADIUS
Return value:
#table:
Table of DCS units and DCS statics inside the zone.
Returns the DCS#Vec2 of the zone.
Returns the DCS#Vec3 of the ZONE_RADIUS.
Defined in:
ZONE_RADIUS
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The point of the zone.
Is All in Zone of Coalition?
Check if only the specified coalition is inside the zone and no one else.
Defined in:
ZONE_RADIUS
Parameter:
#number Coalition
Coalition ID of the coalition which is checked to be the only one in the zone.
Return value:
#boolean:
True, if only that coalition is inside the zone and no one else.
Usage:
self.Zone:Scan()
local IsGuarded = self.Zone:IsAllInZoneOfCoalition( self.Coalition )
Is All in Zone of Other Coalition?
Check if only one coalition is inside the zone and the specified coalition is not the one. 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.
Defined in:
ZONE_RADIUS
Parameter:
#number Coalition
Coalition ID of the coalition which is not supposed to be in the zone.
Return value:
#boolean:
True, if and only if only one coalition is inside the zone and the specified coalition is not it.
Usage:
self.Zone:Scan()
local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition )
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.
Defined in:
ZONE_RADIUS
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsEmpty = self.Zone:IsNoneInZone()
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.
Defined in:
ZONE_RADIUS
Parameter:
Coalition
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsOccupied = self.Zone:IsNoneInZoneOfCoalition( self.Coalition )
Is Some in Zone of Coalition?
Check if more than one coalition is inside the zone and the specified coalition is one of them. 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.
Defined in:
ZONE_RADIUS
Parameter:
#number Coalition
ID of the coalition which is checked to be inside the zone.
Return value:
#boolean:
True if more than one coalition is inside the zone and the specified coalition is one of them.
Usage:
self.Zone:Scan()
local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition )
Returns if a location is within the zone.
Defined in:
ZONE_RADIUS
Parameter:
DCS#Vec2 Vec2
The location to test.
Return value:
#boolean:
true if the location is within the zone.
Returns if a point is within the zone.
Defined in:
ZONE_RADIUS
Parameter:
DCS#Vec3 Vec3
The point to test.
Return value:
#boolean:
true if the point is within the zone.
Mark the zone with markers on the F10 map.
Defined in:
ZONE_RADIUS
Parameter:
#number Points
(Optional) The amount of points in the circle. Default 360.
Return value:
self
Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius.
Defined in:
ZONE_RADIUS
Parameters:
#string ZoneName
Name of the zone.
DCS#Vec2 Vec2
The location of the zone.
DCS#Distance Radius
The radius of the zone.
DCS#Boolean DoNotRegisterZone
Determines if the Zone should not be registered in the _Database Table. Default=false
Return value:
self
Remove junk inside the zone using the world.removeJunk
function.
Defined in:
ZONE_RADIUS
Return value:
#number:
Number of deleted objects.
Scan the zone for the presence of units of the given ObjectCategories.
Note that only after a zone has been scanned, the zone can be evaluated by:
- Core.Zone#ZONE_RADIUS.IsAllInZoneOfCoalition(): Scan the presence of units in the zone of a coalition.
- Core.Zone#ZONE_RADIUS.IsAllInZoneOfOtherCoalition(): Scan the presence of units in the zone of an other coalition.
- Core.Zone#ZONE_RADIUS.IsSomeInZoneOfCoalition(): Scan if there is some presence of units in the zone of the given coalition.
- Core.Zone#ZONE_RADIUS.IsNoneInZoneOfCoalition(): Scan if there isn't any presence of units in the zone of an other coalition than the given one.
- Core.Zone#ZONE_RADIUS.IsNoneInZone(): Scan if the zone is empty.
Defined in:
ZONE_RADIUS
Parameters:
ObjectCategories
An array of categories of the objects to find in the zone. E.g. {Object.Category.UNIT}
UnitCategories
An array of unit categories of the objects to find in the zone. E.g. {Unit.Category.GROUND_UNIT,Unit.Category.SHIP}
Usage:
myzone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
local IsAttacked = myzone:IsSomeInZoneOfCoalition( self.Coalition )
Searches the zone
Defined in:
ZONE_RADIUS
Parameters:
ObjectCategories
A list of categories, which are members of Object.Category
EvaluateFunction
Sets the radius of the zone.
Defined in:
ZONE_RADIUS
Parameter:
DCS#Distance Radius
The radius of the zone.
Return value:
The radius of the zone.
Sets the DCS#Vec2 of the zone.
Smokes the zone boundaries in a color.
Defined in:
ZONE_RADIUS
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:
self
Update zone from a 2D vector.
Defined in:
ZONE_RADIUS
Parameters:
DCS#Vec2 Vec2
The location of the zone.
DCS#Distance Radius
The radius of the zone.
Return value:
self
Update zone from a 2D vector.
Defined in:
ZONE_RADIUS
Parameters:
DCS#Vec3 Vec3
The location of the zone.
DCS#Distance Radius
The radius of the zone.
Return value:
self
Field(s)
Function(s)
Returns a random location within the zone.
Returns the current location of the Wrapper.Unit#UNIT.
Defined in:
ZONE_UNIT
Return value:
The location of the zone based on the Wrapper.Unit#UNITlocation and the offset, if any.
Returns the DCS#Vec3 of the ZONE_UNIT.
Defined in:
ZONE_UNIT
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The point of the zone.
Constructor to create a ZONE_UNIT instance, taking the zone name, a zone unit and a radius and optional offsets in X and Y directions.
Defined in:
ZONE_UNIT
Parameters:
#string ZoneName
Name of the zone.
Wrapper.Unit#UNIT ZoneUNIT
The unit as the center of the zone.
#number Radius
The radius of the zone in meters.
#table Offset
A table specifying the offset. The offset table may have the following elements: dx The offset in X direction, +x is north. dy The offset in Y direction, +y is east. rho The distance of the zone from the unit theta The azimuth of the zone relative to unit relative_to_unit If true, theta is measured clockwise from unit's direction else clockwise from north. If using dx, dy setting this to true makes +x parallel to unit heading. dx, dy OR rho, theta may be used, not both.
Return value:
self
Field(s)
Function(s)
Bounds the zone with tires.
Defined in:
Parameters:
#number Points
(optional) The amount of points in the circle. Default 360.
DCS#country.id CountryID
The country id of the tire objects, e.g. country.id.USA for blue or country.id.RUSSIA for red.
#boolean UnBound
(Optional) If true the tyres will be destroyed.
Return value:
self
Check if a certain coalition is inside a scanned zone.
Defined in:
Parameter:
#number Coalition
The coalition id, e.g. coalition.side.BLUE.
Return value:
#boolean:
If true, the coalition is inside the zone.
Count the number of different coalitions inside the zone.
Draw the zone circle on the F10 map.
Defined in:
Parameters:
#number Coalition
Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
#table Color
RGB color table {r, g, b}, e.g. {1,0,0} for red.
#number Alpha
Transparency [0,1]. Default 1.
#table FillColor
RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as Color
value.
#number FillAlpha
Transparency [0,1]. Default 0.15.
#number LineType
Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
#boolean ReadOnly
(Optional) Mark is readonly and cannot be removed by users. Default false.
Return value:
self
Flares the zone boundaries in a color.
Defined in:
Parameters:
Utilities.Utils#FLARECOLOR FlareColor
The flare color.
#number Points
(optional) The amount of points in the circle.
DCS#Azimuth Azimuth
(optional) Azimuth The azimuth of the flare.
#number AddHeight
(optional) The height to be added for the smoke.
Return value:
self
Returns the radius of the zone.
Returns a Core.Point#COORDINATE object reflecting a random 3D location within the zone.
Defined in:
Parameters:
#number inner
(Optional) Minimal distance from the center of the zone in meters. Default is 0 m.
#number outer
(Optional) Maximal distance from the outer edge of the zone in meters. Default is the radius of the zone.
#table surfacetypes
(Optional) Table of surface types. Can also be a single surface type. We will try max 100 times to find the right type!
Return value:
The random coordinate.
Returns a Core.Point#COORDINATE object reflecting a random location within the zone where there are no map objects of type "Building".
Does not find statics you might have placed there. Note This might be quite CPU intensive, use with care.
Defined in:
Parameters:
#number inner
(Optional) Minimal distance from the center of the zone in meters. Default is 0m.
#number outer
(Optional) Maximal distance from the outer edge of the zone in meters. Default is the radius of the zone.
#number distance
(Optional) Minimum distance from any building coordinate. Defaults to 100m.
#boolean markbuildings
(Optional) Place markers on found buildings (if any).
#boolean markfinal
(Optional) Place marker on the final coordinate (if any).
Return value:
The random coordinate or nil
if cannot be found in 1000 iterations.
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Defined in:
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:
The Core.Point#POINT_VEC2 object reflecting the random 3D location within the zone.
Returns a Core.Point#POINT_VEC3 object reflecting a random 3D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Defined in:
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:
The Core.Point#POINT_VEC3 object reflecting the random 3D location within the zone.
Returns a random Vec2 location within the zone.
Defined in:
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.
#table surfacetypes
(Optional) Table of surface types. Can also be a single surface type. We will try max 100 times to find the right type!
Return value:
The random location within the zone.
Returns Returns a random Vec3 location within the zone.
Defined in:
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:
The random location within the zone.
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 to 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.
Get scanned scenery table
Defined in:
Return value:
#table:
Structured object table: [type].[name].SCENERY
Get table of scanned scenery objects
Get scanned scenery type
Defined in:
Parameter:
SceneryType
Return value:
#table:
Table of DCS scenery type objects.
Get a set of scanned groups.
Get set of scanned scenery objects
Defined in:
Return value:
#table:
Table of Wrapper.Scenery#SCENERY scenery objects.
Get a set of scanned units.
Defined in:
Return value:
Set of units and statics inside the zone.
Get a table of scanned units.
Defined in:
Return value:
#table:
Table of DCS units and DCS statics inside the zone.
Returns the DCS#Vec2 of the zone.
Returns the DCS#Vec3 of the ZONE_RADIUS.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The point of the zone.
Is All in Zone of Coalition?
Check if only the specified coalition is inside the zone and no one else.
Defined in:
Parameter:
#number Coalition
Coalition ID of the coalition which is checked to be the only one in the zone.
Return value:
#boolean:
True, if only that coalition is inside the zone and no one else.
Usage:
self.Zone:Scan()
local IsGuarded = self.Zone:IsAllInZoneOfCoalition( self.Coalition )
Is All in Zone of Other Coalition?
Check if only one coalition is inside the zone and the specified coalition is not the one. 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.
Defined in:
Parameter:
#number Coalition
Coalition ID of the coalition which is not supposed to be in the zone.
Return value:
#boolean:
True, if and only if only one coalition is inside the zone and the specified coalition is not it.
Usage:
self.Zone:Scan()
local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition )
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.
Defined in:
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsEmpty = self.Zone:IsNoneInZone()
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.
Defined in:
Parameter:
Coalition
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsOccupied = self.Zone:IsNoneInZoneOfCoalition( self.Coalition )
Is Some in Zone of Coalition?
Check if more than one coalition is inside the zone and the specified coalition is one of them. 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.
Defined in:
Parameter:
#number Coalition
ID of the coalition which is checked to be inside the zone.
Return value:
#boolean:
True if more than one coalition is inside the zone and the specified coalition is one of them.
Usage:
self.Zone:Scan()
local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition )
Returns if a location is within the zone.
Defined in:
Parameter:
DCS#Vec2 Vec2
The location to test.
Return value:
#boolean:
true if the location is within the zone.
Returns if a point is within the zone.
Defined in:
Parameter:
DCS#Vec3 Vec3
The point to test.
Return value:
#boolean:
true if the point is within the zone.
Mark the zone with markers on the F10 map.
Defined in:
Parameter:
#number Points
(Optional) The amount of points in the circle. Default 360.
Return value:
self
Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius.
Defined in:
Parameters:
#string ZoneName
Name of the zone.
DCS#Vec2 Vec2
The location of the zone.
DCS#Distance Radius
The radius of the zone.
DCS#Boolean DoNotRegisterZone
Determines if the Zone should not be registered in the _Database Table. Default=false
Return value:
self
Remove junk inside the zone using the world.removeJunk
function.
Scan the zone for the presence of units of the given ObjectCategories.
Note that only after a zone has been scanned, the zone can be evaluated by:
- Core.Zone#ZONE_RADIUS.IsAllInZoneOfCoalition(): Scan the presence of units in the zone of a coalition.
- Core.Zone#ZONE_RADIUS.IsAllInZoneOfOtherCoalition(): Scan the presence of units in the zone of an other coalition.
- Core.Zone#ZONE_RADIUS.IsSomeInZoneOfCoalition(): Scan if there is some presence of units in the zone of the given coalition.
- Core.Zone#ZONE_RADIUS.IsNoneInZoneOfCoalition(): Scan if there isn't any presence of units in the zone of an other coalition than the given one.
- Core.Zone#ZONE_RADIUS.IsNoneInZone(): Scan if the zone is empty.
Defined in:
Parameters:
ObjectCategories
An array of categories of the objects to find in the zone. E.g. {Object.Category.UNIT}
UnitCategories
An array of unit categories of the objects to find in the zone. E.g. {Unit.Category.GROUND_UNIT,Unit.Category.SHIP}
Usage:
myzone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
local IsAttacked = myzone:IsSomeInZoneOfCoalition( self.Coalition )
Searches the zone
Defined in:
Parameters:
ObjectCategories
A list of categories, which are members of Object.Category
EvaluateFunction
Sets the radius of the zone.
Defined in:
Parameter:
DCS#Distance Radius
The radius of the zone.
Return value:
The radius of the zone.
Sets the DCS#Vec2 of the zone.
Defined in:
Parameter:
DCS#Vec2 Vec2
The new location of the zone.
Return value:
The new location of the zone.
Smokes the zone boundaries in a color.
Defined in:
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:
self
Update zone from a 2D vector.
Defined in:
Parameters:
DCS#Vec2 Vec2
The location of the zone.
DCS#Distance Radius
The radius of the zone.
Return value:
self
Update zone from a 2D vector.
Defined in:
Parameters:
DCS#Vec3 Vec3
The location of the zone.
DCS#Distance Radius
The radius of the zone.
Return value:
self
Ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Triangle.lua - This triangle "zone" is not really to be used on its own, it only serves as building blocks for - ZONE_POLYGON to accurately find a point inside a polygon; as well as getting the correct surface area of - a polygon.
Field(s)
Function(s)
Checks if a point is contained within the triangle.
Defined in:
ZONETRIANGLE
Parameters:
#table pt
The point to check
#table points
(optional) The points of the triangle, or 3 other points if you're just using the TRIANGLE class without an object of it
Return value:
True if the point is contained, false otherwise
Draw the triangle
Defined in:
ZONETRIANGLE
Parameters:
Coalition
Color
Alpha
FillColor
FillAlpha
LineType
ReadOnly
Return value:
#table:
of draw IDs
Draw the triangle
Defined in:
ZONETRIANGLE
Parameters:
Coalition
FillColor
FillAlpha
ReadOnly
Return value:
#table:
of draw IDs
Returns a random Vec2 within the triangle.
Defined in:
ZONETRIANGLE
Parameter:
#table points
The points of the triangle, or 3 other points if you're just using the TRIANGLE class without an object of it
Return value:
#table:
The random Vec2
Field(s)
Function(s)
Get 2D distance to a coordinate.
Defined in:
Parameter:
Core.Point#COORDINATE Coordinate
Reference coordinate. Can also be a DCS#Vec2 or DCS#Vec3 object.
Return value:
#number:
Distance to the reference coordinate in meters.
Returns the zone Properties table.
Defined in:
Return value:
#table:
The Key:Value table of TriggerZone properties of the zone.
Get the bounding square the zone.
Get color table of the zone.
Defined in:
Return value:
#table:
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Get transparency Alpha value of zone.
Get RGB color of zone.
Defined in:
Return value:
#table:
Table with three entries, e.g. {1, 0, 0}, which is the RGB color code.
Returns a Core.Point#COORDINATE of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The Coordinate of the zone.
Get draw coalition of zone.
Get ID of the zone object drawn on the F10 map.
The ID can be used to remove the drawn object from the F10 map view via UTILS.RemoveMark(MarkID)
.
Get fill color table of the zone.
Defined in:
Return value:
#table:
Table with four entries, e.g. {1, 0, 0, 0.15}. First three are RGB color code. Fourth is the transparency Alpha value.
Get transparency Alpha fill value of zone.
Get RGB fill color of zone.
Defined in:
Return value:
#table:
Table with three entries, e.g. {1, 0, 0}, which is the RGB color code.
Returns the name of the zone.
Returns a Core.Point#POINT_VEC2 of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The PointVec2 of the zone.
Returns a Core.Point#POINT_VEC3 of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The PointVec3 of the zone.
Returns the Value of the zone with the given PropertyName, or nil if no matching property exists.
Defined in:
Parameter:
#string PropertyName
The name of a the TriggerZone Property to be retrieved.
Return value:
#string:
The Value of the TriggerZone Property with the given PropertyName, or nil if absent.
Usage:
local PropertiesZone = ZONE:FindByName("Properties Zone")
local Property = "ExampleProperty"
local PropertyValue = PropertiesZone:GetProperty(Property)
Define a random Core.Point#POINT_VEC2 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Define a random Core.Point#POINT_VEC3 within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Define a random DCS#Vec2 within the zone.
Get surface type of the zone.
Returns the DCS#Vec2 coordinate of the zone.
Returns the DCS#Vec3 of the zone.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The Vec3 of the zone.
Get the zone taking into account the randomization probability of a zone to be selected.
Defined in:
Return values:
The zone is selected taking into account the randomization probability factor.
#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.
Get the randomization probability of a zone to be selected.
Defined in:
Return value:
#number:
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Returns if a Coordinate is within the zone.
Defined in:
Parameter:
Core.Point#COORDINATE Coordinate
The coordinate to test.
Return value:
#boolean:
true if the coordinate is within the zone.
Returns if a PointVec2 is within the zone.
(Name is misleading, actually takes a #COORDINATE)
Defined in:
Parameter:
Core.Point#COORDINATE Coordinate
The coordinate to test.
Return value:
#boolean:
true if the PointVec2 is within the zone.
Returns if a PointVec3 is within the zone.
Defined in:
Parameter:
Core.Point#POINT_VEC3 PointVec3
The PointVec3 to test.
Return value:
#boolean:
true if the PointVec3 is within the zone.
Returns if a Vec2 is within the zone.
Defined in:
Parameter:
DCS#Vec2 Vec2
The Vec2 to test.
Return value:
#boolean:
true if the Vec2 is within the zone.
Returns if a Vec3 is within the zone.
Defined in:
Parameter:
DCS#Vec3 Vec3
The point to test.
Return value:
#boolean:
true if the Vec3 is within the zone.
ZONE_BASE constructor
Defined in:
Parameter:
#string ZoneName
Name of the zone.
Return value:
self
On After "EnteredZone" event.
An observed object has entered the zone.
Defined in:
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Controllable#CONTROLLABLE Controllable
The controllable entering the zone.
On After "LeftZone" event.
An observed object has left the zone.
Defined in:
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Controllable#CONTROLLABLE Controllable
The controllable leaving the zone.
Set the check time for ZONE:Trigger()
Defined in:
Parameter:
#number seconds
Check every seconds for objects entering or leaving the zone. Defaults to 5 secs.
Return value:
self
Set color of zone.
Defined in:
Parameters:
#table RGBcolor
RGB color table. Default {1, 0, 0}
.
#number Alpha
Transparency between 0 and 1. Default 0.15.
Return value:
self
Set draw coalition of zone.
Defined in:
Parameter:
#number Coalition
Coalition. Default -1.
Return value:
self
Set fill color of zone.
Defined in:
Parameters:
#table RGBcolor
RGB color table. Default {1, 0, 0}
.
#number Alpha
Transparacy between 0 and 1. Default 0.15.
Return value:
self
Sets the name of the zone.
Defined in:
Parameter:
#string ZoneName
The name of the zone.
Return value:
Set the randomization probability of a zone to be selected.
Defined in:
Parameter:
#number ZoneProbability
A value between 0 and 1. 0 = 0% and 1 = 100% probability.
Return value:
self
Smokes the zone boundaries in a color.
Start watching if the Object or Objects move into or out of a zone.
Defined in:
Parameter:
Object or Objects to watch, can be of type UNIT, GROUP, CLIENT, or SET_UNIT, SET_GROUP, SET_CLIENT
Return value:
self
Usage:
-- Create a new zone and start watching it every 5 secs for a defined GROUP entering or leaving
local triggerzone = ZONE:New("ZonetoWatch"):Trigger(GROUP:FindByName("Aerial-1"))
-- This FSM function will be called when the group enters the zone
function triggerzone:OnAfterEnteredZone(From,Event,To,Group)
MESSAGE:New("Group has entered zone!",15):ToAll()
end
-- This FSM function will be called when the group leaves the zone
function triggerzone:OnAfterLeftZone(From,Event,To,Group)
MESSAGE:New("Group has left zone!",15):ToAll()
end
-- Stop watching the zone after 1 hour
triggerzone:__TriggerStop(3600)
Triggers the FSM event "TriggerStop".
Stops the ZONE_BASE Trigger.
Defined in:
Remove the drawing of the zone from the F10 map.
Defined in:
Parameter:
#number Delay
(Optional) Delay before the drawing is removed.
Return value:
self
(Internal) Check the assigned objects for being in/out of the zone
Defined in:
Parameter:
#boolean fromstart
If true, do the init of the objects
Return value:
self
Triggers the FSM event "TriggerStop" after a delay.
(Internal) Check the assigned objects for being in/out of the zone
Defined in:
Parameters:
#string From
#string Event
#string to
To
Return value:
self
Field(s)
Function(s)
Adds an End state.
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
Core.Fsm#FSM_PROCESS Process
An sub-process FSM.
#table ReturnEvents
A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.
Return value:
The SubFSM.
Adds a score for the FSM to be achieved.
Defined in:
Parameters:
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Adds a score for the FSM_PROCESS to be achieved.
Defined in:
Parameters:
#string From
is the From State of the main process.
#string Event
is the Event of the main process.
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Add a new transition rule to the FSM.
A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
#string To
The To state.
Get current state.
Returns the End states.
Returns a table of the SubFSM rules defined within the FSM.
Returns a table with the scores defined.
Returns the start state of the FSM.
Get current state.
Returns a table with the Subs defined.
Returns a table of the transition rules defined within the FSM.
Check if FSM is in state.
Defined in:
Parameter:
#string State
State name.
Return value:
#boolean:
If true, FSM is in this state.
Load call backs.
Sets the start state of the FSM.
Add to map.
Call handler.
Defined in:
Parameters:
#string step
Step "onafter", "onbefore", "onenter", "onleave".
#string trigger
Trigger.
#table params
Parameters.
#string EventName
Event name.
Return value:
Value.
Create transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Delayed transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Event map.
Go sub.
Defined in:
Parameters:
#string ParentFrom
Parent from state.
#string ParentEvent
Parent event name.
Return value:
#table:
Subs.
Handler.
Is end state.
Defined in:
Parameter:
#string Current
Current state name.
Return values:
#table:
FSM parent.
#string:
Event name.
Sub maps.
Check if can do an event.
Defined in:
Parameter:
#string e
Event name.
Return values:
#boolean:
If true, FSM can do the event.
#string:
To state.
Check if cannot do an event.
Defined in:
Parameter:
#string e
Event name.
Return value:
#boolean:
If true, FSM cannot do the event.
Check if FSM is in state.
Defined in:
Parameters:
#string State
State name.
state
Return value:
#boolean:
If true, FSM is in this state.