Module Functional.RAT
Functional - Create random airtraffic 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
Contributions: FlightControl
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 theholding point is ~1200 m AGL. Holding patterns might or might not happen with variable duration.
- If an aircraft is spawned in air, the procedure omitts 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 beeing on a peaceful or ferry mission.
Basic Lua Script

The basic Lua script for one template group consits 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 airstripes. 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 immidiately 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 beeing despawned immidiately.
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 availabe 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 indefinetly.
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 jamms 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 enought 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 |
|---|---|
|
RAT ATC. |
|
|
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. |
|
|
Activate uncontrolled aircraft. |
|
|
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. |
|
|
Put parking spot coordinates in a data base for future use of aircraft. |
|
|
Place markers of waypoints on the F10 map. |
|
|
RAT rules of engagement. |
|
|
RAT reaction to threat. |
|
|
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. |
|
|
Aircraft will be respawned directly after take-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 accitentally 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 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. |
|
|
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. |
|
|
Start uncontrolled aircraft group. |
|
|
Determine the heading from point a to point b. |
|
|
Create a Dead event. |
|
|
Turn debug messages on or off. |
|
|
Delete all markers on F10 map. |
|
|
Despawn unit. |
|
|
Destroys the RAT DCS group and all of its DCS units. |
|
|
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 (relative) life of first unit of a group. |
|
|
Get aircraft dimensions length, width, height. |
|
|
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 airport is friendly, i.e. |
|
|
Calculate minimum distance between departure and destination for given minimum flight level and climb/decent rates. |
|
RAT:_ModifySpawnTemplate(waypoints, livery, spawnplace, departure, takeoff, parkingdata) |
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. |
|
|
Respawn a group. |
|
|
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. |
|
|
Delayed spawn function called by scheduler. |
|
|
Task function. |
|
|
Orbit at a specified position at a specified alititude with a specified speed. |
|
RAT:_Waypoint(index, description, Type, Coord, Speed, Altitude, Airport) |
Create a waypoint that can be used with the Route command. |
|
Function which is called after passing every waypoint. |
|
|
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. |
|
|
RAT friendly coalitions. |
|
|
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. |
|
|
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. |
|
|
RAT aircraft status. |
|
|
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 unit conversions. |
|
|
RAT version. |
|
|
Table with strings for waypoint descriptions of markers. |
|
|
Table with strings of waypoint status. |
|
|
RAT waypoint type. |
| 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. |
|
|
Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object. |
|
|
Instantly stops the RAT manager by terminating its scheduler. |
|
|
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. |
|
|
The scheduler object. |
|
|
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)
RAT ATC.
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().
RAT rules of engagement.
RAT reaction to threat.
This is used in the SPAWN:SpawnWithIndex() function. Some values are overwritten there!
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.
RAT friendly coalitions.
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.
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.
RAT aircraft status.
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 unit conversions.
RAT version.
Table with strings for waypoint descriptions of markers.
Table with strings of waypoint status.
RAT waypoint type.
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.
Activate uncontrolled aircraft.
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 immediatly.
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.
Put parking spot coordinates in a data base for future use of aircraft.
(Obsolete! API function will be removed soon.)
Defined in:
RAT
Parameter:
#boolean switch
If true, parking spots are memorized. This is also the default setting.
Return value:
#RAT:
RAT self object.
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 180 seconds. Minimum is 1.0 seconds.
Return value:
#RAT:
RAT self object.
Aircraft will be respawned directly after take-off.
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 oject 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 accitentally 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 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.
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 airport
Name of destination airport.
#string flight
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.
Start uncontrolled aircraft group.
Determine the heading from point a to point b.
Defined in:
RAT
Parameters:
Point from.
Point to.
Return value:
#number:
Heading/angle in degrees.
Create a Dead event.
Defined in:
RAT
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
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 unit.
Unit gets destoyed and group is set to nil. Index of ratcraft array is taken from spawned group name.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
Group to be despawned.
#number delay
Delay in seconds before the despawn happens.
Destroys the RAT DCS group and all of its DCS units.
Note that this raises a DEAD event at run-time. So all event listeners will catch the DEAD event of this DCS group.
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 (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.
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 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.
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.
#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.
Respawn a group.
Defined in:
RAT
Parameters:
#number index
Spawn index.
Core.Point#COORDINATE lastpos
Last known position of the group.
#number delay
Delay before respawn
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.
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:
Wrapper.Group#GROUP group
Group for which the ROE is set.
#string roe
ROE of group.
Set ROT for a group.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
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.
#nil:
If no valid departure or destination airport could be found.
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.
Delayed spawn function called by scheduler.
Defined in:
RAT
Parameter:
#table arg
Parameters: arg.self, arg.departure, arg.destination, arg.takeoff, arg.landing, arg.livery, arg.lastwp, arg.lastpos
Task function.
Defined in:
RAT
Parameters:
#string FunctionString
Name of the function to be called.
...
Orbit at a specified position at a specified alititude with a specified speed.
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.
Function which is called after passing every waypoint.
Info on waypoint is given and special functions are executed.
Defined in:
RAT
Parameters:
Wrapper.Group#GROUP group
Group of aircraft.
#RAT rat
RAT object.
#number wp
Waypoint index. Running number of the waypoints. Determines the actions to be executed.
Test if a zone exists.
Defined in:
RAT
Parameter:
#string name
Return value:
#boolean:
True if zone exsits, false otherwise.
- 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.
Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.
Instantly stops the RAT manager by terminating its scheduler.
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 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.