Module Functional.RAT
Functional - Create random air traffic in your missions.
The aim of the RAT class is to fill the empty DCS world with randomized air traffic and bring more life to your airports. In particular, it is designed to spawn AI air units at random airports. These units will be assigned a random flight path to another random airport on the map. Even the mission designer will not know where aircraft will be spawned and which route they follow.
Features:
- Very simple interface. Just one unit and two lines of Lua code needed to fill your map.
- High degree of randomization. Aircraft will spawn at random airports, have random routes and random destinations.
- Specific departure and/or destination airports can be chosen.
- Departure and destination airports can be restricted by coalition.
- Planes and helicopters supported. Helicopters can also be send to FARPs and ships.
- Units can also be spawned in air within pre-defined zones of the map.
- Aircraft will be removed when they arrive at their destination (or get stuck on the ground).
- When a unit is removed a new unit with a different flight plan is respawned.
- Aircraft can report their status during the route.
- All of the above can be customized by the user if necessary.
- All current (Caucasus, Nevada, Normandy, Persian Gulf) and future maps are supported.
The RAT class creates an entry in the F10 radio menu which allows to:
- Create new groups on-the-fly, i.e. at run time within the mission,
- Destroy specific groups (e.g. if they get stuck or damaged and block a runway),
- Request the status of all RAT aircraft or individual groups,
- Place markers at waypoints on the F10 map for each group.
Note that by its very nature, this class is suited best for civil or transport aircraft. However, it also works perfectly fine for military aircraft of any kind.
More of the documentation include some simple examples can be found further down this page.
Additional Material:
- Demo Missions: GitHub
- YouTube videos: Random Air Traffic
- Guides: None
Author: funkyfranky
Global(s)
Global RAT |
Implements an easy to use way to randomly fill your map with AI aircraft. |
Implements an easy to use way to randomly fill your map with AI aircraft.
Airport Selection
Default settings:
- By default, aircraft are spawned at airports of their own coalition (blue or red) or neutral airports.
- Destination airports are by default also of neutral or of the same coalition as the template group of the spawned aircraft.
- Possible destinations are restricted by their distance to the departure airport. The maximal distance depends on the max range of spawned aircraft type and its initial fuel amount.
The default behavior can be changed:
- A specific departure and/or destination airport can be chosen.
- Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours".
- It is possible to start in air within a zone or within a zone above an airport of the map.
Flight Plan
- A general flight plan has five main airborne segments: Climb, cruise, descent, holding and final approach.
- Events monitored during the flight are: birth, engine-start, take-off, landing and engine-shutdown.
- The default flight level (FL) is set to ~FL200, i.e. 20000 feet ASL but randomized for each aircraft. Service ceiling of aircraft type is into account for max FL as well as the distance between departure and destination.
- Maximal distance between destination and departure airports depends on range and initial fuel of aircraft.
- Climb rate is set to a moderate value of ~1500 ft/min.
- The standard descent rate follows the 3:1 rule, i.e. 1000 ft decent per 3 miles of travel. Hence, angle of descent is ~3.6 degrees.
- A holding point is randomly selected at a distance between 5 and 10 km away from destination airport.
- The altitude of the holding point is ~1200 m AGL. Holding patterns might or might not happen with variable duration.
- If an aircraft is spawned in air, the procedure omits taxi and take-off and starts with the climb/cruising part.
- All values are randomized for each spawned aircraft.
Mission Editor Setup
Basic mission setup is very simple and essentially a three step process:
- Place your aircraft anywhere on the map. It really does not matter where you put it.
- Give the group a good name. In the example above the group is named "RAT_YAK".
- Activate the "LATE ACTIVATION" tick box. Note that this aircraft will not be spawned itself but serves a template for each RAT aircraft spawned when the mission starts.
Voilà , your already done!
Optionally, you can set a specific livery for the aircraft or give it some weapons. However, the aircraft will by default not engage any enemies. Think of them as being on a peaceful or ferry mission.
Basic Lua Script
The basic Lua script for one template group consists of two simple lines as shown in the picture above.
- Line 2 creates a new RAT object "yak". The only required parameter for the constructor RAT.New() is the name of the group as defined in the mission editor. In this example it is "RAT_YAK".
- Line 5 trigger the command to spawn the aircraft. The (optional) parameter for the RAT.Spawn() function is the number of aircraft to be spawned of this object. By default each of these aircraft gets a random departure airport anywhere on the map and a random destination airport, which lies within range of the of the selected aircraft type.
In this simple example aircraft are respawned with a completely new flightplan when they have reached their destination airport. The "old" aircraft is despawned (destroyed) after it has shut-down its engines and a new aircraft of the same type is spawned at a random departure airport anywhere on the map. Hence, the default flight plan for a RAT aircraft will be: Fly from airport A to B, get respawned at C and fly to D, get respawned at E and fly to F, ... This ensures that you always have a constant number of AI aircraft on your map.
Parking Problems
One big issue in DCS is that not all aircraft can be spawned on every airport or airbase. In particular, bigger aircraft might not have a valid parking spot at smaller airports and airstrips. This can lead to multiple problems in DCS.
- Landing: When an aircraft tries to land at an airport where it does not have a valid parking spot, it is immediately despawned the moment its wheels touch the runway, i.e. when a landing event is triggered. This leads to the loss of the RAT aircraft. On possible way to circumvent the this problem is to let another RAT aircraft spawn at landing and not when it shuts down its engines. See the RAT.RespawnAfterLanding() function.
- Spawning: When a big aircraft is dynamically spawned on a small airbase a few things can go wrong. For example, it could be spawned at a parking spot with a shelter. Or it could be damaged by a scenery object when it is taxiing out to the runway, or it could overlap with other aircraft on parking spots near by.
You can check yourself if an aircraft has a valid parking spot at an airbase by dragging its group on the airport in the mission editor and set it to start from ramp. If it stays at the airport, it has a valid parking spot, if it jumps to another airport, it does not have a valid parking spot on that airbase.
Setting the Terminal Type
Each parking spot has a specific type depending on its size or if a helicopter spot or a shelter etc. The classification is not perfect but it is the best we have. If you encounter problems described above, you can request a specific terminal type for the RAT aircraft. This can be done by the RAT.SetTerminalType(terminaltype) function. The parameter terminaltype can be set as follows
- AIRBASE.TerminalType.HelicopterOnly: Special spots for Helicopers.
- AIRBASE.TerminalType.Shelter: Hardened Air Shelter. Currently only on Caucaus map.
- AIRBASE.TerminalType.OpenMed: Open/Shelter air airplane only.
- AIRBASE.TerminalType.OpenBig: Open air spawn points. Generally larger but does not guarantee large aircraft are capable of spawning there.
- AIRBASE.TerminalType.OpenMedOrBig: Combines OpenMed and OpenBig spots.
- AIRBASE.TerminalType.HelicopterUsable: Combines HelicopterOnly, OpenMed and OpenBig.
- AIRBASE.TerminalType.FighterAircraft: Combines Shelter, OpenMed and OpenBig spots. So effectively all spots usable by fixed wing aircraft.
So for example
c17=RAT:New("C-17")
c17:SetTerminalType(AIRBASE.TerminalType.OpenBig)
c17:Spawn(5)
This would randomly spawn five C-17s but only on airports which have big open air parking spots. Note that also only destination airports are allowed which do have this type of parking spot. This should ensure that the aircraft is able to land at the destination without being despawned immediately.
Also, the aircraft are spawned only on the requested parking spot types and not on any other type. If no parking spot of this type is available at the moment of spawning, the group is automatically spawned in air above the selected airport.
Examples
Here are a few examples, how you can modify the default settings of RAT class objects.
Specify Departure and Destinations
In the picture above you find a few possibilities how to modify the default behaviour to spawn at random airports and fly to random destinations.
In particular, you can specify fixed departure and/or destination airports. This is done via the RAT.SetDeparture() or RAT.SetDestination() functions, respectively.
- If you only fix a specific departure airport via RAT.SetDeparture() all aircraft will be spawned at that airport and get random destination airports.
- If you only fix the destination airport via RAT.SetDestination(), aircraft a spawned at random departure airports but will all fly to the destination airport.
- If you fix departure and destination airports, aircraft will only travel from between those airports. When the aircraft reaches its destination, it will be respawned at its departure and fly again to its destination.
There is also an option that allows aircraft to "continue their journey" from their destination. This is achieved by the RAT.ContinueJourney() function. In that case, when the aircraft arrives at its first destination it will be respawned at that very airport and get a new random destination. So the flight plan in this case would be: Fly from airport A to B, then from B to C, then from C to D, ...
It is also possible to make aircraft "commute" between two airports, i.e. flying from airport A to B and then back from B to A, etc. This can be done by the RAT.Commute() function. Note that if no departure or destination airports are specified, the first departure and destination are chosen randomly. Then the aircraft will fly back and forth between those two airports indefinitely.
Spawn in Air
Aircraft can also be spawned in air rather than at airports on the ground. This is done by setting RAT.SetTakeoff() to "air".
By default, aircraft are spawned randomly above airports of the map.
The RAT.SetDeparture() option can be used to specify zones, which have been defined in the mission editor as departure zones. Aircraft will then be spawned at a random point within the zone or zones.
Note that RAT.SetDeparture() also accepts airport names. For an air takeoff these are treated like zones with a radius of XX kilometers. Again, aircraft are spawned at random points within these zones around the airport.
Misc Options
The default "takeoff" type of RAT aircraft is that they are spawned with hot or cold engines. The choice is random, so 50% of aircraft will be spawned with hot engines while the other 50% will be spawned with cold engines. This setting can be changed using the RAT.SetTakeoff() function. The possible parameters for starting on ground are:
- RAT.SetTakeoff("cold"), which means that all aircraft are spawned with their engines off,
- RAT.SetTakeoff("hot"), which means that all aircraft are spawned with their engines on,
- RAT.SetTakeoff("runway"), which means that all aircraft are spawned already at the runway ready to takeoff. Note that in this case the default spawn intervall is set to 180 seconds in order to avoid aircraft jams on the runway. Generally, this takeoff at runways should be used with care and problems are to be expected.
The options RAT.SetMinDistance() and RAT.SetMaxDistance() can be used to restrict the range from departure to destination. For example
- RAT.SetMinDistance(100) will cause only random destination airports to be selected which are at least 100 km away from the departure airport.
- RAT.SetMaxDistance(150) will allow only destination airports which are less than 150 km away from the departure airport.
By default planes get a cruise altitude of ~20,000 ft ASL. The actual altitude is sampled from a Gaussian distribution. The picture shows this distribution if one would spawn 1000 planes. As can be seen most planes get a cruising alt of around FL200. Other values are possible but less likely the further away one gets from the expectation value.
The expectation value, i.e. the altitude most aircraft get, can be set with the function RAT.SetFLcruise(). It is possible to restrict the minimum cruise altitude by RAT.SetFLmin() and the maximum cruise altitude by RAT.SetFLmax()
The cruise altitude can also be given in meters ASL by the functions RAT.SetCruiseAltitude(), RAT.SetMinCruiseAltitude() and RAT.SetMaxCruiseAltitude().
For example:
- RAT.SetFLcruise(300) will cause most planes fly around FL300.
- RAT.SetFLmin(100) restricts the cruising alt such that no plane will fly below FL100. Note that this automatically changes the minimum distance from departure to destination. That means that only destinations are possible for which the aircraft has had enough time to reach that flight level and descent again.
- RAT.SetFLmax(200) will restrict the cruise alt to maximum FL200, i.e. no aircraft will travel above this height.
Global RATMANAGER |
RATMANAGER class, extends Core.Base#BASEThe RATMANAGER class manages spawning of multiple RAT objects in a very simple way. |
RATMANAGER class, extends Core.Base#BASE
The RATMANAGER class manages spawning of multiple RAT objects in a very simple way.
It is created by the RATMANAGER.New() contructor. RAT objects with different "tasks" can be defined as usual. However, they must not be spawned via the RAT.Spawn() function.
Instead, these objects can be added to the manager via the RATMANAGER.Add(ratobject, min) function, where the first parameter "ratobject" is the #RAT object, while the second parameter "min" defines the minimum number of RAT aircraft of that object, which are alive at all time.
The #RATMANAGER must be started by the RATMANAGER.Start(startime) function, where the optional argument "startime" specifies the delay time in seconds after which the manager is started and the spawning beginns. If desired, the #RATMANAGER can be stopped by the RATMANAGER.Stop(stoptime) function. The parameter "stoptime" specifies the time delay in seconds after which the manager stops. When this happens, no new aircraft will be spawned and the population will eventually decrease to zero.
When you are using a time intervall like RATMANAGER.dTspawn(delay), #RATMANAGER will ignore the amount set with RATMANAGER.New(). RATMANAGER.dTspawn(delay) will spawn infinite groups.
Example
In this example, three different #RAT objects are created (but not spawned manually). The #RATMANAGER takes care that at least five aircraft of each type are alive and that the total number of aircraft spawned is 25. The #RATMANAGER is started after 30 seconds and stopped after two hours.
local a10c=RAT:New("RAT_A10C", "A-10C managed")
a10c:SetDeparture({"Batumi"})
local f15c=RAT:New("RAT_F15C", "F15C managed")
f15c:SetDeparture({"Sochi-Adler"})
f15c:DestinationZone()
f15c:SetDestination({"Zone C"})
local av8b=RAT:New("RAT_AV8B", "AV8B managed")
av8b:SetDeparture({"Zone C"})
av8b:SetTakeoff("air")
av8b:DestinationZone()
av8b:SetDestination({"Zone A"})
local manager=RATMANAGER:New(25)
manager:Add(a10c, 5)
manager:Add(f15c, 5)
manager:Add(av8b, 5)
manager:Start(30)
manager:Stop(7200)
Type(s)
Fields and Methods inherited from RAT | Description |
---|---|
Max number of planes that get landing clearance of the RAT ATC. |
|
Delay between granting landing clearance for simultanious landings. |
|
Turn messages from ATC on or off. |
|
Enable/disable ATC if set to true/false. |
|
Define how aircraft that are spawned in uncontrolled state are activate. |
|
Add all friendly airports to the list of possible departures. |
|
Add all friendly airports to the list of possible destinations |
|
Default angle of descenti in degrees. A value of 3.6 follows the 3:1 rule of 3 miles of travel and 1000 ft descent. |
|
Change aircraft type. |
|
Check if aircraft have accidentally been spawned on the runway. |
|
Check if aircraft have accidentally been spawned on top of each other. |
|
Name of the Class. |
|
Clear flight for landing. |
|
Aircraft will commute between their departure and destination airports or zones. |
|
Aircraft will continue their journey from their destination. |
|
Turn debug messages on or off. |
|
Enable debug mode. |
|
Destinations are treated as zones. |
|
Enable ATC, which manages the landing queue for RAT aircraft if they arrive simultaniously at the same airport. |
|
Airports, FARPs and ships explicitly excluded as departures and destinations. |
|
Cruise altitude of aircraft. Default FL200 for planes and F005 for helos. |
|
Maximum flight level set by user. |
|
Minimum flight level set by user. |
|
Flight level set by users explicitly. |
|
Get status of group. |
|
Aircraft are immortal. |
|
Aircraft are invisible. |
|
Set livery of aircraft. |
|
F10 menu items for this RAT object. |
|
Main F10 menu. |
|
Set the name of the F10 submenu. |
|
Number of departure airports set via SetDeparture(). |
|
Number of departure zones set via SetDeparture. |
|
Number of destination airports set via SetDestination(). |
|
Number of destination zones set via SetDestination(). |
|
Create a new RAT object. |
|
Aircraft will not get respawned when they finished their route. |
|
Max number of spawns. |
|
Place markers of waypoints on the F10 map. |
|
Set radio frequency. |
|
Radio menu Off. |
|
Radio menu On. |
|
Set radio modulation. |
|
Disable Radio. |
|
Enable Radio. |
|
Aircraft will not be respawned after they crashed or get shot down. |
|
Aircraft will be respawned after they crashed or get shot down. |
|
Make aircraft respawn the moment they land rather than at engine shut down. |
|
A new aircraft is spawned directly after the last one took off. |
|
If aircraft cannot be spawned on parking spots, it is allowed to spawn them in air above the same airport. |
|
If aircraft cannot be spawned on parking spots, it is NOT allowed to spawn them in air. |
|
Aircraft will fly to a random point within a zone and then return to its departure airport or zone. |
|
Set skill of AI aircraft. |
|
Set the climb rate. |
|
Set the friendly coalitions from which the airports can be used as departure and destination. |
|
Set coalition of RAT group. |
|
Set country of RAT group. |
|
Set cruising altitude. |
|
Set possible departure ports. |
|
Include all airports which lie in a zone as possible destinations. |
|
Set the angle of descent. |
|
Aircraft that reach their destination zone are not despawned. |
|
Set name of destination airports or zones for the AI aircraft. |
|
Include all airports which lie in a zone as possible destinations. |
|
Turn EPLRS datalink on/off. |
|
Set flight level. |
|
Set flight level of cruising part. |
|
Set max flight level. |
|
Set min flight level. |
|
Set max cruising altitude above sea level. |
|
Set the maximum cruise speed of the aircraft. |
|
Set maximum distance between departure and destination. |
|
Number of tries to respawn an aircraft in case it has accidentally been spawned on runway. |
|
Set min cruising altitude above sea level. |
|
Set minimum distance between departure and destination. |
|
Set onboard number prefix. |
|
Set the scan radius around parking spots. |
|
Disables scanning for scenery objects around parking spots which might block the spot. |
|
Enables scanning for scenery objects around parking spots which might block the spot. |
|
A parking spot is free as soon as possible aircraft has left the place. |
|
A parking spot is not free until a possible aircraft has left and taken off. |
|
Set rules of engagement (ROE). |
|
Set reaction to threat (ROT). |
|
Sets the delay between despawning and respawning aircraft. |
|
Set the delay before first group is spawned. |
|
Set the interval between spawnings of the template group. |
|
Set max number of groups that will be spawned. |
|
Set takeoff type. |
|
Set takeoff type to air. |
|
Set takeoff type cold. |
|
Set takeoff type to cold or hot. |
|
Set takeoff type to hot. |
|
Set takeoff type to runway. |
|
Set the terminal type the aircraft use when spawning at an airbase. |
|
Triggers the spawning of AI aircraft. |
|
Report status of RAT groups. |
|
Aircraft report status update messages along the route. |
|
Stop RAT spawning by unhandling events, stoping schedulers etc. |
|
Submenu name for RAT object. |
|
Set the time after which inactive groups will be destroyed. |
|
Time in seconds after which inactive units will be destroyed. Default is 300 seconds. |
|
Spawn aircraft in uncontrolled state. |
|
Default climb rate in ft/min. |
|
Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user. |
|
Adds andd initializes a new flight after it was spawned. |
|
Main ATC function. |
|
Giving landing clearance for aircraft by setting user flag. |
|
Deletes a flight from ATC lists after it landed. |
|
Takes care of organisational stuff after a plane has landed. |
|
Initializes the ATC arrays and starts schedulers. |
|
Creates a landing queue for all flights holding at airports. |
|
Registers a flight once it is near its holding point at the final destination. |
|
ATC status report about flights. |
|
Randomly activates an uncontrolled aircraft. |
|
Add names of all friendly airports to possible departure or destination airports if they are not already in the list. |
|
Test if an airport exists on the current map. |
|
Anticipated group name from alias and spawn index. |
|
Function checks consistency of user input and automatically adjusts parameters if necessary. |
|
Find aircraft that have accidentally been spawned on top of each other. |
|
Set RAT group to be (im-)mortal. |
|
Set RAT group to (in-)visible for other AI forces. |
|
Determine the heading from point a to point b. |
|
Turn debug messages on or off. |
|
Delete all markers on F10 map. |
|
Despawn group. |
|
Check if airport is excluded from possible departures and destinations. |
|
Find airports within a zone. |
|
Get all "friendly" airports of the current map. |
|
Get all airports of the current map. |
|
Get departure airbase of a given ratcraft. |
|
Get destination airbase of a given ratcraft. |
|
Get (relative) life of first unit of a group. |
|
Get aircraft dimensions length, width, height. |
|
Get ratcraft from group. |
|
Determine the heading for an aircraft to be entered in the route template. |
|
Initialize basic parameters of the aircraft based on its (template) group in the mission editor. |
|
Check if a given airbase has a FLIGHTCONTROL. |
|
Check if airport is friendly, i.e. |
|
Calculate minimum distance between departure and destination for given minimum flight level and climb/decent rates. |
|
Modifies the template of the group to be spawned. |
|
Check if a name/string is in a list or not. |
|
Function is executed when a unit is spawned. |
|
Function is executed when a unit crashes. |
|
Function is executed when a unit is dead. |
|
Function is executed when a unit is dead or crashes. |
|
Function is executed when a unit shuts down its engines. |
|
Function is executed when a unit starts its engines. |
|
Function is executed when a unit is hit. |
|
Function is executed when a unit lands. |
|
Function is executed when a unit takes off. |
|
Set the departure airport of the AI. |
|
RAT:_PickDestination(departure, q, minrange, maxrange, random, landing) |
Pick destination airport or zone depending on departure position. |
Place markers of the waypoints. |
|
Randomize a value by a certain amount. |
|
Remove ratcraft from self.ratcraft table. |
|
Despawn the original group and re-spawn a new one. |
|
Provide information about the assigned flightplan. |
|
Create a table with the valid coalitions for departure and destination airports. |
|
Set a marker visible for all on the F10 map. |
|
Set ROE for a group. |
|
Set ROT for a group. |
|
RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint) |
Set the route of the AI plane. |
Set status of group. |
|
Spawn the AI aircraft with a route. |
|
RAT:_Waypoint(index, description, Type, Coord, Speed, Altitude, Airport) |
Create a waypoint that can be used with the Route command. |
Test if a zone exists. |
|
Delay in seconds before first uncontrolled group is activated. Default is 5 seconds. |
|
Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds. |
|
Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0. |
|
Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1. |
|
If true, uncontrolled are activated randomly after certain time intervals. |
|
Add all friendly airports to departures. |
|
Add all friendly airports to destinations. |
|
Table which holds the basic aircraft properties (speed, range, ...). |
|
All airports of friedly coalitions. |
|
All airports available on current map (Caucasus, Nevada, Normandy, ...). |
|
Alias for spawned group. |
|
Number of groups which are alive. |
|
Category of aircarft: "plane" or "heli". |
|
Aircraft are checked if they were accidentally spawned on the runway. Default is true. |
|
Aircraft are checked if they were accidentally spawned on top of another unit. Default is true. |
|
Coalition of spawn group template. |
|
Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation. |
|
Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination. |
|
Country of spawn group template. |
|
Table with the valid coalitions from choice self.friendly. |
|
Zone containing the departure airports. |
|
Array containing the names of the destination airports or zones. |
|
If true, aircraft are despawned when they reach their destination zone. Default. |
|
Zone containing the destination airports. |
|
Array containing the names of the destination airports or zones. |
|
Destination is a zone and not an airport. |
|
If true, turn on EPLSR datalink for the RAT group. |
|
Array containing the names of explicitly excluded airports. |
|
If true, add an F10 radiomenu for RAT. Default is false. |
|
Radio frequency used by the RAT groups. |
|
Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red. |
|
Number of aircraft in group. |
|
Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way. |
|
Some ID to identify who we are in output of the DCS.log file. |
|
If true, aircraft are spawned as immortal. |
|
If true aircraft are set to invisible for other AI forces. |
|
Landing type. Determines if we actually land at an airport or treat it as zone. |
|
Log identifier. |
|
Livery of the aircraft set by user. |
|
Running number of placed markers on the F10 map. |
|
Array with marker IDs. |
|
Max distance from departure to destination in meters. Default 5000 km. |
|
Min distance from departure to destination in meters. Default 5 km. |
|
Ratio modulation. Either "FM" or "AM". |
|
Number of groups to be spawned in total. |
|
Aircraft will not be respawned after they have finished their route. |
|
Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor. |
|
(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1. |
|
Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3. |
|
Distance (in meters) from a runway spawn point until a unit is considered to have accidentally been spawned on a runway. Default is 75 m. |
|
Radius in meters until which a unit is considered to be on top of another. Default is 2 m. |
|
Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery. |
|
If true, area around parking spots is scanned for scenery objects. Default is false. |
|
If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false. |
|
Place markers of waypoints on F10 map. |
|
If true/false disables radio messages from the RAT groups. |
|
By default a random friendly airport is chosen as departure. |
|
By default a random friendly airport is chosen as destination. |
|
Array with the spawned RAT aircraft. |
|
Aircraft report status. |
|
Aircraft will be respawned after a crash, e.g. when they get shot down. |
|
Aircraft will be respawned directly after take-off. |
|
Respawn aircraft the moment they land rather than at engine shutdown. |
|
Delay in seconds until a repawn happens. |
|
Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true. |
|
Array containing the names of the return zones. |
|
Zone where aircraft will fly to before returning to their departure airport. |
|
ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free". |
|
ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade". |
|
Skill of AI. |
|
Delay time in seconds before first spawning happens. |
|
If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again. |
|
Interval between spawning units/groups. Note that we add a randomization of 50%. |
|
If true, aircraft travel A-->B-->A-->C-->A-->D... for commute. |
|
Intervall between status checks (and reports if enabled). |
|
Takeoff type. 0=coldorhot. |
|
Group serving as template for the RAT aircraft. |
|
Type of terminal to be used when spawning at an airbase. |
|
If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated. |
|
RAT version. |
|
Table with strings for waypoint descriptions of markers. |
|
Table with strings of waypoint status. |
|
Fields and Methods inherited from SPAWN | Description |
---|---|
Get the Coordinate of the Group that is Late Activated as the template for the SPAWN object. |
|
Will find the first alive Wrapper.Group it has spawned, and return the alive Wrapper.Group object and the first Index where the first alive Wrapper.Group object has been found. |
|
Get the group from an index. |
|
Will find the last alive Wrapper.Group object, and will return a reference to the last live Wrapper.Group object and the last Index where the last alive Wrapper.Group object has been found. |
|
Will find the next alive Wrapper.Group object from a given Index, and return a reference to the alive Wrapper.Group object and the next Index where the alive Wrapper.Group has been found. |
|
Get the index from a given group. |
|
Turns the AI Off for the Wrapper.Group when spawning. |
|
Turns the AI On for the Wrapper.Group when spawning. |
|
Turns the AI On or Off for the Wrapper.Group when spawning. |
|
Set spawns to happen at a particular airbase. |
|
RAT:InitArray(SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY) |
Makes the groups visible before start (like a battalion). |
[BLUE AIR only!] This method sets a specific callsign for a spawned group. |
|
Sets category ID of the group. |
|
Delete groups that have not moved for X seconds - AIR ONLY!!! DO NOT USE ON GROUPS THAT DO NOT MOVE OR YOUR SERVER WILL BURN IN HELL (Pikes - April 2020) When groups are still alive and have become inactive due to damage and are unable to contribute anything, then this group will be removed at defined intervals in seconds. |
|
Sets the coalition of the spawned group. |
|
Sets the country of the spawn group. |
|
Turns the Delay Off for the Wrapper.Group when spawning. |
|
Turns the Delay On for the Wrapper.Group when spawning with #SpawnScheduled(). |
|
Defines the heading of the overall formation of the new spawned group. |
|
When spawning a new group, make the grouping of the units according the InitGrouping setting. |
|
Defines the Heading for the new spawned units. |
|
Hide the group on MFDs (visible to game master slots!). |
|
Hide the group on the map view (visible to game master slots!). |
|
Hide the group on planner (visible to game master slots!). |
|
Keeps the unit names as defined within the mission editor, but note that anything after a # mark is ignored, and any spaces before and after the resulting name are removed. |
|
Flags that the spawned groups must be spawned late activated. |
|
Stops any more repeat spawns from happening once the UNIT count of Alive units, spawned by the same SPAWN object, exceeds the first parameter. |
|
Sets livery of the group. |
|
Sets the modex of the first unit of the group. |
|
This method sets a spawn position for the group that is different from the location of the template. |
|
This method sets a spawn position for the group that is different from the location of the template. |
|
Sets the radio communication on or off. |
|
Sets the radio frequency of the group. |
|
Set radio modulation. |
|
[AIR/Fighter only!] This method randomizes the callsign for a new group. |
|
RAT:InitRandomizePosition(RandomizePosition, OuterRadius, InnerRadius) |
Randomizes the position of Wrapper.Groups that are spawned within a radius band, given an Outer and Inner radius, from the point that the spawn happens. |
RAT:InitRandomizeRoute(SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight) |
Randomizes the defined route of the SpawnTemplatePrefix group in the ME. |
This method is rather complicated to understand. |
|
Randomize templates to be used as the unit representatives for the Spawned group, defined by specifying the prefix names. |
|
Randomize templates to be used as the unit representatives for the Spawned group, defined using a SET_GROUP object. |
|
RAT:InitRandomizeUnits(RandomizeUnits, OuterRadius, InnerRadius) |
Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius. |
This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types. |
|
For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment. |
|
Respawn after landing when its engines have shut down. |
|
Respawn group after landing. |
|
[Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set. |
|
[Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set. |
|
Spawn the UNITs of this group with individual absolute positions and individual headings. |
|
Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings. |
|
Sets skill of the group. |
|
[Airplane] Set the initial speed on spawning in knots. |
|
[Airplane] Set the initial speed on spawning in kilometers per hour. |
|
[Airplane] Set the initial speed on spawning in meters per second. |
|
(AIR) Will spawn a plane group in UnControlled or Controlled mode... |
|
Creates the main object to spawn a Wrapper.Group defined in the DCS ME. |
|
RAT:NewFromTemplate(SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix, NoMooseNamingPostfix) |
Creates a new SPAWN instance to create new groups based on the provided template. |
Creates a new SPAWN instance to create new groups based on the defined template and using a new alias for each new group. |
|
RAT:OnSpawnGroup(SpawnCallBackFunction, SpawnFunctionArguments, ...) |
Allows to place a CallFunction hook when a new group spawns. |
RAT:ParkAircraft(SpawnAirbase, TerminalType, Parkingdata, SpawnIndex) |
Will park a group at an Wrapper.Airbase. |
Will park a group at an Wrapper.Airbase. |
|
Will re-spawn a group based on a given index. |
|
Set the spawn index to a specified index number. |
|
Will spawn a group based on the internal index. |
|
Will spawn a group at an Wrapper.Airbase. |
|
Spawn a group on an Wrapper.Airbase at a specific parking spot. |
|
Will spawn a group from a Coordinate in 3D space. |
|
RAT:SpawnFromPointVec2(PointVec2, MinHeight, MaxHeight, SpawnIndex) |
Will spawn a group from a POINT_VEC2 in 3D space. |
Will spawn a group from a PointVec3 in 3D space. |
|
RAT:SpawnFromStatic(HostStatic, MinHeight, MaxHeight, SpawnIndex) |
Will spawn a group from a hosting static. |
RAT:SpawnFromUnit(HostUnit, MinHeight, MaxHeight, SpawnIndex) |
Will spawn a group from a hosting unit. |
Will spawn a group from a Vec2 in 3D space. |
|
Will spawn a group from a Vec3 in 3D space. |
|
Will return the SpawnGroupName either with with a specific count number or without any count. |
|
RAT:SpawnInZone(Zone, RandomizeGroup, MinHeight, MaxHeight, SpawnIndex) |
Will spawn a Group within a given Core.Zone. |
Will re-start the spawning scheduler. |
|
Will stop the scheduled spawning scheduler. |
|
RAT:SpawnScheduled(SpawnTime, SpawnTimeVariation, WithDelay) |
Spawns new groups at varying time intervals. |
Will spawn a group with a specified index number. |
|
Stop the SPAWN InitRepeat function (EVENT handler for takeoff, land and engine shutdown) |
|
Gets the CategoryID of the Group with the given SpawnPrefix |
|
Gets the CoalitionID of the Group with the given SpawnPrefix |
|
Gets the CountryID of the Group with the given SpawnPrefix |
|
Return the last maximum index that can be used. |
|
Return the prefix of a SpawnUnit. |
|
Return the prefix of a spawned group. |
|
Get the next index of the groups to be spawned. |
|
Gets the Group Template from the ME environment definition. |
|
Initalize the SpawnGroups collection. |
|
Will detect AIR Units shutting down their engines ... |
|
Will detect AIR Units landing... |
|
Will detect AIR Units taking off... |
|
Prepares the new Group Template. |
|
Private method randomizing the routes. |
|
Private method that randomizes the template of the group. |
|
Private method that randomizes the Core.Zones where the Group will be spawned. |
|
This function is called automatically by the Spawning scheduler. |
|
Private method that sets the DCS#Vec2 where the Group will be spawned. |
|
Schedules the CleanUp of Groups |
|
RAT:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle) |
|
Fields and Methods inherited from BASE | Description |
---|---|
The ID number of the class. |
|
The name of the class. |
|
The name of the class concatenated with the ID number of the class. |
|
Clear the state of an object. |
|
RAT:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace) |
Creation of a Birth Event. |
RAT:CreateEventCrash(EventTime, Initiator, IniObjectCategory) |
Creation of a Crash Event. |
RAT:CreateEventDead(EventTime, Initiator, IniObjectCategory) |
Creation of a Dead Event. |
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event. |
|
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event. |
|
Creation of a |
|
Creation of a Remove Unit Event. |
|
Creation of a Takeoff Event. |
|
Creation of a Crash Event. |
|
Log an exception which will be traced always. |
|
Returns the event dispatcher |
|
Remove all subscribed events |
|
Trace a function call. |
|
Trace a function call level 2. |
|
Trace a function call level 3. |
|
Get the ClassID of the class instance. |
|
Get the ClassName of the class instance. |
|
Get the ClassName + ClassID of the class instance. |
|
Get the Class Core.Event processing Priority. |
|
This is the worker method to retrieve the Parent class. |
|
Get a Value given a Key from the Object. |
|
Subscribe to a DCS Event. |
|
Log an information which will be traced always. |
|
This is the worker method to inherit from a parent class. |
|
This is the worker method to check if an object is an (sub)instance of a class. |
|
Enquires if tracing is on (for the class). |
|
BASE constructor. |
|
Occurs when an Event for an object is triggered. |
|
BDA. |
|
Occurs when a ground unit captures either an airbase or a farp. |
|
Occurs when any object is spawned into the mission. |
|
Occurs when any aircraft crashes into the ground and is completely destroyed. |
|
Occurs when an object is dead. |
|
Unknown precisely what creates this event, likely tied into newer damage model. |
|
Discard chair after ejection. |
|
Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo. |
|
Occurs when a dynamic cargo crate is removed. |
|
Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo. |
|
Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when any aircraft shuts down its engines. |
|
Occurs when any aircraft starts its engines. |
|
Occurs whenever an object is hit by a weapon. |
|
Occurs when any system fails on a human controlled aircraft. |
|
Occurs on the death of a unit. |
|
Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up. |
|
Landing quality mark. |
|
Occurs when a new mark was added. |
|
Occurs when a mark text was changed. |
|
Occurs when a mark was removed. |
|
Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a player creates a dynamic cargo object from the F8 ground crew menu. |
|
Weapon add. |
|
Occurs when the pilot of an aircraft is killed. |
|
Occurs when a player enters a slot and takes control of an aircraft. |
|
Occurs when any player assumes direct control of a unit. |
|
Occurs when any player relieves control of a unit to the AI. |
|
Occurs when an aircraft connects with a tanker and begins taking on fuel. |
|
Occurs when an aircraft is finished taking fuel. |
|
Occurs when any modification to the "Score" as seen on the debrief menu would occur. |
|
Occurs when any unit stops firing its weapon. |
|
Occurs when any unit begins firing a weapon that has a high rate of fire. |
|
Occurs whenever any unit in a mission fires a weapon. |
|
Occurs when an aircraft takes off from an airbase, farp, or ship. |
|
Trigger zone. |
|
Occurs when the game thinks an object is destroyed. |
|
Schedule a new time event. |
|
RAT:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...) |
Schedule a new time event. |
Stops the Schedule. |
|
Set the Class Core.Event processing Priority. |
|
Set a state or property of the Object given a Key and a Value. |
|
Trace a function logic level 1. |
|
Trace a function logic level 2. |
|
Trace a function logic level 3. |
|
Trace all methods in MOOSE |
|
Set tracing for a class |
|
Set tracing for a specific method of class |
|
Set trace level |
|
Set trace off. |
|
Set trace on. |
|
Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default. |
|
UnSubscribe to a DCS event. |
|
RAT:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function call. |
(Internal) Serialize arguments |
|
RAT:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function logic. |
The main event handling function... |
Fields and Methods inherited from RAT.ATC | Description |
---|---|
Number of flights that get landing clearance simultaniously. Default 2. |
|
Time stamp [sec, timer.getTime()] when ATC was initialized. |
|
List of airports. |
|
Delay between landing flights in seconds. Default 240 sec. |
|
List of flights. |
|
True if ATC was initialized. |
|
If |
|
Enumerator onfinal=100. |
|
Enumerator for unregistered flights unregistered=-1. |
Fields and Methods inherited from RAT.AtcAirport | Description |
---|---|
Number of flights on final. |
|
Time stamp when last flight started final approach. |
|
Whether airport is busy. |
|
List of flights on final. |
|
Queue. |
|
Number of flights that landed (just for stats). |
Fields and Methods inherited from RAT.AtcFlight | Description |
---|---|
Time stamp when flight arrived at holding. |
|
Time stamp when flight started final approach. |
|
Name of the destination airbase. |
|
Holding time. |
Fields and Methods inherited from RAT.ROE | Description |
---|---|
Fields and Methods inherited from RAT.ROT | Description |
---|---|
Fields and Methods inherited from RAT.RatCraft | Description |
---|---|
Distance travelled in meters. |
|
Current position. |
|
Whether the group is active or uncontrolled. |
|
Whether this group is airborne. |
|
Departure place of this group. Can also be a ZONE. |
|
Despawn group if |
|
Destination of this group. Can also be a ZONE. |
|
The flight group. |
|
The aircraft group. |
|
Spawn index. |
|
Laning type. |
|
Livery of the group. |
|
Number of respawns. |
|
Number of units. |
|
Status of the group. |
|
Takeoff type. |
|
Waypoints. |
|
Waypoint descriptins. |
|
Waypoint status. |
Fields and Methods inherited from RAT.cat | Description |
---|---|
Heli. |
|
Plane. |
Fields and Methods inherited from RAT.coal | Description |
---|---|
Fields and Methods inherited from RAT.status | Description |
---|---|
Fields and Methods inherited from RAT.unit | Description |
---|---|
Fields and Methods inherited from RAT.wp | Description |
---|---|
Fields and Methods inherited from RATMANAGER | Description |
---|---|
Adds a RAT object to the RAT manager. |
|
Name of the Class. |
|
If true, be more verbose on output in DCS.log file. |
|
Creates a new RATMANAGER object. |
|
Sets the time interval between checks of alive RAT groups. |
|
Sets the time interval between spawning of groups. |
|
Starts the RAT manager and spawns the initial random number RAT groups for each RAT object. |
|
Stops the RAT manager. |
|
Time interval in seconds between checking of alive groups. |
|
Counts the number of alive RAT objects. |
|
Manager function. |
|
Rolls the dice for the number of necessary spawns. |
|
Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object. |
|
Number of currently alive groups. |
|
Time interval in seconds between spawns of groups. |
|
Some ID to identify who we are in output of the DCS.log file. |
|
Scheduler managing the RAT objects. |
|
Managing scheduler id. |
|
Minimum number of RAT groups alive. |
|
Name (alias) of RAT object. |
|
Number of RAT objects. |
|
Total number of active RAT groups. |
|
Array holding RAT objects etc. |
Fields and Methods inherited from BASE | Description |
---|---|
The ID number of the class. |
|
The name of the class. |
|
The name of the class concatenated with the ID number of the class. |
|
Clear the state of an object. |
|
RATMANAGER:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace) |
Creation of a Birth Event. |
RATMANAGER:CreateEventCrash(EventTime, Initiator, IniObjectCategory) |
Creation of a Crash Event. |
RATMANAGER:CreateEventDead(EventTime, Initiator, IniObjectCategory) |
Creation of a Dead Event. |
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event. |
|
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event. |
|
Creation of a |
|
Creation of a Remove Unit Event. |
|
Creation of a Takeoff Event. |
|
Creation of a Crash Event. |
|
Log an exception which will be traced always. |
|
Returns the event dispatcher |
|
Remove all subscribed events |
|
Trace a function call. |
|
Trace a function call level 2. |
|
Trace a function call level 3. |
|
Get the ClassID of the class instance. |
|
Get the ClassName of the class instance. |
|
Get the ClassName + ClassID of the class instance. |
|
Get the Class Core.Event processing Priority. |
|
This is the worker method to retrieve the Parent class. |
|
Get a Value given a Key from the Object. |
|
Subscribe to a DCS Event. |
|
Log an information which will be traced always. |
|
This is the worker method to inherit from a parent class. |
|
This is the worker method to check if an object is an (sub)instance of a class. |
|
Enquires if tracing is on (for the class). |
|
BASE constructor. |
|
Occurs when an Event for an object is triggered. |
|
BDA. |
|
Occurs when a ground unit captures either an airbase or a farp. |
|
Occurs when any object is spawned into the mission. |
|
Occurs when any aircraft crashes into the ground and is completely destroyed. |
|
Occurs when an object is dead. |
|
Unknown precisely what creates this event, likely tied into newer damage model. |
|
Discard chair after ejection. |
|
Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo. |
|
Occurs when a dynamic cargo crate is removed. |
|
Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo. |
|
Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when any aircraft shuts down its engines. |
|
Occurs when any aircraft starts its engines. |
|
Occurs whenever an object is hit by a weapon. |
|
Occurs when any system fails on a human controlled aircraft. |
|
Occurs on the death of a unit. |
|
Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up. |
|
Landing quality mark. |
|
Occurs when a new mark was added. |
|
Occurs when a mark text was changed. |
|
Occurs when a mark was removed. |
|
Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a player creates a dynamic cargo object from the F8 ground crew menu. |
|
Weapon add. |
|
Occurs when the pilot of an aircraft is killed. |
|
Occurs when a player enters a slot and takes control of an aircraft. |
|
Occurs when any player assumes direct control of a unit. |
|
Occurs when any player relieves control of a unit to the AI. |
|
Occurs when an aircraft connects with a tanker and begins taking on fuel. |
|
Occurs when an aircraft is finished taking fuel. |
|
Occurs when any modification to the "Score" as seen on the debrief menu would occur. |
|
Occurs when any unit stops firing its weapon. |
|
Occurs when any unit begins firing a weapon that has a high rate of fire. |
|
Occurs whenever any unit in a mission fires a weapon. |
|
Occurs when an aircraft takes off from an airbase, farp, or ship. |
|
Trigger zone. |
|
Occurs when the game thinks an object is destroyed. |
|
Schedule a new time event. |
|
RATMANAGER:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...) |
Schedule a new time event. |
Stops the Schedule. |
|
Set the Class Core.Event processing Priority. |
|
Set a state or property of the Object given a Key and a Value. |
|
Trace a function logic level 1. |
|
Trace a function logic level 2. |
|
Trace a function logic level 3. |
|
Trace all methods in MOOSE |
|
Set tracing for a class |
|
Set tracing for a specific method of class |
|
Set trace level |
|
Set trace off. |
|
Set trace on. |
|
Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default. |
|
UnSubscribe to a DCS event. |
|
RATMANAGER:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function call. |
(Internal) Serialize arguments |
|
RATMANAGER:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function logic. |
The main event handling function... |
- RAT class
Field(s)
Enable/disable ATC if set to true/false.
Default angle of descenti in degrees. A value of 3.6 follows the 3:1 rule of 3 miles of travel and 1000 ft descent.
Name of the Class.
Turn debug messages on or off.
Cruise altitude of aircraft. Default FL200 for planes and F005 for helos.
Maximum flight level set by user.
Minimum flight level set by user.
Flight level set by users explicitly.
F10 menu items for this RAT object.
Main F10 menu.
Number of departure airports set via SetDeparture().
Number of departure zones set via SetDeparture.
Number of destination airports set via SetDestination().
Number of destination zones set via SetDestination().
Max number of spawns.
Submenu name for RAT object.
Time in seconds after which inactive units will be destroyed. Default is 300 seconds.
Default climb rate in ft/min.
Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.
Delay in seconds before first uncontrolled group is activated. Default is 5 seconds.
Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds.
Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0.
Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1.
If true, uncontrolled are activated randomly after certain time intervals.
Add all friendly airports to departures.
Add all friendly airports to destinations.
Table which holds the basic aircraft properties (speed, range, ...).
All airports of friedly coalitions.
All airports available on current map (Caucasus, Nevada, Normandy, ...).
Alias for spawned group.
Number of groups which are alive.
Category of aircarft: "plane" or "heli".
Aircraft are checked if they were accidentally spawned on the runway. Default is true.
Aircraft are checked if they were accidentally spawned on top of another unit. Default is true.
Coalition of spawn group template.
Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation.
Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination.
Country of spawn group template.
Table with the valid coalitions from choice self.friendly.
Array containing the names of the destination airports or zones.
If true, aircraft are despawned when they reach their destination zone. Default.
Array containing the names of the destination airports or zones.
Destination is a zone and not an airport.
If true, turn on EPLSR datalink for the RAT group.
Array containing the names of explicitly excluded airports.
If true, add an F10 radiomenu for RAT. Default is false.
Radio frequency used by the RAT groups.
Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.
Number of aircraft in group.
Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way.
Some ID to identify who we are in output of the DCS.log file.
If true, aircraft are spawned as immortal.
If true aircraft are set to invisible for other AI forces.
Landing type. Determines if we actually land at an airport or treat it as zone.
Log identifier.
Livery of the aircraft set by user.
Running number of placed markers on the F10 map.
Array with marker IDs.
Max distance from departure to destination in meters. Default 5000 km.
Min distance from departure to destination in meters. Default 5 km.
Ratio modulation. Either "FM" or "AM".
Number of groups to be spawned in total.
Aircraft will not be respawned after they have finished their route.
Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor.
(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1.
Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3.
Distance (in meters) from a runway spawn point until a unit is considered to have accidentally been spawned on a runway. Default is 75 m.
Radius in meters until which a unit is considered to be on top of another. Default is 2 m.
Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery.
If true, area around parking spots is scanned for scenery objects. Default is false.
If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false.
Place markers of waypoints on F10 map.
If true/false disables radio messages from the RAT groups.
By default a random friendly airport is chosen as departure.
By default a random friendly airport is chosen as destination.
Array with the spawned RAT aircraft.
Aircraft report status.
Aircraft will be respawned after a crash, e.g. when they get shot down.
Aircraft will be respawned directly after take-off.
Respawn aircraft the moment they land rather than at engine shutdown.
Delay in seconds until a repawn happens.
Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true.
Array containing the names of the return zones.
Zone where aircraft will fly to before returning to their departure airport.
ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free".
ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade".
Start scheduled spawning.
Status check and report scheduler.
Skill of AI.
Delay time in seconds before first spawning happens.
If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again.
Interval between spawning units/groups. Note that we add a randomization of 50%.
If true, aircraft travel A-->B-->A-->C-->A-->D... for commute.
Intervall between status checks (and reports if enabled).
Takeoff type. 0=coldorhot.
Type of terminal to be used when spawning at an airbase.
If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated.
RAT version.
Table with strings for waypoint descriptions of markers.
Table with strings of waypoint status.
Function(s)
Max number of planes that get landing clearance of the RAT ATC.
This setting effects all RAT objects and groups!
Defined in:
RAT
Parameter:
#number n
Number of aircraft that are allowed to land simultaniously. Default is 2.
Return value:
#RAT:
RAT self object.
Delay between granting landing clearance for simultanious landings.
This setting effects all RAT objects and groups!
Defined in:
RAT
Parameter:
#number time
Delay time when the next aircraft will get landing clearance event if the previous one did not land yet. Default is 240 sec.
Return value:
#RAT:
RAT self object.
Turn messages from ATC on or off.
Default is on. This setting effects all RAT objects and groups!
Defined in:
RAT
Parameter:
#boolean switch
Enable (true) or disable (false) messages from ATC.
Return value:
#RAT:
RAT self object.
Define how aircraft that are spawned in uncontrolled state are activate.
Defined in:
RAT
Parameters:
#number maxactivated
Maximal numnber of activated aircraft. Absolute maximum will be the number of spawned groups. Default is 1.
#number delay
Time delay in seconds before (first) aircraft is activated. Default is 1 second.
#number delta
Time difference in seconds before next aircraft is activated. Default is 1 second.
#number frand
Factor [0,...,1] for randomization of time difference between aircraft activations. Default is 0, i.e. no randomization.
Return value:
#RAT:
RAT self object.
Add all friendly airports to the list of possible departures.
Add all friendly airports to the list of possible destinations
Change aircraft type.
This is a dirty hack which allows to change the aircraft type of the template group. Note that all parameters like cruise speed, climb rate, range etc are still taken from the template group which likely leads to strange behaviour.
Defined in:
RAT
Parameter:
#string actype
Type of aircraft which is spawned independent of the template group. Use with care and expect problems!
Return value:
#RAT:
RAT self object.
Check if aircraft have accidentally been spawned on the runway.
If so they will be removed immediately.
Defined in:
RAT
Parameters:
#boolean switch
If true, check is performed. If false, this check is omitted.
#number radius
Distance in meters until a unit is considered to have spawned accidentally on the runway. Default is 75 m.
distance
Return value:
#RAT:
RAT self object.
Check if aircraft have accidentally been spawned on top of each other.
If yes, they will be removed immediately.
Defined in:
RAT
Parameters:
#boolean switch
If true, check is performed. If false, this check is omitted.
#number radius
Radius in meters until which a unit is considered to be on top of each other. Default is 2 m.
Return value:
#RAT:
RAT self object.
Clear flight for landing.
Sets tigger value to 1.
Defined in:
RAT
Parameter:
#string name
Name of flight to be cleared for landing.
Aircraft will commute between their departure and destination airports or zones.
Defined in:
RAT
Parameter:
#boolean starshape
If true, keep homebase, i.e. travel A-->B-->A-->C-->A-->D... instead of A-->B-->A-->B-->A...
Return value:
#RAT:
RAT self object.
Aircraft will continue their journey from their destination.
This means they are respawned at their destination and get a new random destination.
Enable debug mode.
More output in dcs.log file and onscreen messages to all.
Destinations are treated as zones.
Aircraft will not land but rather be despawned when they reach a random point in the zone.
Enable ATC, which manages the landing queue for RAT aircraft if they arrive simultaniously at the same airport.
Defined in:
RAT
Parameter:
#boolean switch
Enable ATC (true) or Disable ATC (false). No argument means ATC enabled.
Return value:
#RAT:
RAT self object.
Airports, FARPs and ships explicitly excluded as departures and destinations.
Defined in:
RAT
Parameter:
#string ports
Name or table of names of excluded airports.
Return value:
#RAT:
RAT self object.
Get status of group.
Defined in:
RAT
Parameter:
Wrapper.Group#GROUP group
Group.
Return value:
#string:
status Status of group.
Set livery of aircraft.
If more than one livery is specified in a table, the actually used one is chosen randomly from the selection.
Defined in:
RAT
Parameter:
#table skins
Name of livery or table of names of liveries.
Return value:
#RAT:
RAT self object.
Set the name of the F10 submenu.
Default is the name of the template group.
Create a new RAT object.
Defined in:
RAT
Parameters:
#string groupname
Name of the group as defined in the mission editor. This group is serving as a template for all spawned units.
#string alias
(Optional) Alias of the group. This is and optional parameter but must(!) be used if the same template group is used for more than one RAT object.
Return value:
#RAT:
Object of RAT class or nil if the group does not exist in the mission editor.
Usages:
yak1:RAT("RAT_YAK") will create a RAT object called "yak1". The template group in the mission editor must have the name "RAT_YAK".
yak2:RAT("RAT_YAK", "Yak2") will create a RAT object "yak2". The template group in the mission editor must have the name "RAT_YAK" but the group will be called "Yak2" in e.g. the F10 menu.
Aircraft will not get respawned when they finished their route.
Place markers of waypoints on the F10 map.
Default is off.
Set radio frequency.
Radio menu Off.
This is the default setting.
Radio menu On.
Default is off.
Set radio modulation.
Default is AM.
Defined in:
RAT
Parameter:
#string modulation
Either "FM" or "AM". If no value is given, modulation is set to AM.
Return value:
#RAT:
RAT self object.
Disable Radio.
Overrules the ME setting.
Enable Radio.
Overrules the ME setting.
Aircraft will not be respawned after they crashed or get shot down.
Aircraft will be respawned after they crashed or get shot down.
This is the default behavior.
Make aircraft respawn the moment they land rather than at engine shut down.
Defined in:
RAT
Parameter:
#number delay
(Optional) Delay in seconds until respawn happens after landing. Default is 1 second. Minimum is 1 second.
Return value:
#RAT:
RAT self object.
A new aircraft is spawned directly after the last one took off.
This creates a lot of outbound traffic. Aircraft are not respawned after they reached their destination. Therefore, this option is not to be used with the "commute" or "continue journey" options.
If aircraft cannot be spawned on parking spots, it is allowed to spawn them in air above the same airport.
Note that this is also the default behavior.
If aircraft cannot be spawned on parking spots, it is NOT allowed to spawn them in air.
This has only impact if aircraft are supposed to be spawned on the ground (and not in a zone).
Aircraft will fly to a random point within a zone and then return to its departure airport or zone.
Set skill of AI aircraft.
Default is "High".
Defined in:
RAT
Parameter:
#string skill
Skill, options are "Average", "Good", "High", "Excellent" and "Random". Parameter is case insensitive.
Return value:
#RAT:
RAT self object.
Set the climb rate.
This automatically sets the climb angle.
Defined in:
RAT
Parameter:
#number rate
Climb rate in ft/min. Default is 1500 ft/min. Minimum is 100 ft/min. Maximum is 15,000 ft/min.
Return value:
#RAT:
RAT self object.
Set the friendly coalitions from which the airports can be used as departure and destination.
Defined in:
RAT
Parameter:
#string friendly
"same"=own coalition+neutral (default), "sameonly"=own coalition only, "neutral"=all neutral airports. Default is "same", so aircraft will use airports of the coalition their spawn template has plus all neutral airports.
Return value:
#RAT:
RAT self object.
Usages:
yak:SetCoalition("neutral") will spawn aircraft randomly on all neutral airports.
yak:SetCoalition("sameonly") will spawn aircraft randomly on airports belonging to the same coalition only as the template.
Set coalition of RAT group.
You can make red templates blue and vice versa. Note that a country is also set automatically if it has not done before via RAT:SetCountry.
- For blue, the country is set to USA.
- For red, the country is set to RUSSIA.
- For neutral, the country is set to SWITZERLAND.
This is important, since it is ultimately the COUNTRY that determines the coalition of the aircraft. You can set the country explicitly via the RAT:SetCountry() function if necessary.
Defined in:
RAT
Parameter:
#string color
Color of coalition, i.e. "red" or blue" or "neutral".
Return value:
#RAT:
RAT self object.
Set country of RAT group.
See DCS_enum_country.
This overrules the coalition settings. So if you want your group to be of a specific coalition, you have to set a country that is part of that coalition.
Defined in:
RAT
Parameter:
DCS country enumerator ID. For example country.id.USA or country.id.RUSSIA.
Return value:
#RAT:
RAT self object.
Set cruising altitude.
This is still be checked for consitancy with selected route and prone to radomization.
Defined in:
RAT
Parameter:
#number alt
Cruising altitude ASL in meters.
Return value:
#RAT:
RAT self object.
Set possible departure ports.
This can be an airport or a zone.
Defined in:
RAT
Parameter:
#string departurenames
Name or table of names of departure airports or zones.
Return value:
#RAT:
RAT self object.
Usages:
RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport.
RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport.
RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
Include all airports which lie in a zone as possible destinations.
Defined in:
RAT
Parameter:
Core.Zone#ZONE zone
Zone in which the departure airports lie. Has to be a MOOSE zone.
Return value:
#RAT:
RAT self object.
Set the angle of descent.
Default is 3.6 degrees, which corresponds to 3000 ft descent after one mile of travel.
Defined in:
RAT
Parameter:
#number angle
Angle of descent in degrees. Minimum is 0.5 deg. Maximum 50 deg.
Return value:
#RAT:
RAT self object.
Aircraft that reach their destination zone are not despawned.
They will probably go the the nearest airbase and try to land.
Set name of destination airports or zones for the AI aircraft.
Defined in:
RAT
Parameter:
#string destinationnames
Name of the destination airport or #table of destination airports.
Return value:
#RAT:
RAT self object.
Usage:
RAT:SetDestination("Krymsk") makes all aircraft of this RAT object fly to Krymsk airport.
Include all airports which lie in a zone as possible destinations.
Defined in:
RAT
Parameter:
Core.Zone#ZONE zone
Zone in which the destination airports lie. Has to be a MOOSE zone.
Return value:
#RAT:
RAT self object.
Turn EPLRS datalink on/off.
Defined in:
RAT
Parameter:
#boolean switch
If true (or nil), turn EPLRS on.
Return value:
#RAT:
RAT self object.
Set flight level.
Setting this value will overrule all other logic. Aircraft will try to fly at this height regardless.
Defined in:
RAT
Parameter:
#number FL
Fight Level in hundrets of feet. E.g. FL200 = 20000 ft ASL.
Return value:
#RAT:
RAT self object.
Set flight level of cruising part.
This is still be checked for consitancy with selected route and prone to radomization. Default is FL200 for planes and FL005 for helicopters.
Defined in:
RAT
Parameter:
#number FL
Flight level in hundrets of feet. E.g. FL200 = 20000 ft ASL.
Return value:
#RAT:
RAT self object.
Set max flight level.
Setting this value will overrule all other logic. Aircraft will try to fly at less than this FL regardless.
Defined in:
RAT
Parameter:
#number FL
Maximum Fight Level in hundrets of feet.
Return value:
#RAT:
RAT self object.
Set min flight level.
Setting this value will overrule all other logic. Aircraft will try to fly at higher than this FL regardless.
Defined in:
RAT
Parameter:
#number FL
Maximum Fight Level in hundrets of feet.
Return value:
#RAT:
RAT self object.
Set max cruising altitude above sea level.
Set the maximum cruise speed of the aircraft.
Set maximum distance between departure and destination.
Default is 5000 km but aircarft range is also taken into account automatically.
Number of tries to respawn an aircraft in case it has accidentally been spawned on runway.
Defined in:
RAT
Parameter:
#number n
Number of retries. Default is 3.
Return value:
#RAT:
RAT self object.
Set min cruising altitude above sea level.
Set minimum distance between departure and destination.
Default is 5 km. Minimum distance should not be smaller than maybe ~100 meters to ensure that departure and destination are different.
Set onboard number prefix.
Same as setting "TAIL #" in the mission editor. Note that if you dont use this function, the values defined in the template group of the ME are taken.
Defined in:
RAT
Parameters:
#string tailnumprefix
String of the tail number prefix. If flight consists of more than one aircraft, two digits are appended automatically, i.e.
#number zero
(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 0.
Return value:
#RAT:
RAT self object.
Set the scan radius around parking spots.
Parking spot is considered to be occupied if any obstacle is found with the radius.
Defined in:
RAT
Parameter:
#number radius
Radius in meters. Default 50 m.
Return value:
#RAT:
RAT self object.
Disables scanning for scenery objects around parking spots which might block the spot.
This is also the default setting.
Enables scanning for scenery objects around parking spots which might block the spot.
A parking spot is free as soon as possible aircraft has left the place.
This is the default.
A parking spot is not free until a possible aircraft has left and taken off.
Set rules of engagement (ROE).
Default is weapon hold. This is a peaceful class.
Defined in:
RAT
Parameter:
#string roe
"hold" = weapon hold, "return" = return fire, "free" = weapons free.
Return value:
#RAT:
RAT self object.
Set reaction to threat (ROT).
Default is no reaction, i.e. aircraft will simply ignore all enemies.
Defined in:
RAT
Parameter:
#string rot
"noreaction" = no reaction to threats, "passive" = passive defence, "evade" = evade enemy attacks.
Return value:
#RAT:
RAT self object.
Sets the delay between despawning and respawning aircraft.
Defined in:
RAT
Parameter:
#number delay
Delay in seconds until respawn happens. Default is 1 second. Minimum is 1 second.
Return value:
#RAT:
RAT self object.
Set the delay before first group is spawned.
Defined in:
RAT
Parameter:
#number delay
Delay in seconds. Default is 5 seconds. Minimum delay is 0.5 seconds.
Return value:
#RAT:
RAT self object.
Set the interval between spawnings of the template group.
Defined in:
RAT
Parameter:
#number interval
Interval in seconds. Default is 5 seconds. Minimum is 0.5 seconds.
Return value:
#RAT:
RAT self object.
Set max number of groups that will be spawned.
When this limit is reached, no more RAT groups are spawned.
Defined in:
RAT
Parameter:
#number Nmax
Max number of groups. Default nil
=unlimited.
Return value:
#RAT:
RAT self object.
Set takeoff type.
Starting cold at airport, starting hot at airport, starting at runway, starting in the air. Default is "takeoff-coldorhot". So there is a 50% chance that the aircraft starts with cold engines and 50% that it starts with hot engines.
Defined in:
RAT
Parameter:
#string type
Type can be "takeoff-cold" or "cold", "takeoff-hot" or "hot", "takeoff-runway" or "runway", "air".
Return value:
#RAT:
RAT self object.
Usages:
RAT:Takeoff("hot") will spawn RAT objects at airports with engines started.
RAT:Takeoff("cold") will spawn RAT objects at airports with engines off.
RAT:Takeoff("air") will spawn RAT objects in air over random airports or within pre-defined zones.
Set takeoff type to air.
Aircraft will spawn in the air.
Set takeoff type cold.
Aircraft will spawn at a parking spot with engines off.
Set takeoff type to cold or hot.
Aircraft will spawn at a parking spot with 50:50 change of engines on or off.
Set takeoff type to hot.
Aircraft will spawn at a parking spot with engines on.
Set takeoff type to runway.
Aircraft will spawn directly on the runway.
Set the terminal type the aircraft use when spawning at an airbase.
See DCS_func_getParking. Note that some additional terminal types have been introduced. Check Wrapper.Airbase#AIRBASE class for details. Also note that only airports which have this kind of terminal are possible departures and/or destinations.
Defined in:
RAT
Parameter:
Wrapper.Airbase#AIRBASE.TerminalType termtype
Type of terminal. Use enumerator AIRBASE.TerminalType.XXX.
Return value:
#RAT:
RAT self object.
Usage:
c17=RAT:New("C-17 BIG Plane")
c17:SetTerminalType(AIRBASE.TerminalType.OpenBig) -- Only very big parking spots are used.
c17:Spawn(5)
Triggers the spawning of AI aircraft.
Note that all additional options should be set before giving the spawn command.
Defined in:
RAT
Parameter:
#number naircraft
(Optional) Number of aircraft to spawn. Default is one aircraft.
Return value:
#boolean:
True if spawning was successful or nil if nothing was spawned.
Usage:
yak:Spawn(5) will spawn five aircraft. By default aircraft will spawn at neutral and red airports if the template group is part of the red coalition.
Report status of RAT groups.
Defined in:
RAT
Parameters:
#boolean message
(Optional) Send message with report to all if true.
#number forID
(Optional) Send message only for this ID.
Aircraft report status update messages along the route.
Defined in:
RAT
Parameter:
#boolean switch
Swtich reports on (true) or off (false). No argument is on.
Return value:
#RAT:
RAT self object.
Stop RAT spawning by unhandling events, stoping schedulers etc.
Defined in:
RAT
Parameter:
#number delay
Delay before stop in seconds.
Set the time after which inactive groups will be destroyed.
Defined in:
RAT
Parameter:
#number time
Time in seconds. Default is 600 seconds = 10 minutes. Minimum is 60 seconds.
Return value:
#RAT:
RAT self object.
Spawn aircraft in uncontrolled state.
Aircraft will only sit at their parking spots. They can be activated randomly by the RAT:ActivateUncontrolled() function.
Adds andd initializes a new flight after it was spawned.
Defined in:
RAT
Parameters:
#string name
Group name of the flight.
#string dest
Name of the destination airport.
Main ATC function.
Updates the landing queue of all airports and inceases holding time for all flights.
Defined in:
RAT
Giving landing clearance for aircraft by setting user flag.
Defined in:
RAT
Parameters:
#string airportname
Name of destination airport.
#string flightname
Group name of flight, which gets landing clearence.
Deletes a flight from ATC lists after it landed.
Defined in:
RAT
Parameters:
#table t
Table.
#string entry
Flight name which shall be deleted.
Takes care of organisational stuff after a plane has landed.
Defined in:
RAT
Parameter:
#string name
Group name of flight.
Initializes the ATC arrays and starts schedulers.
Defined in:
RAT
Parameter:
#table airports_map
List of all airports of the map.
Creates a landing queue for all flights holding at airports.
Aircraft with longest holding time gets first permission to land.
Defined in:
RAT
Registers a flight once it is near its holding point at the final destination.
Defined in:
RAT
Parameters:
#string name
Group name of the flight.
#number time
Time the fight first registered.
Add names of all friendly airports to possible departure or destination airports if they are not already in the list.
Defined in:
RAT
Parameter:
#table ports
List of departure or destination airports/zones that will be added.
Test if an airport exists on the current map.
Defined in:
RAT
Parameter:
#string name
Return value:
#boolean:
True if airport exsits, false otherwise.
Anticipated group name from alias and spawn index.
Defined in:
RAT
Parameter:
#number index
Spawnindex of group if given or self.SpawnIndex+1 by default.
Return value:
#string:
Name the group will get after it is spawned.
Function checks consistency of user input and automatically adjusts parameters if necessary.
Defined in:
RAT
Find aircraft that have accidentally been spawned on top of each other.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
Units of this group will be checked.
#number distmin
Allowed distance in meters between units. Units with a distance smaller than this number are considered to be on top of each other.
Return value:
#boolean:
True if group was destroyed because it was on top of another unit. False if otherwise.
Set RAT group to be (im-)mortal.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
Group to be set (im-)mortal.
#boolean switch
True enables immortality, false disables it.
Set RAT group to (in-)visible for other AI forces.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
Group to be set (in)visible.
#boolean switch
If true, the group is invisible. If false the group will be visible.
Determine the heading from point a to point b.
Defined in:
RAT
Parameters:
Point from.
Point to.
Return value:
#number:
Heading/angle in degrees.
Turn debug messages on or off.
Default is off.
Defined in:
RAT
Parameter:
#boolean switch
Turn debug on=true or off=false. No argument means on.
Return value:
#RAT:
RAT self object.
Despawn group.
The FLIGHTGROUP
is despawned and stopped. The ratcraft is removed from the self.ratcraft table. Menues are removed.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
Group to be despawned.
#number delay
Delay in seconds before the despawn happens. Default is immidiately.
Check if airport is excluded from possible departures and destinations.
Defined in:
RAT
Parameter:
#string port
Name of airport, FARP or ship to check.
Return value:
#boolean:
true if airport is excluded and false otherwise.
Find airports within a zone.
Defined in:
RAT
Parameter:
Core.Zone#ZONE zone
Return value:
list Table with airport names that lie within the zone.
Get all "friendly" airports of the current map.
Fills the self.airports{} table.
Defined in:
RAT
Get departure airbase of a given ratcraft.
Defined in:
RAT
Parameter:
#RAT.RatCraft ratcraft
Ratcraft object.
Return value:
Destination airbase or nil.
Get destination airbase of a given ratcraft.
Defined in:
RAT
Parameter:
#RAT.RatCraft ratcraft
Ratcraft object.
Return value:
Destination airbase or nil.
Get (relative) life of first unit of a group.
Defined in:
RAT
Parameter:
Wrapper.Group#GROUP group
Group of unit.
Return value:
#number:
Life of unit in percent.
Get aircraft dimensions length, width, height.
Defined in:
RAT
Parameter:
Wrapper.Unit#UNIT unit
The unit which is we want the size of.
Return value:
#number:
Size, i.e. max(length,width) of unit.
Get ratcraft from group.
Defined in:
RAT
Parameter:
Wrapper.Group#Group group
The group object.
Return value:
The ratcraft object.
Determine the heading for an aircraft to be entered in the route template.
Defined in:
RAT
Parameter:
#number course
The course between two points in degrees.
Return value:
#number:
heading Heading in rad.
Initialize basic parameters of the aircraft based on its (template) group in the mission editor.
Check if a given airbase has a FLIGHTCONTROL.
Defined in:
RAT
Parameter:
Wrapper.Airbase#AIRBASE airbase
The airbase.
Return value:
#boolean:
true
if the airbase has a FLIGHTCONTROL.
Check if airport is friendly, i.e.
belongs to the right coalition.
Defined in:
RAT
Parameter:
#string port
Name of airport, FARP or ship to check.
Return value:
#boolean:
true if airport is friendly and false otherwise.
Calculate minimum distance between departure and destination for given minimum flight level and climb/decent rates.
Defined in:
RAT
Parameters:
#number alpha
Angle of climb [rad].
#number beta
Angle of descent [rad].
#number ha
Height difference between departure and cruise altiude.
#number hb
Height difference between cruise altitude and destination.
Return values:
#number:
d1 Minimum distance for climb phase to reach cruise altitude.
#number:
d2 Minimum distance for descent phase to reach destination height.
#number:
dtot Minimum total distance to climb and descent.
Modifies the template of the group to be spawned.
In particular, the waypoints of the group's flight plan are copied into the spawn template. This allows to spawn at airports and also land at other airports, i.e. circumventing the DCS "landing bug".
Defined in:
RAT
Parameters:
#table waypoints
The waypoints of the AI flight plan.
#string livery
(Optional) Livery of the aircraft. All members of a flight will get the same livery.
Core.Point#COORDINATE spawnplace
(Optional) Place where spawning should happen. If not present, first waypoint is taken.
Wrapper.Airbase#AIRBASE departure
Departure airbase or zone.
#number takeoff
Takeoff type.
#table parkingdata
Parking data, i.e. parking spot coordinates and terminal ids for all units of the group.
#boolean uncontrolled
If true
, group is spawned uncontrolled.
Return value:
#boolean:
True if modification was successful or nil if not, e.g. when no parking space was found and spawn in air is disabled.
Check if a name/string is in a list or not.
Defined in:
RAT
Parameters:
#table liste
List of names to be checked.
#string name
Name to be checked for.
Function is executed when a unit is spawned.
Function is executed when a unit crashes.
Function is executed when a unit is dead.
Function is executed when a unit is dead or crashes.
Function is executed when a unit shuts down its engines.
Function is executed when a unit starts its engines.
Function is executed when a unit is hit.
Function is executed when a unit lands.
Function is executed when a unit takes off.
Set the departure airport of the AI.
If no airport name is given explicitly an airport from the coalition is chosen randomly. If takeoff style is set to "air", we use zones around the airports or the zones specified by user input.
Defined in:
RAT
Parameter:
#number takeoff
Takeoff type.
Return values:
Departure airport if spawning at airport.
Departure zone if spawning in air.
Pick destination airport or zone depending on departure position.
Defined in:
RAT
Parameters:
Wrapper.Airbase#AIRBASE departure
Departure airport or zone.
Coordinate of the departure point.
#number minrange
Minimum range to q in meters.
#number maxrange
Maximum range to q in meters.
#boolean random
Destination is randomly selected from friendly airport (true) or from destinations specified by user input (false).
#number landing
Number indicating whether we land at a destination airport or fly to a zone object.
Return value:
destination Destination airport or zone.
Place markers of the waypoints.
Note we assume a very specific number and type of waypoints here.
Defined in:
RAT
Parameters:
#table waypoints
Table with waypoints.
#table waypointdescriptions
Table with waypoint descriptions
#number index
Spawn index of group.
Randomize a value by a certain amount.
Defined in:
RAT
Parameters:
#number value
The value which should be randomized
#number fac
Randomization factor.
#number lower
(Optional) Lower limit of the returned value.
#number upper
(Optional) Upper limit of the returned value.
Return value:
#number:
Randomized value.
Usages:
_Randomize(100, 0.1) returns a value between 90 and 110, i.e. a plus/minus ten percent variation.
_Randomize(100, 0.5, nil, 120) returns a value between 50 and 120, i.e. a plus/minus fivty percent variation with upper bound 120.
Remove ratcraft from self.ratcraft table.
Defined in:
RAT
Parameter:
#RAT.RatCraft ratcraft
The ratcraft to be removed.
Return value:
#RAT:
self
Despawn the original group and re-spawn a new one.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
The group that should be respawned.
Core.Point#COORDINATE lastpos
Last known position of the group.
#number delay
Delay before despawn in seconds.
Provide information about the assigned flightplan.
Defined in:
RAT
Parameters:
#table waypoints
Waypoints of the flight plan.
#string comment
Some comment to identify the provided information.
#table waypointdescriptions
Waypoint descriptions.
Return value:
#number:
total Total route length in meters.
Create a table with the valid coalitions for departure and destination airports.
Defined in:
RAT
Set a marker visible for all on the F10 map.
Defined in:
RAT
Parameters:
#string text
Info text displayed at maker.
#table wp
Position of marker coming in as waypoint, i.e. has x, y and alt components.
#number index
Spawn index of group.
Set ROE for a group.
Defined in:
RAT
Parameters:
Ops.FlightGroup#FLIGHTGROUP flightgroup
Group for which the ROE is set.
#string roe
ROE of group.
Set ROT for a group.
Defined in:
RAT
Parameters:
Ops.FlightGroup#FLIGHTGROUP flightgroup
Group for which the ROT is set.
#string rot
ROT of group.
Set the route of the AI plane.
Due to DCS landing bug, this has to be done before the unit is spawned.
Defined in:
RAT
Parameters:
#number takeoff
Takeoff type. Could also be air start.
#number landing
Landing type. Could also be a destination in air.
Wrapper.Airbase#AIRBASE _departure
(Optional) Departure airbase.
Wrapper.Airbase#AIRBASE _destination
(Optional) Destination airbase.
#table _waypoint
Initial waypoint.
Return values:
Departure airbase.
Destination airbase.
#table:
Table of flight plan waypoints.
#table:
Table of waypoint descriptions.
#table:
Table of waypoint status.
Set status of group.
Spawn the AI aircraft with a route.
Sets the departure and destination airports and waypoints. Modifies the spawn template. Sets ROE/ROT. Initializes the ratcraft array and group menu.
Defined in:
RAT
Parameters:
#string _departure
(Optional) Name of departure airbase.
#string _destination
(Optional) Name of destination airbase.
#number _takeoff
Takeoff type id.
#number _landing
Landing type id.
#string _livery
Livery to use for this group.
#table _waypoint
First waypoint to be used (for continue journey, commute, etc).
Core.Point#COORDINATE _lastpos
(Optional) Position where the aircraft will be spawned.
#number _nrespawn
Number of already performed respawn attempts (e.g. spawning on runway bug).
#table parkingdata
Explicitly specify the parking spots when spawning at an airport.
Return value:
#number:
Spawn index.
Create a waypoint that can be used with the Route command.
Defined in:
RAT
Parameters:
#number index
Running index of waypoints. Starts with 1 which is normally departure/spawn waypoint.
#string description
Descrition of Waypoint.
#number Type
Type of waypoint.
Core.Point#COORDINATE Coord
3D coordinate of the waypoint.
#number Speed
Speed in m/s.
#number Altitude
Altitude in m.
Wrapper.Airbase#AIRBASE Airport
Airport of object to spawn.
Return value:
#table:
Waypoints for DCS task route or spawn template.
Test if a zone exists.
Defined in:
RAT
Parameter:
#string name
Return value:
#boolean:
True if zone exsits, false otherwise.
Field(s)
Enable/disable ATC if set to true/false.
Default angle of descenti in degrees. A value of 3.6 follows the 3:1 rule of 3 miles of travel and 1000 ft descent.
Name of the Class.
Turn debug messages on or off.
Cruise altitude of aircraft. Default FL200 for planes and F005 for helos.
Maximum flight level set by user.
Minimum flight level set by user.
Flight level set by users explicitly.
F10 menu items for this RAT object.
Main F10 menu.
Number of departure airports set via SetDeparture().
Number of departure zones set via SetDeparture.
Number of destination airports set via SetDestination().
Number of destination zones set via SetDestination().
Max number of spawns.
Submenu name for RAT object.
Time in seconds after which inactive units will be destroyed. Default is 300 seconds.
Default climb rate in ft/min.
Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.
Delay in seconds before first uncontrolled group is activated. Default is 5 seconds.
Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds.
Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0.
Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1.
If true, uncontrolled are activated randomly after certain time intervals.
Add all friendly airports to departures.
Add all friendly airports to destinations.
Table which holds the basic aircraft properties (speed, range, ...).
All airports of friedly coalitions.
All airports available on current map (Caucasus, Nevada, Normandy, ...).
Alias for spawned group.
Number of groups which are alive.
Category of aircarft: "plane" or "heli".
Aircraft are checked if they were accidentally spawned on the runway. Default is true.
Aircraft are checked if they were accidentally spawned on top of another unit. Default is true.
Coalition of spawn group template.
Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation.
Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination.
Country of spawn group template.
Table with the valid coalitions from choice self.friendly.
Array containing the names of the destination airports or zones.
If true, aircraft are despawned when they reach their destination zone. Default.
Array containing the names of the destination airports or zones.
Destination is a zone and not an airport.
If true, turn on EPLSR datalink for the RAT group.
Array containing the names of explicitly excluded airports.
If true, add an F10 radiomenu for RAT. Default is false.
Radio frequency used by the RAT groups.
Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.
Number of aircraft in group.
Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way.
Some ID to identify who we are in output of the DCS.log file.
If true, aircraft are spawned as immortal.
If true aircraft are set to invisible for other AI forces.
Landing type. Determines if we actually land at an airport or treat it as zone.
Log identifier.
Livery of the aircraft set by user.
Running number of placed markers on the F10 map.
Array with marker IDs.
Max distance from departure to destination in meters. Default 5000 km.
Min distance from departure to destination in meters. Default 5 km.
Ratio modulation. Either "FM" or "AM".
Number of groups to be spawned in total.
Aircraft will not be respawned after they have finished their route.
Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor.
(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1.
Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3.
Distance (in meters) from a runway spawn point until a unit is considered to have accidentally been spawned on a runway. Default is 75 m.
Radius in meters until which a unit is considered to be on top of another. Default is 2 m.
Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery.
If true, area around parking spots is scanned for scenery objects. Default is false.
If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false.
Place markers of waypoints on F10 map.
If true/false disables radio messages from the RAT groups.
By default a random friendly airport is chosen as departure.
By default a random friendly airport is chosen as destination.
Array with the spawned RAT aircraft.
Aircraft report status.
Aircraft will be respawned after a crash, e.g. when they get shot down.
Aircraft will be respawned directly after take-off.
Respawn aircraft the moment they land rather than at engine shutdown.
Delay in seconds until a repawn happens.
Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true.
Array containing the names of the return zones.
Zone where aircraft will fly to before returning to their departure airport.
ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free".
ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade".
Start scheduled spawning.
Status check and report scheduler.
Skill of AI.
Delay time in seconds before first spawning happens.
If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again.
Interval between spawning units/groups. Note that we add a randomization of 50%.
If true, aircraft travel A-->B-->A-->C-->A-->D... for commute.
Intervall between status checks (and reports if enabled).
Takeoff type. 0=coldorhot.
Type of terminal to be used when spawning at an airbase.
If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated.
RAT version.
Table with strings for waypoint descriptions of markers.
Table with strings of waypoint status.
Function(s)
Get the Coordinate of the Group that is Late Activated as the template for the SPAWN object.
Will find the first alive Wrapper.Group it has spawned, and return the alive Wrapper.Group object and the first Index where the first alive Wrapper.Group object has been found.
Defined in:
Return values:
Wrapper.Group#GROUP, #number:
The Wrapper.Group object found, the new Index where the group was found.
#nil, #nil:
When no group is found, #nil is returned.
Usage:
-- Find the first alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
while GroupPlane ~= nil do
-- Do actions with the GroupPlane object.
GroupPlane, Index = SpawnPlanes:GetNextAliveGroup( Index )
end
Get the group from an index.
Returns the group from the SpawnGroups list. If no index is given, it will return the first group in the list.
Defined in:
Parameter:
#number SpawnIndex
The index of the group to return.
Return value:
self
Will find the last alive Wrapper.Group object, and will return a reference to the last live Wrapper.Group object and the last Index where the last alive Wrapper.Group object has been found.
Defined in:
Return values:
Wrapper.Group#GROUP, #number:
The last alive Wrapper.Group object found, the last Index where the last alive Wrapper.Group object was found.
#nil, #nil:
When no alive Wrapper.Group object is found, #nil is returned.
Usage:
-- Find the last alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
local GroupPlane, Index = SpawnPlanes:GetLastAliveGroup()
if GroupPlane then -- GroupPlane can be nil!!!
-- Do actions with the GroupPlane object.
end
Will find the next alive Wrapper.Group object from a given Index, and return a reference to the alive Wrapper.Group object and the next Index where the alive Wrapper.Group has been found.
Defined in:
Parameter:
#number SpawnIndexStart
A Index holding the start position to search from. This method can also be used to find the first alive Wrapper.Group object from the given Index.
Return values:
Wrapper.Group#GROUP, #number:
The next alive Wrapper.Group object found, the next Index where the next alive Wrapper.Group object was found.
#nil, #nil:
When no alive Wrapper.Group object is found from the start Index position, #nil is returned.
Usage:
-- Find the first alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
while GroupPlane ~= nil do
-- Do actions with the GroupPlane object.
GroupPlane, Index = SpawnPlanes:GetNextAliveGroup( Index )
end
Get the index from a given group.
The function will search the name of the group for a #, and will return the number behind the #-mark.
Turns the AI Off for the Wrapper.Group when spawning.
Turns the AI On for the Wrapper.Group when spawning.
Turns the AI On or Off for the Wrapper.Group when spawning.
Defined in:
Parameter:
#boolean AIOnOff
A value of true sets the AI On, a value of false sets the AI Off.
Return value:
The SPAWN object
Set spawns to happen at a particular airbase.
Only for aircraft, of course.
Defined in:
Parameters:
#string AirbaseName
Name of the airbase.
#number Takeoff
(Optional) Takeoff type. Can be SPAWN.Takeoff.Hot (default), SPAWN.Takeoff.Cold or SPAWN.Takeoff.Runway.
#number TerminalType
(Optional) The terminal type.
Return value:
self
Makes the groups visible before start (like a battalion).
The method will take the position of the group as the first position in the array. CAUTION: this directive will NOT work with OnSpawnGroup function.
Defined in:
Parameters:
#number SpawnAngle
The angle in degrees how the groups and each unit of the group will be positioned.
#number SpawnWidth
The amount of Groups that will be positioned on the X axis.
#number SpawnDeltaX
The space between each Group on the X-axis.
#number SpawnDeltaY
The space between each Group on the Y-axis.
Return value:
self
Usage:
-- Define an array of Groups.
Spawn_BE_Ground = SPAWN:New( 'BE Ground' )
:InitLimit( 2, 24 )
:InitArray( 90, 10, 100, 50 )
[BLUE AIR only!] This method sets a specific callsign for a spawned group.
Use for a group with one unit only!
Defined in:
Parameters:
#number ID
ID of the callsign enumerator, e.g. CALLSIGN.Tanker.Texaco - - resulting in e.g. Texaco-2-1
#string Name
Name of this callsign as it cannot be determined from the ID because of the dependency on the task type of the plane, and the plane type. E.g. "Texaco"
#number Minor
Minor number, i.e. the unit number within the group, e.g 2 - resulting in e.g. Texaco-2-1
#number Major
Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1
Return value:
self
Sets category ID of the group.
Delete groups that have not moved for X seconds - AIR ONLY!!! DO NOT USE ON GROUPS THAT DO NOT MOVE OR YOUR SERVER WILL BURN IN HELL (Pikes - April 2020) When groups are still alive and have become inactive due to damage and are unable to contribute anything, then this group will be removed at defined intervals in seconds.
Defined in:
Parameter:
#string SpawnCleanUpInterval
The interval to check for inactive groups within seconds.
Return value:
self
Usage:
Spawn_Helicopter:InitCleanUp( 20 ) -- CleanUp the spawning of the helicopters every 20 seconds when they become inactive.
Sets the coalition of the spawned group.
Note that it might be necessary to also set the country explicitly!
Defined in:
Parameter:
DCS#coalition.side Coalition
Coalition of the group as number of enumerator:
Return value:
self
Sets the country of the spawn group.
Note that the country determines the coalition of the group depending on which country is defined to be on which side for each specific mission!
Defined in:
Parameter:
#number Country
Country id as number or enumerator:
Return value:
self
Turns the Delay Off for the Wrapper.Group when spawning.
Turns the Delay On for the Wrapper.Group when spawning with #SpawnScheduled().
In effect then the 1st group will only be spawned after the number of seconds given in SpawnScheduled as arguments, and not immediately.
Defines the heading of the overall formation of the new spawned group.
The heading can be given as one fixed degree, or can be randomized between minimum and maximum degrees. The Group's formation as laid out in its template will be rotated around the first unit in the group Group individual units facings will rotate to match. If InitHeading is also applied to this SPAWN then that will take precedence for individual unit facings. Note that InitGroupHeading does not rotate the groups route; only its initial facing!
Defined in:
Parameters:
#number HeadingMin
The minimum or fixed heading in degrees.
#number HeadingMax
(optional) The maximum heading in degrees. This there is no maximum heading, then the heading for the group will be HeadingMin.
#number unitVar
(optional) Individual units within the group will have their heading randomized by +/- unitVar degrees. Default is zero.
Return value:
self
Usage:
mySpawner = SPAWN:New( ... )
-- Spawn the Group with the formation rotated +100 degrees around unit #1, compared to the mission template.
mySpawner:InitGroupHeading( 100 )
-- Spawn the Group with the formation rotated units between +100 and +150 degrees around unit #1, compared to the mission template, and with individual units varying by +/- 10 degrees from their templated facing.
mySpawner:InitGroupHeading( 100, 150, 10 )
-- Spawn the Group with the formation rotated -60 degrees around unit #1, compared to the mission template, but with all units facing due north regardless of how they were laid out in the template.
mySpawner:InitGroupHeading(-60):InitHeading(0)
-- or
mySpawner:InitHeading(0):InitGroupHeading(-60)
When spawning a new group, make the grouping of the units according the InitGrouping setting.
Defined in:
Parameter:
#number Grouping
Indicates the maximum amount of units in the group.
Return value:
Defines the Heading for the new spawned units.
The heading can be given as one fixed degree, or can be randomized between minimum and maximum degrees.
Defined in:
Parameters:
#number HeadingMin
The minimum or fixed heading in degrees.
#number HeadingMax
(optional) The maximum heading in degrees. This there is no maximum heading, then the heading will be fixed for all units using minimum heading.
Return value:
self
Usage:
Spawn = SPAWN:New( ... )
-- Spawn the units pointing to 100 degrees.
Spawn:InitHeading( 100 )
-- Spawn the units pointing between 100 and 150 degrees.
Spawn:InitHeading( 100, 150 )
Hide the group on MFDs (visible to game master slots!).
Hide the group on the map view (visible to game master slots!).
Defined in:
Parameter:
#boolean OnOff
Defaults to true
Return value:
The SPAWN object
Hide the group on planner (visible to game master slots!).
Keeps the unit names as defined within the mission editor, but note that anything after a # mark is ignored, and any spaces before and after the resulting name are removed.
IMPORTANT! This method MUST be the first used after :New !!!
Defined in:
Parameter:
#boolean KeepUnitNames
(optional) If true, the unit names are kept, false or not provided create new unit names.
Return value:
self
Flags that the spawned groups must be spawned late activated.
Defined in:
Parameter:
#boolean LateActivated
(optional) If true, the spawned groups are late activated.
Return value:
self
Stops any more repeat spawns from happening once the UNIT count of Alive units, spawned by the same SPAWN object, exceeds the first parameter.
Also can stop spawns from happening once a total GROUP still alive is met. Exceptionally powerful when combined with SpawnSchedule for Respawning. Note that this method is exceptionally important to balance the performance of the mission. Depending on the machine etc, a mission can only process a maximum amount of units. If the time interval must be short, but there should not be more Units or Groups alive than a maximum amount of units, then this method should be used... When a SPAWN.New is executed and the limit of the amount of units alive is reached, then no new spawn will happen of the group, until some of these units of the spawn object will be destroyed.
Defined in:
Parameters:
#number SpawnMaxUnitsAlive
The maximum amount of units that can be alive at runtime.
#number SpawnMaxGroups
The maximum amount of groups that can be spawned. When the limit is reached, then no more actual spawns will happen of the group. This parameter is useful to define a maximum amount of airplanes, ground troops, helicopters, ships etc within a supply area. This parameter accepts the value 0, which defines that there are no maximum group limits, but there are limits on the maximum of units that can be alive at the same time.
Return value:
self
Usage:
-- NATO helicopters engaging in the battle field.
-- This helicopter group consists of one Unit. So, this group will SPAWN maximum 2 groups simultaneously within the DCSRTE.
-- There will be maximum 24 groups spawned during the whole mission lifetime.
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitLimit( 2, 24 )
Sets livery of the group.
Defined in:
Parameter:
#string Livery
Livery name. Note that this is not necessarily the same name as displayed in the mission editor.
Return value:
self
Sets the modex of the first unit of the group.
If more units are in the group, the number is increased by one with every unit.
Defined in:
Parameters:
#number modex
Modex of the first unit.
#string prefix
(optional) String to prefix to modex, e.g. for French AdA Modex, eg. -L-102 then "-L-" would be the prefix.
#string postfix
(optional) String to postfix to modex, example tbd.
Return value:
self
This method sets a spawn position for the group that is different from the location of the template.
Defined in:
Parameter:
Core.Point#COORDINATE Coordinate
The position to spawn from
Return value:
self
This method sets a spawn position for the group that is different from the location of the template.
Sets the radio communication on or off.
Same as checking/unchecking the COMM box in the mission editor.
Defined in:
Parameter:
#number switch
If true (or nil), enables the radio communication. If false, disables the radio for the spawned group.
Return value:
self
Sets the radio frequency of the group.
Defined in:
Parameter:
#number frequency
The frequency in MHz.
Return value:
self
Set radio modulation.
Default is AM.
Defined in:
Parameter:
#string modulation
Either "FM" or "AM". If no value is given, modulation is set to AM.
Return value:
self
[AIR/Fighter only!] This method randomizes the callsign for a new group.
Randomizes the position of Wrapper.Groups that are spawned within a radius band, given an Outer and Inner radius, from the point that the spawn happens.
Defined in:
Parameters:
#boolean RandomizePosition
If true, SPAWN will perform the randomization of the Wrapper.Groups position between a given outer and inner radius.
DCS#Distance OuterRadius
(optional) The outer radius in meters where the new group will be spawned.
DCS#Distance InnerRadius
(optional) The inner radius in meters where the new group will NOT be spawned.
Return value:
Randomizes the defined route of the SpawnTemplatePrefix group in the ME.
This is very useful to define extra variation of the behavior of groups.
Defined in:
Parameters:
#number SpawnStartPoint
is the waypoint where the randomization begins. Note that the StartPoint = 0 equaling the point where the group is spawned.
#number SpawnEndPoint
is the waypoint where the randomization ends counting backwards. This parameter is useful to avoid randomization to end at a waypoint earlier than the last waypoint on the route.
#number SpawnRadius
is the radius in meters in which the randomization of the new waypoints, with the original waypoint of the original template located in the middle ...
#number SpawnHeight
(optional) Specifies the additional height in meters that can be added to the base height specified at each waypoint in the ME.
Return value:
Usage:
-- NATO helicopters engaging in the battle field.
-- The KA-50 has waypoints Start point ( =0 or SP ), 1, 2, 3, 4, End point (= 5 or DP).
-- Waypoints 2 and 3 will only be randomized. The others will remain on their original position with each new spawn of the helicopter.
-- The randomization of waypoint 2 and 3 will take place within a radius of 2000 meters.
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeRoute( 2, 2, 2000 )
This method is rather complicated to understand.
But I'll try to explain. This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.
Defined in:
Parameter:
#list<#string> SpawnTemplatePrefixTable
A table with the names of the groups defined within the mission editor, from which one will be chosen when a new group will be spawned.
Return value:
Usage:
-- NATO Tank Platoons invading Gori.
-- Choose between 13 different 'US Tank Platoon' configurations for each new SPAWN the Group to be spawned for the
-- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SpawnTemplatePrefixes.
-- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
-- with a limit set of maximum 12 Units alive simultaneously and 150 Groups to be spawned during the whole mission.
Spawn_US_Platoon = { 'US Tank Platoon 1', 'US Tank Platoon 2', 'US Tank Platoon 3', 'US Tank Platoon 4', 'US Tank Platoon 5',
'US Tank Platoon 6', 'US Tank Platoon 7', 'US Tank Platoon 8', 'US Tank Platoon 9', 'US Tank Platoon 10',
'US Tank Platoon 11', 'US Tank Platoon 12', 'US Tank Platoon 13' }
Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
Randomize templates to be used as the unit representatives for the Spawned group, defined by specifying the prefix names.
This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.
Defined in:
Parameter:
#string SpawnTemplatePrefixes
A string or a list of string that contains the prefixes of the groups that are possible unit representatives of the group to be spawned.
Return value:
Usage:
-- NATO Tank Platoons invading Gori.
-- Choose between different 'US Tank Platoon Templates' configurations to be spawned for the
-- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.
-- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
-- with a limit set of maximum 12 Units alive simultaneously and 150 Groups to be spawned during the whole mission.
Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
Randomize templates to be used as the unit representatives for the Spawned group, defined using a SET_GROUP object.
This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.
Defined in:
Parameter:
Core.Set#SET_GROUP SpawnTemplateSet
A SET_GROUP object set, that contains the groups that are possible unit representatives of the group to be spawned.
Return value:
Usage:
-- NATO Tank Platoons invading Gori.
-- Choose between different 'US Tank Platoon Template' configurations to be spawned for the
-- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.
-- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
-- with a limit set of maximum 12 Units alive simultaneously and 150 Groups to be spawned during the whole mission.
Spawn_US_PlatoonSet = SET_GROUP:New():FilterPrefixes( "US Tank Platoon Templates" ):FilterOnce()
-- Now use the Spawn_US_PlatoonSet to define the templates using InitRandomizeTemplateSet.
Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius.
Defined in:
Parameters:
#boolean RandomizeUnits
If true, SPAWN will perform the randomization of the Wrapper.Unit#UNITs position within the group between a given outer and inner radius.
DCS#Distance OuterRadius
(optional) The outer radius in meters where the new group will be spawned.
DCS#Distance InnerRadius
(optional) The inner radius in meters where the new group will NOT be spawned.
Return value:
Usage:
-- NATO helicopters engaging in the battle field.
-- UNIT positions of this group will be randomized around the base unit #1 in a circle of 50 to 500 meters.
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeUnits( true, 500, 50 )
This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.
Defined in:
Parameter:
#table SpawnZoneTable
Return value:
self
Usage:
-- Create a zone table of the 2 zones.
ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }
Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" )
:InitLimit( 10, 10 )
:InitRandomizeRoute( 1, 1, 200 )
:InitRandomizeZones( ZoneTable )
:SpawnScheduled( 5, .5 )
For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.
This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed. This will enable a spawned group to be re-spawned after it lands, until it is destroyed... Note: When the group is respawned, it will re-spawn from the original airbase where it took off. So ensure that the routes for groups that respawn, always return to the original airbase, or players may get confused ...
Defined in:
Return value:
self
Usage:
-- RU Su-34 - AI Ship Attack
-- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
SpawnRU_SU34 = SPAWN:New( 'Su-34' )
:Schedule( 2, 3, 1800, 0.4 )
:SpawnUncontrolled()
:InitRandomizeRoute( 1, 1, 3000 )
:InitRepeatOnEngineShutDown()
Respawn after landing when its engines have shut down.
Defined in:
Return value:
self
Usage:
-- RU Su-34 - AI Ship Attack
-- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
SpawnRU_SU34 = SPAWN:New( 'Su-34' )
:SpawnUncontrolled()
:InitRandomizeRoute( 1, 1, 3000 )
:InitRepeatOnEngineShutDown()
:Spawn()
Respawn group after landing.
Defined in:
Return value:
self
Usage:
-- RU Su-34 - AI Ship Attack
-- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
SpawnRU_SU34 = SPAWN:New( 'Su-34' )
:InitRandomizeRoute( 1, 1, 3000 )
:InitRepeatOnLanding()
:Spawn()
[Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set.
Defined in:
Parameter:
#number Octal
The octal number (digits 1..7, max 4 digits, i.e. 1..7777) to set the SADL to. Every SADL needs to be unique!
Return value:
self
[Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set.
Defined in:
Parameter:
#number Octal
The octal number (digits 1..7, max 5 digits, i.e. 1..77777) to set the STN to. Every STN needs to be unique!
Return value:
self
Spawn the UNITs of this group with individual absolute positions and individual headings.
Defined in:
Parameter:
#table Positions
Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z absolute positions, and optionally an individual heading.
Return value:
Usage:
-- NATO helicopter group of three units engaging in the battle field.
local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitAbsolutePositions(Positions)
Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.
Defined in:
Parameter:
#table Positions
Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z relative positions, and optionally an individual heading.
Return value:
Usage:
-- NATO helicopter group of three units engaging in the battle field.
local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitRelativePositions(Positions)
Sets skill of the group.
Defined in:
Parameter:
#string Skill
Skill, possible values "Average", "Good", "High", "Excellent" or "Random".
Return value:
self
[Airplane] Set the initial speed on spawning in knots.
Useful when spawning in-air only.
Defined in:
Parameter:
#number Knots
The speed in knots to use.
Return value:
self
[Airplane] Set the initial speed on spawning in kilometers per hour.
Useful when spawning in-air only.
Defined in:
Parameter:
#number KPH
The speed in KPH to use.
Return value:
self
[Airplane] Set the initial speed on spawning in meters per second.
Useful when spawning in-air only.
Defined in:
Parameter:
#number MPS
The speed in MPS to use.
Return value:
self
(AIR) Will spawn a plane group in UnControlled or Controlled mode...
This will be similar to the uncontrolled flag setting in the ME. You can use UnControlled mode to simulate planes startup and ready for take-off but aren't moving (yet). ReSpawn the plane in Controlled mode, and the plane will move...
Defined in:
Parameter:
#boolean UnControlled
true if UnControlled, false if Controlled.
Return value:
self
Creates the main object to spawn a Wrapper.Group defined in the DCS ME.
Defined in:
Parameter:
#string SpawnTemplatePrefix
is the name of the Group in the ME that defines the Template. Each new group will have the name starting with SpawnTemplatePrefix.
Return value:
Usages:
-- NATO helicopters engaging in the battle field. Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' )
local Plane = SPAWN:New( "Plane" ) -- Creates a new local variable that can initiate new planes with the name "Plane#ddd" using the template "Plane" as defined within the ME.
Creates a new SPAWN instance to create new groups based on the provided template.
This will also register the template for future use.
Defined in:
Parameters:
#table SpawnTemplate
is the Template of the Group. This must be a valid Group Template structure - see Hoggit Wiki!
#string SpawnTemplatePrefix
[Mandatory] is the name of the template and the prefix of the GROUP on spawn. The name in the template will be overwritten!
#string SpawnAliasPrefix
[Optional] is the prefix that will be given to the GROUP on spawn.
#boolean NoMooseNamingPostfix
[Optional] If true, skip the Moose naming additions (like groupname#001-01) - but you need to ensure yourself no duplicate group names exist!
Return value:
self
Usage:
-- Spawn a P51 Mustang from scratch
local ttemp =
{
["modulation"] = 0,
["tasks"] =
{
}, -- end of ["tasks"]
["task"] = "Reconnaissance",
["uncontrolled"] = false,
["route"] =
{
["points"] =
{
[1] =
{
["alt"] = 2000,
["action"] = "Turning Point",
["alt_type"] = "BARO",
["speed"] = 125,
["task"] =
{
["id"] = "ComboTask",
["params"] =
{
["tasks"] =
{
}, -- end of ["tasks"]
}, -- end of ["params"]
}, -- end of ["task"]
["type"] = "Turning Point",
["ETA"] = 0,
["ETA_locked"] = true,
["y"] = 666285.71428571,
["x"] = -312000,
["formation_template"] = "",
["speed_locked"] = true,
}, -- end of [1]
}, -- end of ["points"]
}, -- end of ["route"]
["groupId"] = 1,
["hidden"] = false,
["units"] =
{
[1] =
{
["alt"] = 2000,
["alt_type"] = "BARO",
["livery_id"] = "USAF 364th FS",
["skill"] = "High",
["speed"] = 125,
["type"] = "TF-51D",
["unitId"] = 1,
["psi"] = 0,
["y"] = 666285.71428571,
["x"] = -312000,
["name"] = "P51-1-1",
["payload"] =
{
["pylons"] =
{
}, -- end of ["pylons"]
["fuel"] = 340.68,
["flare"] = 0,
["chaff"] = 0,
["gun"] = 100,
}, -- end of ["payload"]
["heading"] = 0,
["callsign"] =
{
[1] = 1,
[2] = 1,
["name"] = "Enfield11",
[3] = 1,
}, -- end of ["callsign"]
["onboard_num"] = "010",
}, -- end of [1]
}, -- end of ["units"]
["y"] = 666285.71428571,
["x"] = -312000,
["name"] = "P51",
["communication"] = true,
["start_time"] = 0,
["frequency"] = 124,
}
local mustang = SPAWN:NewFromTemplate(ttemp,"P51D")
-- you MUST set the next three:
mustang:InitCountry(country.id.FRANCE)
mustang:InitCategory(Group.Category.AIRPLANE)
mustang:InitCoalition(coalition.side.BLUE)
mustang:OnSpawnGroup(
function(grp)
MESSAGE:New("Group Spawned: "..grp:GetName(),15,"SPAWN"):ToAll()
end
)
mustang:Spawn()
Creates a new SPAWN instance to create new groups based on the defined template and using a new alias for each new group.
Defined in:
Parameters:
#string SpawnTemplatePrefix
is the name of the Group in the ME that defines the Template.
#string SpawnAliasPrefix
is the name that will be given to the Group at runtime.
Return value:
self
Usages:
-- NATO helicopters engaging in the battle field. Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
local PlaneWithAlias = SPAWN:NewWithAlias( "Plane", "Bomber" ) -- Creates a new local variable that can instantiate new planes with the name "Bomber#ddd" using the template "Plane" as defined within the ME.
Allows to place a CallFunction hook when a new group spawns.
The provided method will be called when a new group is spawned, including its given parameters. The first parameter of the SpawnFunction is the Wrapper.Group#GROUP that was spawned.
Defined in:
Parameters:
#function SpawnCallBackFunction
The function to be called when a group spawns.
SpawnFunctionArguments
A random amount of arguments to be provided to the function when the group spawns.
...
Return value:
Usage:
-- Declare SpawnObject and call a function when a new Group is spawned.
local SpawnObject = SPAWN:New( "SpawnObject" )
:InitLimit( 2, 10 )
:OnSpawnGroup( function( SpawnGroup )
SpawnGroup:E( "I am spawned" )
end
)
:SpawnScheduled( 300, 0.3 )
Will park a group at an Wrapper.Airbase.
Defined in:
Parameters:
Wrapper.Airbase#AIRBASE SpawnAirbase
The Wrapper.Airbase where to spawn the group.
Wrapper.Airbase#AIRBASE.TerminalType TerminalType
(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.
#table Parkingdata
(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactily these spots!
SpawnIndex
Return value:
#nil:
Nothing is returned!
Will park a group at an Wrapper.Airbase.
This method is mostly advisable to be used if you want to simulate parking units at an airbase and be visible. Note that each point in the route assigned to the spawning group is reset to the point of the spawn.
All groups that are in the spawn collection and that are alive, and not in the air, are parked.
The Wrapper.Airbase#AIRBASE object must refer to a valid airbase known in the sim. You can use the following enumerations to search for the pre-defined airbases on the current known maps of DCS:
- Wrapper.Airbase#AIRBASE.Caucasus: The airbases on the Caucasus map.
- Wrapper.Airbase#AIRBASE.Nevada: The airbases on the Nevada (NTTR) map.
- Wrapper.Airbase#AIRBASE.Normandy: The airbases on the Normandy map.
Use the method Wrapper.Airbase#AIRBASE.FindByName() to retrieve the airbase object. The known AIRBASE objects are automatically imported at mission start by MOOSE. Therefore, there isn't any New() constructor defined for AIRBASE objects.
Ships and FARPs are added within the mission, and are therefore not known. For these AIRBASE objects, there isn't an Wrapper.Airbase#AIRBASE enumeration defined. You need to provide the exact name of the airbase as the parameter to the Wrapper.Airbase#AIRBASE.FindByName() method!
Defined in:
Parameters:
Wrapper.Airbase#AIRBASE SpawnAirbase
The Wrapper.Airbase where to spawn the group.
Wrapper.Airbase#AIRBASE.TerminalType TerminalType
(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.
#table Parkingdata
(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactily these spots!
Return value:
#nil:
Nothing is returned!
Usage:
Spawn_Plane = SPAWN:New( "Plane" )
Spawn_Plane:ParkAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ) )
Spawn_Heli = SPAWN:New( "Heli")
Spawn_Heli:ParkAtAirbase( AIRBASE:FindByName( "FARP Cold" ) )
Spawn_Heli:ParkAtAirbase( AIRBASE:FindByName( "Carrier" ) )
Spawn_Plane:ParkAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), AIRBASE.TerminalType.OpenBig )
Will re-spawn a group based on a given index.
Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.
Defined in:
Parameter:
#string SpawnIndex
The index of the group to be spawned.
Return value:
The group that was spawned. You can use this group for further actions.
Set the spawn index to a specified index number.
This method can be used to "reset" the spawn counter to a specific index number. This will actually enable a respawn of groups from the specific index.
Defined in:
Parameter:
#string SpawnIndex
The index of the group from where the spawning will start again. The default value would be 0, which means a complete reset of the spawnindex.
Return value:
self
Will spawn a group based on the internal index.
Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.
Defined in:
Return value:
The group that was spawned. You can use this group for further actions.
Will spawn a group at an Wrapper.Airbase.
This method is mostly advisable to be used if you want to simulate spawning units at an airbase. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.
The Wrapper.Airbase#AIRBASE object must refer to a valid airbase known in the sim. You can use the following enumerations to search for the pre-defined airbases on the current known maps of DCS:
- Wrapper.Airbase#AIRBASE.Caucasus: The airbases on the Caucasus map.
- Wrapper.Airbase#AIRBASE.Nevada: The airbases on the Nevada (NTTR) map.
- Wrapper.Airbase#AIRBASE.Normandy: The airbases on the Normandy map.
Use the method Wrapper.Airbase#AIRBASE.FindByName() to retrieve the airbase object. The known AIRBASE objects are automatically imported at mission start by MOOSE. Therefore, there isn't any New() constructor defined for AIRBASE objects.
Ships and FARPs are added within the mission, and are therefore not known. For these AIRBASE objects, there isn't an Wrapper.Airbase#AIRBASE enumeration defined. You need to provide the exact name of the airbase as the parameter to the Wrapper.Airbase#AIRBASE.FindByName() method!
Defined in:
Parameters:
Wrapper.Airbase#AIRBASE SpawnAirbase
The Wrapper.Airbase where to spawn the group.
#SPAWN.Takeoff Takeoff
(optional) The location and takeoff method. Default is Hot.
#number TakeoffAltitude
(optional) The altitude above the ground.
Wrapper.Airbase#AIRBASE.TerminalType TerminalType
(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.
#boolean EmergencyAirSpawn
(optional) If true (default), groups are spawned in air if there is no parking spot at the airbase. If false, nothing is spawned if no parking spot is available.
#table Parkingdata
(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactly these spots!
Return value:
The group that was spawned or nil when nothing was spawned.
Usage:
Spawn_Plane = SPAWN:New( "Plane" )
Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Cold )
Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Hot )
Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Runway )
Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( "Carrier" ), SPAWN.Takeoff.Cold )
Spawn_Heli = SPAWN:New( "Heli")
Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Cold" ), SPAWN.Takeoff.Cold )
Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Hot" ), SPAWN.Takeoff.Hot )
Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Runway" ), SPAWN.Takeoff.Runway )
Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Air" ), SPAWN.Takeoff.Air )
Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "Carrier" ), SPAWN.Takeoff.Cold )
Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Cold, nil, AIRBASE.TerminalType.OpenBig )
Spawn a group on an Wrapper.Airbase at a specific parking spot.
Defined in:
Parameters:
Wrapper.Airbase#AIRBASE Airbase
The Wrapper.Airbase where to spawn the group.
#table Spots
Table of parking spot IDs. Note that these in general are different from the numbering in the mission editor!
#SPAWN.Takeoff Takeoff
(Optional) Takeoff type, i.e. either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is Hot.
Return value:
The group that was spawned or nil when nothing was spawned.
Will spawn a group from a Coordinate in 3D space.
This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.
Defined in:
Parameters:
Core.Point#Coordinate Coordinate
The Coordinate coordinates where to spawn the group.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return value:
that was spawned or #nil if nothing was spawned.
Will spawn a group from a POINT_VEC2 in 3D space.
This method is mostly advisable to be used if you want to simulate spawning groups on the ground from air units, like vehicles. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.
Defined in:
Parameters:
Core.Point#POINT_VEC2 PointVec2
The PointVec2 coordinates where to spawn the group.
#number MinHeight
(optional) The minimum height to spawn an airborne group into the zone.
#number MaxHeight
(optional) The maximum height to spawn an airborne group into the zone.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return value:
that was spawned or #nil if nothing was spawned.
Usage:
local SpawnPointVec2 = ZONE:New( ZoneName ):GetPointVec2()
-- Spawn at the zone center position at the height specified in the ME of the group template!
SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2 )
-- Spawn from the static position at the height randomized between 2000 and 4000 meters.
SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2, 2000, 4000 )
Will spawn a group from a PointVec3 in 3D space.
This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.
Defined in:
Parameters:
Core.Point#POINT_VEC3 PointVec3
The PointVec3 coordinates where to spawn the group.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return value:
that was spawned or #nil if nothing was spawned.
Usage:
local SpawnPointVec3 = ZONE:New( ZoneName ):GetPointVec3( 2000 ) -- Get the center of the ZONE object at 2000 meters from the ground.
-- Spawn at the zone center position at 2000 meters from the ground!
SpawnAirplanes:SpawnFromPointVec3( SpawnPointVec3 )
Will spawn a group from a hosting static.
This method is mostly advisable to be used if you want to simulate spawning from buldings and structures (static buildings). You can use the returned group to further define the route to be followed.
Defined in:
Parameters:
Wrapper.Static#STATIC HostStatic
The static dropping or unloading the group.
#number MinHeight
(optional) The minimum height to spawn an airborne group into the zone.
#number MaxHeight
(optional) The maximum height to spawn an airborne group into the zone.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return value:
that was spawned or #nil if nothing was spawned.
Usage:
local SpawnStatic = STATIC:FindByName( StaticName )
-- Spawn from the static position at the height specified in the ME of the group template!
SpawnAirplanes:SpawnFromStatic( SpawnStatic )
-- Spawn from the static position at the height randomized between 2000 and 4000 meters.
SpawnAirplanes:SpawnFromStatic( SpawnStatic, 2000, 4000 )
Will spawn a group from a hosting unit.
This method is mostly advisable to be used if you want to simulate spawning from air units, like helicopters, which are dropping infantry into a defined Landing Zone. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.
Defined in:
Parameters:
Wrapper.Unit#UNIT HostUnit
The air or ground unit dropping or unloading the group.
#number MinHeight
(optional) The minimum height to spawn an airborne group into the zone.
#number MaxHeight
(optional) The maximum height to spawn an airborne group into the zone.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return values:
Usage:
local SpawnStatic = STATIC:FindByName( StaticName )
-- Spawn from the static position at the height specified in the ME of the group template!
SpawnAirplanes:SpawnFromUnit( SpawnStatic )
-- Spawn from the static position at the height randomized between 2000 and 4000 meters.
SpawnAirplanes:SpawnFromUnit( SpawnStatic, 2000, 4000 )
Will spawn a group from a Vec2 in 3D space.
This method is mostly advisable to be used if you want to simulate spawning groups on the ground from air units, like vehicles. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.
Defined in:
Parameters:
DCS#Vec2 Vec2
The Vec2 coordinates where to spawn the group.
#number MinHeight
(optional) The minimum height to spawn an airborne group into the zone.
#number MaxHeight
(optional) The maximum height to spawn an airborne group into the zone.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return value:
that was spawned or #nil if nothing was spawned.
Usage:
local SpawnVec2 = ZONE:New( ZoneName ):GetVec2()
-- Spawn at the zone center position at the height specified in the ME of the group template!
SpawnAirplanes:SpawnFromVec2( SpawnVec2 )
-- Spawn from the static position at the height randomized between 2000 and 4000 meters.
SpawnAirplanes:SpawnFromVec2( SpawnVec2, 2000, 4000 )
Will spawn a group from a Vec3 in 3D space.
This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.
Defined in:
Parameters:
DCS#Vec3 Vec3
The Vec3 coordinates where to spawn the group.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return value:
that was spawned or #nil if nothing was spawned.
Will return the SpawnGroupName either with with a specific count number or without any count.
Defined in:
Parameter:
#number SpawnIndex
Is the number of the Group that is to be spawned.
Return value:
#string:
SpawnGroupName
Will spawn a Group within a given Core.Zone.
The Core.Zone can be of any type derived from Core.Zone#ZONE_BASE. Once the Wrapper.Group is spawned within the zone, the Wrapper.Group will continue on its route. The first waypoint (where the group is spawned) is replaced with the zone location coordinates.
Defined in:
Parameters:
Core.Zone#ZONE Zone
The zone where the group is to be spawned.
#boolean RandomizeGroup
(optional) Randomization of the Wrapper.Group position in the zone.
#number MinHeight
(optional) The minimum height to spawn an airborne group into the zone.
#number MaxHeight
(optional) The maximum height to spawn an airborne group into the zone.
#number SpawnIndex
(optional) The index which group to spawn within the given zone.
Return value:
that was spawned or #nil if nothing was spawned.
Usage:
local SpawnZone = ZONE:New( ZoneName )
-- Spawn at the zone center position at the height specified in the ME of the group template!
SpawnAirplanes:SpawnInZone( SpawnZone )
-- Spawn in the zone at a random position at the height specified in the Me of the group template.
SpawnAirplanes:SpawnInZone( SpawnZone, true )
-- Spawn in the zone at a random position at the height randomized between 2000 and 4000 meters.
SpawnAirplanes:SpawnInZone( SpawnZone, true, 2000, 4000 )
-- Spawn at the zone center position at the height randomized between 2000 and 4000 meters.
SpawnAirplanes:SpawnInZone( SpawnZone, false, 2000, 4000 )
-- Spawn at the zone center position at the height randomized between 2000 and 4000 meters.
SpawnAirplanes:SpawnInZone( SpawnZone, nil, 2000, 4000 )
Will re-start the spawning scheduler.
Note: This method is only required to be called when the schedule was stopped.
Will stop the scheduled spawning scheduler.
Spawns new groups at varying time intervals.
This is useful if you want to have continuity within your missions of certain (AI) groups to be present (alive) within your missions. WARNING - Setting a very low SpawnTime heavily impacts your mission performance and CPU time, it is NOT useful to check the alive state of an object every split second! Be reasonable and stay at 15 seconds and above!
Defined in:
Parameters:
#number SpawnTime
The time interval defined in seconds between each new spawn of new groups.
#number SpawnTimeVariation
The variation to be applied on the defined time interval between each new spawn. The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.
#boolean WithDelay
Do not spawn the first group immediately, but delay the spawn as per the calculation below. Effectively the same as #InitDelayOn().
Return value:
self
Usage:
-- NATO helicopters engaging in the battle field.
-- The time interval is set to SPAWN new helicopters between each 600 seconds, with a time variation of 50%.
-- The time variation in this case will be between 450 seconds and 750 seconds.
-- This is calculated as follows:
-- Low limit: 600 * ( 1 - 0.5 / 2 ) = 450
-- High limit: 600 * ( 1 + 0.5 / 2 ) = 750
-- Between these two values, a random amount of seconds will be chosen for each new spawn of the helicopters.
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):SpawnScheduled( 600, 0.5 )
Will spawn a group with a specified index number.
Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.
Defined in:
Parameters:
#string SpawnIndex
The index of the group to be spawned.
NoBirth
Return value:
The group that was spawned. You can use this group for further actions.
Stop the SPAWN InitRepeat function (EVENT handler for takeoff, land and engine shutdown)
Defined in:
Return value:
self
Usage:
local spawn = SPAWN:New("Template Group")
:InitRepeatOnEngineShutDown()
local plane = spawn:Spawn() -- it is important that we keep the SPAWN object and do not overwrite it with the resulting GROUP object by just calling :Spawn()
-- later on
spawn:StopRepeat()
Gets the CategoryID of the Group with the given SpawnPrefix
Gets the CoalitionID of the Group with the given SpawnPrefix
Gets the CountryID of the Group with the given SpawnPrefix
Return the prefix of a SpawnUnit.
The method will search for a #-mark, and will return the text before the #-mark. It will return nil of no prefix was found.
Defined in:
Parameter:
Wrapper.Group#GROUP SpawnGroup
The GROUP object.
Return value:
#string:
The prefix or #nil if nothing was found.
Return the prefix of a spawned group.
The method will search for a #
-mark, and will return the text before the #
-mark. It will return nil of no prefix was found.
Defined in:
Parameter:
#string SpawnGroupName
The name of the spawned group.
Return value:
#string:
The prefix or #nil if nothing was found.
Get the next index of the groups to be spawned.
This method is complicated, as it is used at several spaces.
Defined in:
Parameter:
#number SpawnIndex
Spawn index.
Return value:
#number:
self.SpawnIndex
Gets the Group Template from the ME environment definition.
Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.
Initalize the SpawnGroups collection.
@param #SPAWN self @param Core.Event#EVENTDATA EventData
Will detect AIR Units shutting down their engines ...
When the event takes place, and the method #InitRepeatOnEngineShutDown was called, the spawned Group will Re-SPAWN. But only when the Unit was registered to have landed.
Will detect AIR Units landing...
When the event takes place, the spawned Group is registered as landed. This is needed to ensure that Re-SPAWNing is only done for landed AIR Groups.
Will detect AIR Units taking off...
When the event takes place, the spawned Group is registered as airborne... This is needed to ensure that Re-SPAWNing only is done for landed AIR Groups.
Prepares the new Group Template.
Defined in:
Parameters:
#string SpawnTemplatePrefix
#number SpawnIndex
Return value:
self
Private method randomizing the routes.
Defined in:
Parameter:
#number SpawnIndex
The index of the group to be spawned.
Return value:
Private method that randomizes the template of the group.
Private method that randomizes the Core.Zones where the Group will be spawned.
This function is called automatically by the Spawning scheduler.
It is the internal worker method SPAWNing new Groups on the defined time intervals.
Defined in:
Private method that sets the DCS#Vec2 where the Group will be spawned.
Schedules the CleanUp of Groups
Field(s)
Enable/disable ATC if set to true/false.
Default angle of descenti in degrees. A value of 3.6 follows the 3:1 rule of 3 miles of travel and 1000 ft descent.
Name of the Class.
Turn debug messages on or off.
Cruise altitude of aircraft. Default FL200 for planes and F005 for helos.
Maximum flight level set by user.
Minimum flight level set by user.
Flight level set by users explicitly.
F10 menu items for this RAT object.
Main F10 menu.
Number of departure airports set via SetDeparture().
Number of departure zones set via SetDeparture.
Number of destination airports set via SetDestination().
Number of destination zones set via SetDestination().
Max number of spawns.
Submenu name for RAT object.
Time in seconds after which inactive units will be destroyed. Default is 300 seconds.
Default climb rate in ft/min.
Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.
Delay in seconds before first uncontrolled group is activated. Default is 5 seconds.
Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds.
Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0.
Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1.
If true, uncontrolled are activated randomly after certain time intervals.
Add all friendly airports to departures.
Add all friendly airports to destinations.
Table which holds the basic aircraft properties (speed, range, ...).
All airports of friedly coalitions.
All airports available on current map (Caucasus, Nevada, Normandy, ...).
Alias for spawned group.
Number of groups which are alive.
Category of aircarft: "plane" or "heli".
Aircraft are checked if they were accidentally spawned on the runway. Default is true.
Aircraft are checked if they were accidentally spawned on top of another unit. Default is true.
Coalition of spawn group template.
Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation.
Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination.
Country of spawn group template.
Table with the valid coalitions from choice self.friendly.
Array containing the names of the destination airports or zones.
If true, aircraft are despawned when they reach their destination zone. Default.
Array containing the names of the destination airports or zones.
Destination is a zone and not an airport.
If true, turn on EPLSR datalink for the RAT group.
Array containing the names of explicitly excluded airports.
If true, add an F10 radiomenu for RAT. Default is false.
Radio frequency used by the RAT groups.
Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.
Number of aircraft in group.
Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way.
Some ID to identify who we are in output of the DCS.log file.
If true, aircraft are spawned as immortal.
If true aircraft are set to invisible for other AI forces.
Landing type. Determines if we actually land at an airport or treat it as zone.
Log identifier.
Livery of the aircraft set by user.
Running number of placed markers on the F10 map.
Array with marker IDs.
Max distance from departure to destination in meters. Default 5000 km.
Min distance from departure to destination in meters. Default 5 km.
Ratio modulation. Either "FM" or "AM".
Number of groups to be spawned in total.
Aircraft will not be respawned after they have finished their route.
Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor.
(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1.
Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3.
Distance (in meters) from a runway spawn point until a unit is considered to have accidentally been spawned on a runway. Default is 75 m.
Radius in meters until which a unit is considered to be on top of another. Default is 2 m.
Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery.
If true, area around parking spots is scanned for scenery objects. Default is false.
If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false.
Place markers of waypoints on F10 map.
If true/false disables radio messages from the RAT groups.
By default a random friendly airport is chosen as departure.
By default a random friendly airport is chosen as destination.
Array with the spawned RAT aircraft.
Aircraft report status.
Aircraft will be respawned after a crash, e.g. when they get shot down.
Aircraft will be respawned directly after take-off.
Respawn aircraft the moment they land rather than at engine shutdown.
Delay in seconds until a repawn happens.
Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true.
Array containing the names of the return zones.
Zone where aircraft will fly to before returning to their departure airport.
ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free".
ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade".
Start scheduled spawning.
Status check and report scheduler.
Skill of AI.
Delay time in seconds before first spawning happens.
If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again.
Interval between spawning units/groups. Note that we add a randomization of 50%.
If true, aircraft travel A-->B-->A-->C-->A-->D... for commute.
Intervall between status checks (and reports if enabled).
Takeoff type. 0=coldorhot.
Type of terminal to be used when spawning at an airbase.
If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated.
RAT version.
Table with strings for waypoint descriptions of markers.
Table with strings of waypoint status.
Function(s)
Clear the state of an object.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
StateName
The key that is should be cleared.
Creation of a Birth Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
#string IniUnitName
The initiating unit name.
place
subplace
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a Dead Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT
event.
Creation of a Remove Unit Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Takeoff Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Log an exception which will be traced always.
Can be anywhere within the function logic.
Returns the event dispatcher
Trace a function call.
Must be at the beginning of the function logic.
Trace a function call level 2.
Must be at the beginning of the function logic.
Trace a function call level 3.
Must be at the beginning of the function logic.
Get the ClassID of the class instance.
Get the ClassName of the class instance.
Get the ClassName + ClassID of the class instance.
The ClassName + ClassID is formatted as '%s#%09d'.
Get the Class Core.Event processing Priority.
The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.
This is the worker method to retrieve the Parent class.
Note that the Parent class must be passed to call the parent class method.
self:GetParent(self):ParentMethod()
Get a Value given a Key from the Object.
Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
Key
The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!
Return value:
The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.
Subscribe to a DCS Event.
Defined in:
Parameters:
Core.Event#EVENTS EventID
Event ID.
#function EventFunction
(optional) The function to be called when the event occurs for the unit.
Return value:
Log an information which will be traced always.
Can be anywhere within the function logic.
This is the worker method to inherit from a parent class.
Defined in:
Parameters:
Child
is the Child class that inherits.
#BASE Parent
is the Parent class that the Child inherits from.
Return value:
Child
This is the worker method to check if an object is an (sub)instance of a class.
Examples:
ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false
Defined in:
Parameter:
ClassName
is the name of the class or the class itself to run the check against
Return value:
#boolean:
Enquires if tracing is on (for the class).
BASE constructor.
This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
function EVENT:New()
local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
return self
end
Occurs when an Event for an object is triggered.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.
Occurs when a ground unit captures either an airbase or a farp.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
Occurs when any object is spawned into the mission.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned
Occurs when any aircraft crashes into the ground and is completely destroyed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed
Occurs when an object is dead.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.
Unknown precisely what creates this event, likely tied into newer damage model.
Will update this page when new information become available.
- initiator: The unit that had the failure.
Discard chair after ejection.
Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a dynamic cargo crate is removed.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.
initiator : The unit that has ejected
Occurs when any aircraft shuts down its engines.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.
Occurs when any aircraft starts its engines.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.
Occurs whenever an object is hit by a weapon.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.
Occurs when any system fails on a human controlled aircraft.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure
Occurs on the death of a unit.
Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: The unit that killed the target
- target: Target Object
- weapon: Weapon Object
Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.
initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.
Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
- place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
- subplace: is always 0 for unknown reasons.
Occurs when a new mark was added.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mark text was changed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mark was removed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Weapon add.
Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when the pilot of an aircraft is killed.
Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.
Occurs when a player enters a slot and takes control of an aircraft.
Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.
Occurs when any player assumes direct control of a unit.
Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.
Occurs when any player relieves control of a unit to the AI.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.
Occurs when an aircraft connects with a tanker and begins taking on fuel.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.
Occurs when an aircraft is finished taking fuel.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.
Occurs when any modification to the "Score" as seen on the debrief menu would occur.
There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when any unit stops firing its weapon.
Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.
Occurs when any unit begins firing a weapon that has a high rate of fire.
Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.
Occurs whenever any unit in a mission fires a weapon.
But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when an aircraft takes off from an airbase, farp, or ship.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
Occurs when the game thinks an object is destroyed.
Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: The unit that is was destroyed.
Schedule a new time event.
Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.
Defined in:
Parameters:
#number Start
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
#function SchedulerFunction
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
#table ...
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
Return value:
#string:
The Schedule ID of the planned schedule.
Schedule a new time event.
Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.
Defined in:
Parameters:
#number Start
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
#number Repeat
Specifies the interval in seconds when the scheduler will call the event function.
#number RandomizeFactor
Specifies a randomization factor between 0 and 1 to randomize the Repeat.
#number Stop
Specifies the amount of seconds when the scheduler will be stopped.
#function SchedulerFunction
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
#table ...
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
Return value:
#string:
The Schedule ID of the planned schedule.
Stops the Schedule.
Defined in:
Parameter:
#string SchedulerID
(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.
Set the Class Core.Event processing Priority.
The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.
Set a state or property of the Object given a Key and a Value.
Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
Defined in:
Parameters:
Object
The object that will hold the Value set by the Key.
Key
The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
Value
The value to is stored in the object.
Return value:
The Value set.
Trace a function logic level 1.
Can be anywhere within the function logic.
Trace a function logic level 2.
Can be anywhere within the function logic.
Trace a function logic level 3.
Can be anywhere within the function logic.
Trace all methods in MOOSE
Set tracing for a class
Set tracing for a specific method of class
Set trace off.
Set trace on.
Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.
So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.
Defined in:
Parameter:
#boolean TraceOnOff
Switch the tracing on or off.
Usage:
-- Switch the tracing On
BASE:TraceOnOff( true )
-- Switch the tracing Off
BASE:TraceOnOff( false )
UnSubscribe to a DCS event.
Trace a function call.
This function is private.
Defined in:
Parameters:
Arguments
A #table or any field.
DebugInfoCurrentParam
DebugInfoFromParam
(Internal) Serialize arguments
Trace a function logic.
Defined in:
Parameters:
Arguments
A #table or any field.
DebugInfoCurrentParam
DebugInfoFromParam
The main event handling function...
This function captures all events generated for the class.
RAT ATC.
Field(s)
Number of flights that get landing clearance simultaniously. Default 2.
Time stamp [sec, timer.getTime()] when ATC was initialized.
List of airports.
Delay between landing flights in seconds. Default 240 sec.
List of flights.
True if ATC was initialized.
If true
, ATC sends messages.
Enumerator onfinal=100.
Enumerator for unregistered flights unregistered=-1.
Function(s)
Data structure a RAT ATC airbase object.
Field(s)
Number of flights on final.
Time stamp when last flight started final approach.
Whether airport is busy.
List of flights on final.
Queue.
Number of flights that landed (just for stats).
Function(s)
Data structure a RAT ATC airbase object.
Field(s)
Time stamp when flight arrived at holding.
Time stamp when flight started final approach.
Name of the destination airbase.
Holding time.
Function(s)
RAT rules of engagement.
Field(s)
Function(s)
RAT reaction to threat.
Field(s)
Function(s)
Datastructure of a spawned RAT group.
Field(s)
Distance travelled in meters.
Whether the group is active or uncontrolled.
Whether this group is airborne.
Despawn group if true
in the next status update.
Spawn index.
Laning type.
Livery of the group.
Number of respawns.
Number of units.
Status of the group.
Takeoff type.
Waypoints.
Waypoint descriptins.
Waypoint status.
Function(s)
Categories of the RAT class.
Field(s)
Heli.
Plane.
Function(s)
RAT friendly coalitions.
Field(s)
Function(s)
RAT aircraft status.
Field(s)
Waypoint states.
Event states.
Spawn states.
Function(s)
RAT unit conversions.
Field(s)
Function(s)
RAT waypoint type.
Field(s)
Function(s)
- RATMANAGER class
Field(s)
Name of the Class.
If true, be more verbose on output in DCS.log file.
Time interval in seconds between checking of alive groups.
Number of currently alive groups.
Time interval in seconds between spawns of groups.
Some ID to identify who we are in output of the DCS.log file.
Managing scheduler id.
Minimum number of RAT groups alive.
Name (alias) of RAT object.
Number of RAT objects.
Total number of active RAT groups.
Array holding RAT objects etc.
Function(s)
Adds a RAT object to the RAT manager.
Parameter min specifies the limit how many RAT groups are at least alive.
Defined in:
RATMANAGER
Parameters:
#RAT ratobject
RAT object to be managed.
#number min
Minimum number of groups for this RAT object. Default is 1.
Return value:
RATMANAGER self object.
Creates a new RATMANAGER object.
Defined in:
RATMANAGER
Parameter:
#number ntot
Total number of RAT flights.
Return value:
RATMANAGER object
Sets the time interval between checks of alive RAT groups.
Default is 60 seconds.
Defined in:
RATMANAGER
Parameter:
#number dt
Time interval in seconds.
Return value:
RATMANAGER self object.
Sets the time interval between spawning of groups.
Defined in:
RATMANAGER
Parameter:
#number dt
Time interval in seconds. Default is 1 second.
Return value:
RATMANAGER self object.
Starts the RAT manager and spawns the initial random number RAT groups for each RAT object.
Defined in:
RATMANAGER
Parameter:
#number delay
Time delay in seconds after which the RAT manager is started. Default is 5 seconds.
Return value:
RATMANAGER self object.
Stops the RAT manager.
Defined in:
RATMANAGER
Parameter:
#number delay
Delay in seconds before the manager is stopped. Default is 1 second.
Return value:
RATMANAGER self object.
Manager function.
Calculating the number of current groups and respawning new groups if necessary.
Defined in:
RATMANAGER
Rolls the dice for the number of necessary spawns.
Defined in:
RATMANAGER
Parameters:
#number nrat
Number of RAT objects.
#number ntot
Total number of RAT flights.
#table min
Minimum number of groups for each RAT object.
#table alive
Number of alive groups of each RAT object.
Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.
Field(s)
Name of the Class.
If true, be more verbose on output in DCS.log file.
Time interval in seconds between checking of alive groups.
Number of currently alive groups.
Time interval in seconds between spawns of groups.
Some ID to identify who we are in output of the DCS.log file.
Managing scheduler id.
Minimum number of RAT groups alive.
Name (alias) of RAT object.
Number of RAT objects.
Total number of active RAT groups.
Array holding RAT objects etc.
Function(s)
Clear the state of an object.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
StateName
The key that is should be cleared.
Creation of a Birth Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
#string IniUnitName
The initiating unit name.
place
subplace
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a Dead Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT
event.
Creation of a Remove Unit Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Takeoff Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Log an exception which will be traced always.
Can be anywhere within the function logic.
Returns the event dispatcher
Remove all subscribed events
Trace a function call.
Must be at the beginning of the function logic.
Trace a function call level 2.
Must be at the beginning of the function logic.
Trace a function call level 3.
Must be at the beginning of the function logic.
Get the ClassID of the class instance.
Get the ClassName of the class instance.
Get the ClassName + ClassID of the class instance.
The ClassName + ClassID is formatted as '%s#%09d'.
Get the Class Core.Event processing Priority.
The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.
This is the worker method to retrieve the Parent class.
Note that the Parent class must be passed to call the parent class method.
self:GetParent(self):ParentMethod()
Get a Value given a Key from the Object.
Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
Key
The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!
Return value:
The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.
Subscribe to a DCS Event.
Defined in:
Parameters:
Core.Event#EVENTS EventID
Event ID.
#function EventFunction
(optional) The function to be called when the event occurs for the unit.
Return value:
Log an information which will be traced always.
Can be anywhere within the function logic.
This is the worker method to inherit from a parent class.
Defined in:
Parameters:
Child
is the Child class that inherits.
#BASE Parent
is the Parent class that the Child inherits from.
Return value:
Child
This is the worker method to check if an object is an (sub)instance of a class.
Examples:
ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false
Defined in:
Parameter:
ClassName
is the name of the class or the class itself to run the check against
Return value:
#boolean:
Enquires if tracing is on (for the class).
BASE constructor.
This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
function EVENT:New()
local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
return self
end
Occurs when an Event for an object is triggered.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.
Occurs when a ground unit captures either an airbase or a farp.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit th