Banner Image

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:


Author: funkyfranky

Contributions: FlightControl


Global(s)

Global RAT

Implements an easy to use way to randomly fill your map with AI aircraft.

#RAT RAT

Implements an easy to use way to randomly fill your map with AI aircraft.

Airport Selection

Process

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

Process

  • 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

Process

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

Process

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

Process

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

Process

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

Process

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.

Process

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#BASE

The RATMANAGER class manages spawning of multiple RAT objects in a very simple way.

#RATMANAGER RATMANAGER

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)

RAT , extends Core.Spawn#SPAWN , extends Core.Base#BASE
Fields and Methods inherited from RAT Description

RAT.ATC

RAT ATC.

RAT:ATC_Clearance(n)

Max number of planes that get landing clearance of the RAT ATC.

RAT:ATC_Delay(time)

Delay between granting landing clearance for simultanious landings.

RAT:ATC_Messages(switch)

Turn messages from ATC on or off.

RAT.ATCswitch

Enable/disable ATC if set to true/false.

RAT:ActivateUncontrolled(maxactivated, delay, delta, frand)

Activate uncontrolled aircraft.

RAT:AddFriendlyAirportsToDepartures()

Add all friendly airports to the list of possible departures.

RAT:AddFriendlyAirportsToDestinations()

Add all friendly airports to the list of possible destinations

RAT.AlphaDescent

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.

RAT:ChangeAircraft(actype)

Change aircraft type.

RAT:CheckOnRunway(switch, radius, distance)

Check if aircraft have accidentally been spawned on the runway.

RAT:CheckOnTop(switch, radius)

Check if aircraft have accidentally been spawned on top of each other.

RAT.ClassName

Name of the Class.

RAT:ClearForLanding(name)

Clear flight for landing.

RAT:Commute(starshape)

Aircraft will commute between their departure and destination airports or zones.

RAT:ContinueJourney()

Aircraft will continue their journey from their destination.

RAT.Debug

Turn debug messages on or off.

RAT:Debugmode()

Enable debug mode.

RAT:DestinationZone()

Destinations are treated as zones.

RAT:EnableATC(switch)

Enable ATC, which manages the landing queue for RAT aircraft if they arrive simultaniously at the same airport.

RAT:ExcludedAirports(ports)

Airports, FARPs and ships explicitly excluded as departures and destinations.

RAT.FLcruise

Cruise altitude of aircraft. Default FL200 for planes and F005 for helos.

RAT.FLmaxuser

Maximum flight level set by user.

RAT.FLminuser

Minimum flight level set by user.

RAT.FLuser

Flight level set by users explicitly.

RAT:GetStatus(group)

Get status of group.

RAT:Immortal()

Aircraft are immortal.

RAT:Invisible()

Aircraft are invisible.

RAT:Livery(skins)

Set livery of aircraft.

RAT.Menu

F10 menu items for this RAT object.

RAT.MenuF10

Main F10 menu.

RAT:MenuName(name)

Set the name of the F10 submenu.

RAT.Ndeparture_Airports

Number of departure airports set via SetDeparture().

RAT.Ndeparture_Zones

Number of departure zones set via SetDeparture.

RAT.Ndestination_Airports

Number of destination airports set via SetDestination().

RAT.Ndestination_Zones

Number of destination zones set via SetDestination().

RAT:New(groupname, alias)

Create a new RAT object.

RAT:NoRespawn()

Aircraft will not get respawned when they finished their route.

RAT:ParkingSpotDB(switch)

Put parking spot coordinates in a data base for future use of aircraft.

RAT:PlaceMarkers(switch)

Place markers of waypoints on the F10 map.

RAT.ROE

RAT rules of engagement.

RAT.ROT

RAT reaction to threat.

RAT:RadioFrequency(frequency)

Set radio frequency.

RAT:RadioMenuOFF()

Radio menu Off.

RAT:RadioMenuON()

Radio menu On.

RAT:RadioModulation(modulation)

Set radio modulation.

RAT:RadioOFF()

Disable Radio.

RAT:RadioON()

Enable Radio.

RAT:RespawnAfterCrashOFF()

Aircraft will not be respawned after they crashed or get shot down.

RAT:RespawnAfterCrashON()

Aircraft will be respawned after they crashed or get shot down.

RAT:RespawnAfterLanding(delay)

Make aircraft respawn the moment they land rather than at engine shut down.

RAT:RespawnAfterTakeoff()

Aircraft will be respawned directly after take-off.

RAT:RespawnInAirAllowed()

If aircraft cannot be spawned on parking spots, it is allowed to spawn them in air above the same airport.

RAT:RespawnInAirNotAllowed()

If aircraft cannot be spawned on parking spots, it is NOT allowed to spawn them in air.

RAT:ReturnZone()

Aircraft will fly to a random point within a zone and then return to its departure airport or zone.

RAT:SetAISkill(skill)

Set skill of AI aircraft.

RAT:SetClimbRate(rate)

Set the climb rate.

RAT:SetCoalition(friendly)

Set the friendly coalitions from which the airports can be used as departure and destination.

RAT:SetCoalitionAircraft(color)

Set coalition of RAT group.

RAT:SetCountry(id)

Set country of RAT group.

RAT:SetCruiseAltitude(alt)

Set cruising altitude.

RAT:SetDeparture(departurenames)

Set possible departure ports.

RAT:SetDeparturesFromZone(zone)

Include all airports which lie in a zone as possible destinations.

RAT:SetDescentAngle(angle)

Set the angle of descent.

RAT:SetDespawnAirOFF()

Aircraft that reach their destination zone are not despawned.

RAT:SetDestination(destinationnames)

Set name of destination airports or zones for the AI aircraft.

RAT:SetDestinationsFromZone(zone)

Include all airports which lie in a zone as possible destinations.

RAT:SetEPLRS(switch)

Turn EPLRS datalink on/off.

RAT:SetFL(FL)

Set flight level.

RAT:SetFLcruise(FL)

Set flight level of cruising part.

RAT:SetFLmax(FL)

Set max flight level.

RAT:SetFLmin(FL)

Set min flight level.

RAT:SetMaxCruiseAltitude(alt)

Set max cruising altitude above sea level.

RAT:SetMaxCruiseSpeed(speed)

Set the maximum cruise speed of the aircraft.

RAT:SetMaxDistance(dist)

Set maximum distance between departure and destination.

RAT:SetMaxRespawnTriedWhenSpawnedOnRunway(n)

Number of tries to respawn an aircraft in case it has accitentally been spawned on runway.

RAT:SetMinCruiseAltitude(alt)

Set min cruising altitude above sea level.

RAT:SetMinDistance(dist)

Set minimum distance between departure and destination.

RAT:SetOnboardNum(tailnumprefix, zero)

Set onboard number prefix.

RAT:SetParkingScanRadius(radius)

Set the scan radius around parking spots.

RAT:SetParkingScanSceneryOFF()

Disables scanning for scenery objects around parking spots which might block the spot.

RAT:SetParkingScanSceneryON()

Enables scanning for scenery objects around parking spots which might block the spot.

RAT:SetParkingSpotSafeOFF()

A parking spot is free as soon as possible aircraft has left the place.

RAT:SetParkingSpotSafeON()

A parking spot is not free until a possible aircraft has left and taken off.

RAT:SetROE(roe)

Set rules of engagement (ROE).

RAT:SetROT(rot)

Set reaction to threat (ROT).

RAT:SetRespawnDelay(delay)

Sets the delay between despawning and respawning aircraft.

RAT:SetSpawnDelay(delay)

Set the delay before first group is spawned.

RAT:SetSpawnInterval(interval)

Set the interval between spawnings of the template group.

RAT:SetTakeoff(type)

Set takeoff type.

RAT:SetTakeoffAir()

Set takeoff type to air.

RAT:SetTakeoffCold()

Set takeoff type cold.

RAT:SetTakeoffColdOrHot()

Set takeoff type to cold or hot.

RAT:SetTakeoffHot()

Set takeoff type to hot.

RAT:SetTakeoffRunway()

Set takeoff type to runway.

RAT:SetTerminalType(termtype)

Set the terminal type the aircraft use when spawning at an airbase.

RAT:Spawn(naircraft)

Triggers the spawning of AI aircraft.

RAT.SpawnUnControlled

RAT:Status(message, forID)

Report status of RAT groups.

RAT:StatusReports(switch)

Aircraft report status update messages along the route.

RAT.SubMenuName

Submenu name for RAT object.

RAT:TimeDestroyInactive(time)

Set the time after which inactive groups will be destroyed.

RAT.Tinactive

Time in seconds after which inactive units will be destroyed. Default is 300 seconds.

RAT:Uncontrolled()

Spawn aircraft in uncontrolled state.

RAT.Vclimb

Default climb rate in ft/min.

RAT.Vcruisemax

Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.

RAT:_ATCAddFlight(name, dest)

Adds andd initializes a new flight after it was spawned.

RAT:_ATCCheck()

Main ATC function.

RAT:_ATCClearForLanding(airport, flight)

Giving landing clearance for aircraft by setting user flag.

RAT:_ATCDelFlight(t, entry)

Deletes a flight from ATC lists after it landed.

RAT:_ATCFlightLanded(name)

Takes care of organisational stuff after a plane has landed.

RAT:_ATCInit(airports_map)

Initializes the ATC arrays and starts schedulers.

RAT:_ATCQueue()

Creates a landing queue for all flights holding at airports.

RAT:_ATCRegisterFlight(name, time)

Registers a flight once it is near its holding point at the final destination.

RAT:_ATCStatus()

ATC status report about flights.

RAT:_ActivateUncontrolled()

Randomly activates an uncontrolled aircraft.

RAT:_AddFriendlyAirports(ports)

Add names of all friendly airports to possible departure or destination airports if they are not already in the list.

RAT:_AirportExists(name)

Test if an airport exists on the current map.

RAT:_AnticipatedGroupName(index)

Anticipated group name from alias and spawn index.

RAT:_CheckConsistency()

Function checks consistency of user input and automatically adjusts parameters if necessary.

RAT:_CheckOnTop(group, distmin)

Find aircraft that have accidentally been spawned on top of each other.

RAT:_CommandImmortal(group, switch)

Set RAT group to be (im-)mortal.

RAT:_CommandInvisible(group, switch)

Set RAT group to (in-)visible for other AI forces.

RAT:_CommandStartUncontrolled(group)

Start uncontrolled aircraft group.

RAT:_Course(a, b)

Determine the heading from point a to point b.

RAT:_CreateEventDead(EventTime, Initiator)

Create a Dead event.

RAT:_Debug(switch)

Turn debug messages on or off.

RAT:_DeleteMarkers()

Delete all markers on F10 map.

RAT:_Despawn(group, delay)

Despawn unit.

RAT:_Destroy(group)

Destroys the RAT DCS group and all of its DCS units.

RAT:_Excluded(port)

Check if airport is excluded from possible departures and destinations.

RAT:_GetAirportsInZone(zone)

Find airports within a zone.

RAT:_GetAirportsOfCoalition()

Get all "friendly" airports of the current map.

RAT:_GetAirportsOfMap()

Get all airports of the current map.

RAT:_GetLife(group)

Get (relative) life of first unit of a group.

RAT:_GetObjectSize(unit)

Get aircraft dimensions length, width, height.

RAT:_Heading(course)

Determine the heading for an aircraft to be entered in the route template.

RAT:_InitAircraft(DCSgroup)

Initialize basic parameters of the aircraft based on its (template) group in the mission editor.

RAT:_IsFriendly(port)

Check if airport is friendly, i.e.

RAT:_MinDistance(alpha, beta, ha, hb)

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.

RAT:_NameInList(liste, name)

Check if a name/string is in a list or not.

RAT:_OnBirth(EventData)

Function is executed when a unit is spawned.

RAT:_OnCrash(EventData)

Function is executed when a unit crashes.

RAT:_OnDead(EventData)

Function is executed when a unit is dead.

RAT:_OnDeadOrCrash(EventData)

Function is executed when a unit is dead or crashes.

RAT:_OnEngineShutdown(EventData)

Function is executed when a unit shuts down its engines.

RAT:_OnEngineStartup(EventData)

Function is executed when a unit starts its engines.

RAT:_OnHit(EventData)

Function is executed when a unit is hit.

RAT:_OnLand(EventData)

Function is executed when a unit lands.

RAT:_OnTakeoff(EventData)

Function is executed when a unit takes off.

RAT:_PickDeparture(takeoff)

Set the departure airport of the AI.

RAT:_PickDestination(departure, q, minrange, maxrange, random, landing)

Pick destination airport or zone depending on departure position.

RAT:_PlaceMarkers(waypoints, index)

Place markers of the waypoints.

RAT:_Randomize(value, fac, lower, upper)

Randomize a value by a certain amount.

RAT:_Respawn(index, lastpos, delay)

Respawn a group.

RAT:_Routeinfo(waypoints, comment)

Provide information about the assigned flightplan.

RAT:_SetCoalitionTable()

Create a table with the valid coalitions for departure and destination airports.

RAT:_SetMarker(text, wp, index)

Set a marker visible for all on the F10 map.

RAT:_SetROE(group, roe)

Set ROE for a group.

RAT:_SetROT(group, rot)

Set ROT for a group.

RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)

Set the route of the AI plane.

RAT:_SetStatus(group, status)

Set status of group.

RAT:_SpawnWithRoute(_departure, _destination, _takeoff, _landing, _livery, _waypoint, _lastpos, _nrespawn, parkingdata)

Spawn the AI aircraft with a route.

RAT:_SpawnWithRouteTimer(arg)

Delayed spawn function called by scheduler.

RAT:_TaskFunction(FunctionString, ...)

Task function.

RAT:_TaskHolding(P1, Altitude, Speed, Duration)

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.

RAT._WaypointFunction(group, rat, wp)

Function which is called after passing every waypoint.

RAT:_ZoneExists(name)

Test if a zone exists.

RAT.activate_delay

Delay in seconds before first uncontrolled group is activated. Default is 5 seconds.

RAT.activate_delta

Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds.

RAT.activate_frand

Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0.

RAT.activate_max

Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1.

RAT.activate_uncontrolled

If true, uncontrolled are activated randomly after certain time intervals.

RAT.actype

RAT.addfriendlydepartures

Add all friendly airports to departures.

RAT.addfriendlydestinations

Add all friendly airports to destinations.

RAT.aircraft

Table which holds the basic aircraft properties (speed, range, ...).

RAT.airports

All airports of friedly coalitions.

RAT.airports_map

All airports available on current map (Caucasus, Nevada, Normandy, ...).

RAT.alias

Alias for spawned group.

RAT.alive

Number of groups which are alive.

RAT.cat

RAT.category

Category of aircarft: "plane" or "heli".

RAT.checkonrunway

Aircraft are checked if they were accidentally spawned on the runway. Default is true.

RAT.checkontop

Aircraft are checked if they were accidentally spawned on top of another unit. Default is true.

RAT.coal

RAT friendly coalitions.

RAT.coalition

Coalition of spawn group template.

RAT.commute

Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation.

RAT.continuejourney

Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination.

RAT.country

Country of spawn group template.

RAT.ctable

Table with the valid coalitions from choice self.friendly.

RAT.departure_Azone

Zone containing the departure airports.

RAT.departure_ports

Array containing the names of the destination airports or zones.

RAT.despawnair

If true, aircraft are despawned when they reach their destination zone. Default.

RAT.destination_Azone

Zone containing the destination airports.

RAT.destination_ports

Array containing the names of the destination airports or zones.

RAT.destinationzone

Destination is a zone and not an airport.

RAT.eplrs

If true, turn on EPLSR datalink for the RAT group.

RAT.excluded_ports

Array containing the names of explicitly excluded airports.

RAT.f10menu

If true, add an F10 radiomenu for RAT. Default is false.

RAT.frequency

Radio frequency used by the RAT groups.

RAT.friendly

Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.

RAT.groupsize

Number of aircraft in group.

RAT.homebase

Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way.

RAT.id

Some ID to identify who we are in output of the DCS.log file.

RAT.immortal

If true, aircraft are spawned as immortal.

RAT.invisible

If true aircraft are set to invisible for other AI forces.

RAT.landing

Landing type. Determines if we actually land at an airport or treat it as zone.

RAT.livery

Livery of the aircraft set by user.

RAT.markerid

Running number of placed markers on the F10 map.

RAT.markerids

Array with marker IDs.

RAT.maxdist

Max distance from departure to destination in meters. Default 5000 km.

RAT.mindist

Min distance from departure to destination in meters. Default 5 km.

RAT.modulation

Ratio modulation. Either "FM" or "AM".

RAT.ngroups

Number of groups to be spawned in total.

RAT.norespawn

Aircraft will not be respawned after they have finished their route.

RAT.onboardnum

Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor.

RAT.onboardnum0

(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1.

RAT.onrunwaymaxretry

Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3.

RAT.onrunwayradius

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.

RAT.ontopradius

Radius in meters until which a unit is considered to be on top of another. Default is 2 m.

RAT.parkingscanradius

Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery.

RAT.parkingscanscenery

If true, area around parking spots is scanned for scenery objects. Default is false.

RAT.parkingverysafe

If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false.

RAT.placemarkers

Place markers of waypoints on F10 map.

RAT.radio

If true/false disables radio messages from the RAT groups.

RAT.random_departure

By default a random friendly airport is chosen as departure.

RAT.random_destination

By default a random friendly airport is chosen as destination.

RAT.ratcraft

Array with the spawned RAT aircraft.

RAT.reportstatus

Aircraft report status.

RAT.respawn_after_crash

Aircraft will be respawned after a crash, e.g. when they get shot down.

RAT.respawn_after_takeoff

Aircraft will be respawned directly after take-off.

RAT.respawn_at_landing

Respawn aircraft the moment they land rather than at engine shutdown.

RAT.respawn_delay

Delay in seconds until a repawn happens.

RAT.respawn_inair

Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true.

RAT.return_zones

Array containing the names of the return zones.

RAT.returnzone

Zone where aircraft will fly to before returning to their departure airport.

RAT.roe

ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free".

RAT.rot

ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade".

RAT.skill

Skill of AI.

RAT.spawndelay

Delay time in seconds before first spawning happens.

RAT.spawninitialized

If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again.

RAT.spawninterval

Interval between spawning units/groups. Note that we add a randomization of 50%.

RAT.starshape

If true, aircraft travel A-->B-->A-->C-->A-->D... for commute.

RAT.status

RAT aircraft status.

RAT.statusinterval

Intervall between status checks (and reports if enabled).

RAT.takeoff

Takeoff type. 0=coldorhot.

RAT.templategroup

Group serving as template for the RAT aircraft.

RAT.termtype

Type of terminal to be used when spawning at an airbase.

RAT.uncontrolled

If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated.

RAT.unit

RAT unit conversions.

RAT.version

RAT version.

RAT.waypointdescriptions

Table with strings for waypoint descriptions of markers.

RAT.waypointstatus

Table with strings of waypoint status.

RAT.wp

RAT waypoint type.

Fields and Methods inherited from SPAWN Description

RAT.AIOnOff

RAT.AliveUnits

RAT.ClassName

RAT.CleanUpScheduler

RAT.DelayOnOff

RAT:GetCoordinate()

Get the Coordinate of the Group that is Late Activated as the template for the SPAWN object.

RAT:GetFirstAliveGroup()

Will find the first alive Wrapper.Group it has spawned, and return the alive Wrapper.Group object and the first Index where the first alive Wrapper.Group object has been found.

RAT:GetGroupFromIndex(SpawnIndex)

Get the group from an index.

RAT:GetLastAliveGroup()

Will find the last alive Wrapper.Group object, and will return a reference to the last live Wrapper.Group object and the last Index where the last alive Wrapper.Group object has been found.

RAT:GetNextAliveGroup(SpawnIndexStart)

Will find the next alive Wrapper.Group object from a given Index, and return a reference to the alive Wrapper.Group object and the next Index where the alive Wrapper.Group has been found.

RAT:GetSpawnIndexFromGroup(SpawnGroup)

Get the index from a given group.

RAT:InitAIOff()

Turns the AI Off for the Wrapper.Group when spawning.

RAT:InitAIOn()

Turns the AI On for the Wrapper.Group when spawning.

RAT:InitAIOnOff(AIOnOff)

Turns the AI On or Off for the Wrapper.Group when spawning.

RAT:InitAirbase(AirbaseName, Takeoff, TerminalType)

Set spawns to happen at a particular airbase.

RAT:InitArray(SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY)

Makes the groups visible before start (like a battalion).

RAT:InitCallSign(ID, Name, Minor, Major)

[BLUE AIR only!] This method sets a specific callsign for a spawned group.

RAT:InitCategory(Category)

Sets category ID of the group.

RAT:InitCleanUp(SpawnCleanUpInterval)

Delete groups that have not moved for X seconds - AIR ONLY!!! DO NOT USE ON GROUPS THAT DO NOT MOVE OR YOUR SERVER WILL BURN IN HELL (Pikes - April 2020) When groups are still alive and have become inactive due to damage and are unable to contribute anything, then this group will be removed at defined intervals in seconds.

RAT:InitCoalition(Coalition)

Sets the coalition of the spawned group.

RAT:InitCountry(Country)

Sets the country of the spawn group.

RAT:InitDelayOff()

Turns the Delay Off for the Wrapper.Group when spawning.

RAT:InitDelayOn()

Turns the Delay On for the Wrapper.Group when spawning with #SpawnScheduled().

RAT:InitDelayOnOff(DelayOnOff)

RAT:InitGroupHeading(HeadingMin, HeadingMax, unitVar)

Defines the heading of the overall formation of the new spawned group.

RAT:InitGrouping(Grouping)

When spawning a new group, make the grouping of the units according the InitGrouping setting.

RAT:InitHeading(HeadingMin, HeadingMax)

Defines the Heading for the new spawned units.

RAT:InitHiddenOnMFD()

Hide the group on MFDs (visible to game master slots!).

RAT:InitHiddenOnMap()

Hide the group on the map view (visible to game master slots!).

RAT:InitHiddenOnPlanner()

Hide the group on planner (visible to game master slots!).

RAT:InitKeepUnitNames(KeepUnitNames)

Keeps the unit names as defined within the mission editor, but note that anything after a # mark is ignored, and any spaces before and after the resulting name are removed.

RAT:InitLateActivated(LateActivated)

Flags that the spawned groups must be spawned late activated.

RAT:InitLimit(SpawnMaxUnitsAlive, SpawnMaxGroups)

Stops any more repeat spawns from happening once the UNIT count of Alive units, spawned by the same SPAWN object, exceeds the first parameter.

RAT:InitLivery(Livery)

Sets livery of the group.

RAT:InitModex(modex, prefix, postfix)

Sets the modex of the first unit of the group.

RAT:InitPositionCoordinate(Coordinate)

This method sets a spawn position for the group that is different from the location of the template.

RAT:InitPositionVec2(Vec2)

This method sets a spawn position for the group that is different from the location of the template.

RAT:InitRadioCommsOnOff(switch)

Sets the radio communication on or off.

RAT:InitRadioFrequency(frequency)

Sets the radio frequency of the group.

RAT:InitRadioModulation(modulation)

Set radio modulation.

RAT:InitRandomizeCallsign()

[AIR/Fighter only!] This method randomizes the callsign for a new group.

RAT:InitRandomizePosition(RandomizePosition, OuterRadius, InnerRadius)

Randomizes the position of Wrapper.Groups that are spawned within a radius band, given an Outer and Inner radius, from the point that the spawn happens.

RAT:InitRandomizeRoute(SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight)

Randomizes the defined route of the SpawnTemplatePrefix group in the ME.

RAT:InitRandomizeTemplate(SpawnTemplatePrefixTable)

This method is rather complicated to understand.

RAT:InitRandomizeTemplatePrefixes(SpawnTemplatePrefixes)

Randomize templates to be used as the unit representatives for the Spawned group, defined by specifying the prefix names.

RAT:InitRandomizeTemplateSet(SpawnTemplateSet)

Randomize templates to be used as the unit representatives for the Spawned group, defined using a SET_GROUP object.

RAT:InitRandomizeUnits(RandomizeUnits, OuterRadius, InnerRadius)

Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius.

RAT:InitRandomizeZones(SpawnZoneTable)

This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.

RAT:InitRepeat()

For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.

RAT:InitRepeatOnEngineShutDown()

Respawn after landing when its engines have shut down.

RAT:InitRepeatOnLanding()

Respawn group after landing.

RAT:InitSADL(Octal)

[Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set.

RAT:InitSTN(Octal)

[Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set.

RAT:InitSetUnitAbsolutePositions(Positions)

Spawn the UNITs of this group with individual absolute positions and individual headings.

RAT:InitSetUnitRelativePositions(Positions)

Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.

RAT:InitSkill(Skill)

Sets skill of the group.

RAT.InitSpeed

RAT:InitSpeedKnots(Knots)

[Airplane] Set the initial speed on spawning in knots.

RAT:InitSpeedKph(KPH)

[Airplane] Set the initial speed on spawning in kilometers per hour.

RAT:InitSpeedMps(MPS)

[Airplane] Set the initial speed on spawning in meters per second.

RAT:InitUnControlled(UnControlled)

(AIR) Will spawn a plane group in UnControlled or Controlled mode...

RAT.LateActivated

RAT.MaxAliveGroups

RAT.MaxAliveUnits

RAT:New(SpawnTemplatePrefix)

Creates the main object to spawn a Wrapper.Group defined in the DCS ME.

RAT:NewFromTemplate(SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix, NoMooseNamingPostfix)

Creates a new SPAWN instance to create new groups based on the provided template.

RAT:NewWithAlias(SpawnTemplatePrefix, SpawnAliasPrefix)

Creates a new SPAWN instance to create new groups based on the defined template and using a new alias for each new group.

RAT:OnSpawnGroup(SpawnCallBackFunction, SpawnFunctionArguments, ...)

Allows to place a CallFunction hook when a new group spawns.

RAT:ParkAircraft(SpawnAirbase, TerminalType, Parkingdata, SpawnIndex)

Will park a group at an Wrapper.Airbase.

RAT:ParkAtAirbase(SpawnAirbase, TerminalType, Parkingdata)

Will park a group at an Wrapper.Airbase.

RAT:ReSpawn(SpawnIndex)

Will re-spawn a group based on a given index.

RAT.Repeat

RAT.RepeatOnEngineShutDown

RAT.RepeatOnLanding

RAT:SetSpawnIndex(SpawnIndex)

Set the spawn index to a specified index number.

RAT:Spawn()

Will spawn a group based on the internal index.

RAT.SpawnAliasPrefix

RAT:SpawnAtAirbase(SpawnAirbase, Takeoff, TakeoffAltitude, TerminalType, EmergencyAirSpawn, Parkingdata)

Will spawn a group at an Wrapper.Airbase.

RAT:SpawnAtParkingSpot(Airbase, Spots, Takeoff)

Spawn a group on an Wrapper.Airbase at a specific parking spot.

RAT.SpawnCleanUpInterval

RAT.SpawnCleanUpTimeStamps

RAT.SpawnCount

RAT:SpawnFromCoordinate(Coordinate, SpawnIndex)

Will spawn a group from a Coordinate in 3D space.

RAT.SpawnFromNewPosition

RAT:SpawnFromPointVec2(PointVec2, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a POINT_VEC2 in 3D space.

RAT:SpawnFromPointVec3(PointVec3, SpawnIndex)

Will spawn a group from a PointVec3 in 3D space.

RAT:SpawnFromStatic(HostStatic, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a hosting static.

RAT:SpawnFromUnit(HostUnit, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a hosting unit.

RAT:SpawnFromVec2(Vec2, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a Vec2 in 3D space.

RAT:SpawnFromVec3(Vec3, SpawnIndex)

Will spawn a group from a Vec3 in 3D space.

RAT.SpawnFunctionArguments

RAT.SpawnFunctionHook

RAT:SpawnGroupName(SpawnIndex)

Will return the SpawnGroupName either with with a specific count number or without any count.

RAT.SpawnGrouping

RAT.SpawnGroups

RAT.SpawnHiddenOnMFD

RAT.SpawnHiddenOnMap

RAT.SpawnHiddenOnPlanner

RAT.SpawnHookScheduler

RAT:SpawnInZone(Zone, RandomizeGroup, MinHeight, MaxHeight, SpawnIndex)

Will spawn a Group within a given Core.Zone.

RAT.SpawnIndex

RAT.SpawnInitAirbase

RAT.SpawnInitCallSign

RAT.SpawnInitCallSignID

RAT.SpawnInitCallSignMajor

RAT.SpawnInitCallSignMinor

RAT.SpawnInitCallSignName

RAT.SpawnInitCategory

RAT.SpawnInitCoalition

RAT.SpawnInitCountry

RAT.SpawnInitFreq

RAT.SpawnInitGroupHeadingMax

RAT.SpawnInitGroupHeadingMin

RAT.SpawnInitGroupUnitVar

RAT.SpawnInitHeadingMax

RAT.SpawnInitHeadingMin

RAT.SpawnInitKeepUnitNames

RAT.SpawnInitLimit

RAT.SpawnInitLivery

RAT.SpawnInitModex

RAT.SpawnInitModexPostfix

RAT.SpawnInitModexPrefix

RAT.SpawnInitModu

RAT.SpawnInitPosition

RAT.SpawnInitRadio

RAT.SpawnInitSADL

RAT.SpawnInitSTN

RAT.SpawnInitSkill

RAT.SpawnInitTakeoff

RAT.SpawnInitTerminalType

RAT.SpawnInnerRadius

RAT.SpawnIsScheduled

RAT.SpawnMaxGroups

RAT.SpawnMaxUnitsAlive

RAT.SpawnOuterRadius

RAT.SpawnRandomCallsign

RAT.SpawnRandomize

RAT.SpawnRandomizePosition

RAT.SpawnRandomizePositionInnerRadius

RAT.SpawnRandomizePositionOuterRadius

RAT.SpawnRandomizeRoute

RAT.SpawnRandomizeRouteEndPoint

RAT.SpawnRandomizeRouteHeight

RAT.SpawnRandomizeRouteRadius

RAT.SpawnRandomizeRouteStartPoint

RAT.SpawnRandomizeTemplate

RAT.SpawnRandomizeUnits

RAT.SpawnRandomizeZones

RAT:SpawnScheduleStart()

Will re-start the spawning scheduler.

RAT:SpawnScheduleStop()

Will stop the scheduled spawning scheduler.

RAT:SpawnScheduled(SpawnTime, SpawnTimeVariation, WithDelay)

Spawns new groups at varying time intervals.

RAT.SpawnScheduler

RAT.SpawnTemplate

RAT.SpawnTemplatePrefix

RAT.SpawnTemplatePrefixTable

RAT.SpawnUnControlled

RAT.SpawnUnitsWithAbsolutePositions

RAT.SpawnUnitsWithRelativePositions

RAT.SpawnVisible

RAT:SpawnWithIndex(SpawnIndex, NoBirth)

Will spawn a group with a specified index number.

RAT.SpawnZoneTable

RAT.Takeoff

RAT.TweakedTemplate

RAT.UnControlled

RAT.UnitsAbsolutePositions

RAT.UnitsRelativePositions

RAT:_GetGroupCategoryID(SpawnPrefix)

Gets the CategoryID of the Group with the given SpawnPrefix

RAT:_GetGroupCoalitionID(SpawnPrefix)

Gets the CoalitionID of the Group with the given SpawnPrefix

RAT:_GetGroupCountryID(SpawnPrefix)

Gets the CountryID of the Group with the given SpawnPrefix

RAT:_GetLastIndex()

Return the last maximum index that can be used.

RAT:_GetPrefixFromGroup(SpawnGroup)

Return the prefix of a SpawnUnit.

RAT:_GetPrefixFromGroupName(SpawnGroupName)

Return the prefix of a spawned group.

RAT:_GetSpawnIndex(SpawnIndex)

Get the next index of the groups to be spawned.

RAT:_GetTemplate(SpawnTemplatePrefix)

Gets the Group Template from the ME environment definition.

RAT:_InitializeSpawnGroups(SpawnIndex)

Initalize the SpawnGroups collection.

RAT:_OnBirth(EventData)

RAT:_OnDeadOrCrash(EventData)

RAT:_OnEngineShutDown(EventData)

Will detect AIR Units shutting down their engines ...

RAT:_OnLand(EventData)

Will detect AIR Units landing...

RAT:_OnTakeOff(EventData)

Will detect AIR Units taking off...

RAT:_Prepare(SpawnTemplatePrefix, SpawnIndex)

Prepares the new Group Template.

RAT:_RandomizeRoute(SpawnIndex)

Private method randomizing the routes.

RAT:_RandomizeTemplate(SpawnIndex)

Private method that randomizes the template of the group.

RAT:_RandomizeZones(SpawnIndex)

Private method that randomizes the Core.Zones where the Group will be spawned.

RAT:_Scheduler()

This function is called automatically by the Spawning scheduler.

RAT:_SetInitialPosition(SpawnIndex)

Private method that sets the DCS#Vec2 where the Group will be spawned.

RAT:_SpawnCleanUpScheduler()

Schedules the CleanUp of Groups

RAT:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)

Fields and Methods inherited from BASE Description

RAT.ClassID

The ID number of the class.

RAT.ClassName

The name of the class.

RAT.ClassNameAndID

The name of the class concatenated with the ID number of the class.

RAT:ClearState(Object, StateName)

Clear the state of an object.

RAT:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

RAT:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

RAT:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

RAT:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

RAT:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

RAT:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

RAT:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

RAT:E(Arguments)

Log an exception which will be traced always.

RAT:EventDispatcher()

Returns the event dispatcher

RAT:EventRemoveAll()

Remove all subscribed events

RAT:F(Arguments)

Trace a function call.

RAT:F2(Arguments)

Trace a function call level 2.

RAT:F3(Arguments)

Trace a function call level 3.

RAT:GetClassID()

Get the ClassID of the class instance.

RAT:GetClassName()

Get the ClassName of the class instance.

RAT:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

RAT:GetEventPriority()

Get the Class Core.Event processing Priority.

RAT:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

RAT:GetState(Object, Key)

Get a Value given a Key from the Object.

RAT:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

RAT:I(Arguments)

Log an information which will be traced always.

RAT:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

RAT:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

RAT:IsTrace()

Enquires if tracing is on (for the class).

RAT:New()

BASE constructor.

RAT:OnEvent(EventData)

Occurs when an Event for an object is triggered.

RAT:OnEventBDA(EventData)

BDA.

RAT:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

RAT:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

RAT:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

RAT:OnEventDead(EventData)

Occurs when an object is dead.

RAT:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

RAT:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

RAT:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

RAT:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

RAT:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

RAT:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

RAT:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

RAT:OnEventKill(EventData)

Occurs on the death of a unit.

RAT:OnEventLand(EventData)

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.

RAT:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

RAT:OnEventLandingQualityMark(EventData)

Landing quality mark.

RAT:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

RAT:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

RAT:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

RAT:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

RAT:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

RAT:OnEventParatrooperLanding(EventData)

Weapon add.

RAT:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

RAT:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

RAT:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

RAT:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

RAT:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

RAT:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

RAT:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

RAT:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

RAT:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

RAT:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

RAT:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

RAT:OnEventTriggerZone(EventData)

Trigger zone.

RAT:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

RAT:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

RAT:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

RAT:ScheduleStop(SchedulerID)

Stops the Schedule.

RAT.Scheduler

RAT:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

RAT:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

RAT:T(Arguments)

Trace a function logic level 1.

RAT:T2(Arguments)

Trace a function logic level 2.

RAT:T3(Arguments)

Trace a function logic level 3.

RAT:TraceAll(TraceAll)

Trace all methods in MOOSE

RAT:TraceClass(Class)

Set tracing for a class

RAT:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

RAT:TraceLevel(Level)

Set trace level

RAT:TraceOff()

Set trace off.

RAT:TraceOn()

Set trace on.

RAT:TraceOnOff(TraceOnOff)

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.

RAT:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

RAT._

RAT:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

RAT:_Serialize(Arguments)

(Internal) Serialize arguments

RAT:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

RAT.__

RAT:onEvent(event)

The main event handling function...

Fields and Methods inherited from RATMANAGER Description

RATMANAGER:Add(ratobject, min)

Adds a RAT object to the RAT manager.

RATMANAGER.ClassName

Name of the Class.

RATMANAGER.Debug

If true, be more verbose on output in DCS.log file.

RATMANAGER:New(ntot)

Creates a new RATMANAGER object.

RATMANAGER:SetTcheck(dt)

Sets the time interval between checks of alive RAT groups.

RATMANAGER:SetTspawn(dt)

Sets the time interval between spawning of groups.

RATMANAGER:Start(delay)

Starts the RAT manager and spawns the initial random number RAT groups for each RAT object.

RATMANAGER:Stop(delay)

Stops the RAT manager.

RATMANAGER.Tcheck

Time interval in seconds between checking of alive groups.

RATMANAGER:_Count()

Counts the number of alive RAT objects.

RATMANAGER:_Manage()

Manager function.

RATMANAGER:_RollDice(nrat, ntot, min, alive)

Rolls the dice for the number of necessary spawns.

RATMANAGER:_Spawn(RATMANAGER, i)

Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.

RATMANAGER:_Start()

Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.

RATMANAGER:_Stop()

Instantly stops the RAT manager by terminating its scheduler.

RATMANAGER.alive

Number of currently alive groups.

RATMANAGER.dTspawn

Time interval in seconds between spawns of groups.

RATMANAGER.id

Some ID to identify who we are in output of the DCS.log file.

RATMANAGER.manager

Scheduler managing the RAT objects.

RATMANAGER.managerid

Managing scheduler id.

RATMANAGER.min

Minimum number of RAT groups alive.

RATMANAGER.name

Name (alias) of RAT object.

RATMANAGER.nrat

Number of RAT objects.

RATMANAGER.ntot

Total number of active RAT groups.

RATMANAGER.rat

Array holding RAT objects etc.

Fields and Methods inherited from BASE Description

RATMANAGER.ClassID

The ID number of the class.

RATMANAGER.ClassName

The name of the class.

RATMANAGER.ClassNameAndID

The name of the class concatenated with the ID number of the class.

RATMANAGER:ClearState(Object, StateName)

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.

RATMANAGER:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

RATMANAGER:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

RATMANAGER:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

RATMANAGER:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

RATMANAGER:E(Arguments)

Log an exception which will be traced always.

RATMANAGER:EventDispatcher()

Returns the event dispatcher

RATMANAGER:EventRemoveAll()

Remove all subscribed events

RATMANAGER:F(Arguments)

Trace a function call.

RATMANAGER:F2(Arguments)

Trace a function call level 2.

RATMANAGER:F3(Arguments)

Trace a function call level 3.

RATMANAGER:GetClassID()

Get the ClassID of the class instance.

RATMANAGER:GetClassName()

Get the ClassName of the class instance.

RATMANAGER:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

RATMANAGER:GetEventPriority()

Get the Class Core.Event processing Priority.

RATMANAGER:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

RATMANAGER:GetState(Object, Key)

Get a Value given a Key from the Object.

RATMANAGER:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

RATMANAGER:I(Arguments)

Log an information which will be traced always.

RATMANAGER:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

RATMANAGER:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

RATMANAGER:IsTrace()

Enquires if tracing is on (for the class).

RATMANAGER:New()

BASE constructor.

RATMANAGER:OnEvent(EventData)

Occurs when an Event for an object is triggered.

RATMANAGER:OnEventBDA(EventData)

BDA.

RATMANAGER:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

RATMANAGER:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

RATMANAGER:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

RATMANAGER:OnEventDead(EventData)

Occurs when an object is dead.

RATMANAGER:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

RATMANAGER:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

RATMANAGER:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

RATMANAGER:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

RATMANAGER:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

RATMANAGER:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

RATMANAGER:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

RATMANAGER:OnEventKill(EventData)

Occurs on the death of a unit.

RATMANAGER:OnEventLand(EventData)

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.

RATMANAGER:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

RATMANAGER:OnEventLandingQualityMark(EventData)

Landing quality mark.

RATMANAGER:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

RATMANAGER:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

RATMANAGER:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

RATMANAGER:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

RATMANAGER:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

RATMANAGER:OnEventParatrooperLanding(EventData)

Weapon add.

RATMANAGER:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

RATMANAGER:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

RATMANAGER:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

RATMANAGER:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

RATMANAGER:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

RATMANAGER:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

RATMANAGER:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

RATMANAGER:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

RATMANAGER:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

RATMANAGER:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

RATMANAGER:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

RATMANAGER:OnEventTriggerZone(EventData)

Trigger zone.

RATMANAGER:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

RATMANAGER:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

RATMANAGER:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

RATMANAGER:ScheduleStop(SchedulerID)

Stops the Schedule.

RATMANAGER.Scheduler

RATMANAGER:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

RATMANAGER:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

RATMANAGER:T(Arguments)

Trace a function logic level 1.

RATMANAGER:T2(Arguments)

Trace a function logic level 2.

RATMANAGER:T3(Arguments)

Trace a function logic level 3.

RATMANAGER:TraceAll(TraceAll)

Trace all methods in MOOSE

RATMANAGER:TraceClass(Class)

Set tracing for a class

RATMANAGER:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

RATMANAGER:TraceLevel(Level)

Set trace level

RATMANAGER:TraceOff()

Set trace off.

RATMANAGER:TraceOn()

Set trace on.

RATMANAGER:TraceOnOff(TraceOnOff)

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.

RATMANAGER:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

RATMANAGER._

RATMANAGER:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

RATMANAGER:_Serialize(Arguments)

(Internal) Serialize arguments

RATMANAGER:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

RATMANAGER.__

RATMANAGER:onEvent(event)

The main event handling function...

  • RAT class

Field(s)

#table RAT.ATC

RAT ATC.

#boolean RAT.ATCswitch

Enable/disable ATC if set to true/false.

#number RAT.AlphaDescent

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.

#string RAT.ClassName

Name of the Class.

#boolean RAT.Debug

Turn debug messages on or off.

#number RAT.FLcruise

Cruise altitude of aircraft. Default FL200 for planes and F005 for helos.

#number RAT.FLmaxuser

Maximum flight level set by user.

#number RAT.FLminuser

Minimum flight level set by user.

#number RAT.FLuser

Flight level set by users explicitly.

#table RAT.Menu

F10 menu items for this RAT object.

#string RAT.MenuF10

Main F10 menu.

#number RAT.Ndeparture_Airports

Number of departure airports set via SetDeparture().

#number RAT.Ndeparture_Zones

Number of departure zones set via SetDeparture.

#number RAT.Ndestination_Airports

Number of destination airports set via SetDestination().

#number RAT.Ndestination_Zones

Number of destination zones set via SetDestination().

#table RAT.ROE

RAT rules of engagement.

#table RAT.ROT

RAT reaction to threat.

#boolean RAT.SpawnUnControlled

This is used in the SPAWN:SpawnWithIndex() function. Some values are overwritten there!

#string RAT.SubMenuName

Submenu name for RAT object.

#number RAT.Tinactive

Time in seconds after which inactive units will be destroyed. Default is 300 seconds.

#number RAT.Vclimb

Default climb rate in ft/min.

#number RAT.Vcruisemax

Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.

#number RAT.activate_delay

Delay in seconds before first uncontrolled group is activated. Default is 5 seconds.

#number RAT.activate_delta

Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds.

#number RAT.activate_frand

Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0.

#number RAT.activate_max

Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1.

#boolean RAT.activate_uncontrolled

If true, uncontrolled are activated randomly after certain time intervals.

#boolean RAT.addfriendlydepartures

Add all friendly airports to departures.

#boolean RAT.addfriendlydestinations

Add all friendly airports to destinations.

#table RAT.aircraft

Table which holds the basic aircraft properties (speed, range, ...).

#table RAT.airports

All airports of friedly coalitions.

#table RAT.airports_map

All airports available on current map (Caucasus, Nevada, Normandy, ...).

#string RAT.alias

Alias for spawned group.

#number RAT.alive

Number of groups which are alive.

#table RAT.cat
#string RAT.category

Category of aircarft: "plane" or "heli".

#boolean RAT.checkonrunway

Aircraft are checked if they were accidentally spawned on the runway. Default is true.

#boolean RAT.checkontop

Aircraft are checked if they were accidentally spawned on top of another unit. Default is true.

#table RAT.coal

RAT friendly coalitions.

#number RAT.coalition

Coalition of spawn group template.

#boolean RAT.commute

Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation.

#boolean RAT.continuejourney

Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination.

#number RAT.country

Country of spawn group template.

#table RAT.ctable

Table with the valid coalitions from choice self.friendly.

Core.Zone#ZONE RAT.departure_Azone

Zone containing the departure airports.

#table RAT.departure_ports

Array containing the names of the destination airports or zones.

#boolean RAT.despawnair

If true, aircraft are despawned when they reach their destination zone. Default.

Core.Zone#ZONE RAT.destination_Azone

Zone containing the destination airports.

#table RAT.destination_ports

Array containing the names of the destination airports or zones.

#boolean RAT.destinationzone

Destination is a zone and not an airport.

#boolean RAT.eplrs

If true, turn on EPLSR datalink for the RAT group.

#table RAT.excluded_ports

Array containing the names of explicitly excluded airports.

#boolean RAT.f10menu

If true, add an F10 radiomenu for RAT. Default is false.

#number RAT.frequency

Radio frequency used by the RAT groups.

#string RAT.friendly

Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.

#number RAT.groupsize

Number of aircraft in group.

#string RAT.homebase

Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way.

#string RAT.id

Some ID to identify who we are in output of the DCS.log file.

#boolean RAT.immortal

If true, aircraft are spawned as immortal.

#boolean RAT.invisible

If true aircraft are set to invisible for other AI forces.

#number RAT.landing

Landing type. Determines if we actually land at an airport or treat it as zone.

#string RAT.livery

Livery of the aircraft set by user.

#number RAT.markerid

Running number of placed markers on the F10 map.

#table RAT.markerids

Array with marker IDs.

#number RAT.maxdist

Max distance from departure to destination in meters. Default 5000 km.

#number RAT.mindist

Min distance from departure to destination in meters. Default 5 km.

#string RAT.modulation

Ratio modulation. Either "FM" or "AM".

#number RAT.ngroups

Number of groups to be spawned in total.

#boolean RAT.norespawn

Aircraft will not be respawned after they have finished their route.

#string RAT.onboardnum

Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor.

#number RAT.onboardnum0

(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1.

#number RAT.onrunwaymaxretry

Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3.

#number RAT.onrunwayradius

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.

#number RAT.ontopradius

Radius in meters until which a unit is considered to be on top of another. Default is 2 m.

#number RAT.parkingscanradius

Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery.

#boolean RAT.parkingscanscenery

If true, area around parking spots is scanned for scenery objects. Default is false.

#boolean RAT.parkingverysafe

If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false.

#boolean RAT.placemarkers

Place markers of waypoints on F10 map.

#boolean RAT.radio

If true/false disables radio messages from the RAT groups.

#boolean RAT.random_departure

By default a random friendly airport is chosen as departure.

#boolean RAT.random_destination

By default a random friendly airport is chosen as destination.

#table RAT.ratcraft

Array with the spawned RAT aircraft.

#boolean RAT.reportstatus

Aircraft report status.

#boolean RAT.respawn_after_crash

Aircraft will be respawned after a crash, e.g. when they get shot down.

#boolean RAT.respawn_after_takeoff

Aircraft will be respawned directly after take-off.

#boolean RAT.respawn_at_landing

Respawn aircraft the moment they land rather than at engine shutdown.

#number RAT.respawn_delay

Delay in seconds until a repawn happens.

#boolean RAT.respawn_inair

Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true.

#table RAT.return_zones

Array containing the names of the return zones.

#boolean RAT.returnzone

Zone where aircraft will fly to before returning to their departure airport.

#string RAT.roe

ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free".

#string RAT.rot

ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade".

#string RAT.skill

Skill of AI.

#number RAT.spawndelay

Delay time in seconds before first spawning happens.

#boolean RAT.spawninitialized

If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again.

#number RAT.spawninterval

Interval between spawning units/groups. Note that we add a randomization of 50%.

#boolean RAT.starshape

If true, aircraft travel A-->B-->A-->C-->A-->D... for commute.

#table RAT.status

RAT aircraft status.

#number RAT.statusinterval

Intervall between status checks (and reports if enabled).

#number RAT.takeoff

Takeoff type. 0=coldorhot.

Wrapper.Group#GROUP RAT.templategroup

Group serving as template for the RAT aircraft.

Wrapper.Airbase#AIRBASE.TerminalType RAT.termtype

Type of terminal to be used when spawning at an airbase.

#boolean RAT.uncontrolled

If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated.

#table RAT.unit

RAT unit conversions.

#table RAT.version

RAT version.

#table RAT.waypointdescriptions

Table with strings for waypoint descriptions of markers.

#table RAT.waypointstatus

Table with strings of waypoint status.

#table RAT.wp

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Add all friendly airports to the list of possible destinations

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Enable debug mode.

More output in dcs.log file and onscreen messages to all.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Destinations are treated as zones.

Aircraft will not land but rather be despawned when they reach a random point in the zone.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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:

Group.

Return value:

#string:

status Status of group.

Aircraft are immortal.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Aircraft are invisible.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Parameter:

#string name

Submenu name.

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Parameter:

#boolean switch

true=yes, false=no.

Return value:

#RAT:

RAT self object.

Set radio frequency.

Defined in:

RAT

Parameter:

#number frequency

Radio frequency.

Return value:

#RAT:

RAT self object.

Radio menu Off.

This is the default setting.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Radio menu On.

Default is off.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Enable Radio.

Overrules the ME setting.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Aircraft will not be respawned after they crashed or get shot down.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Aircraft will be respawned after they crashed or get shot down.

This is the default behavior.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Aircraft will fly to a random point within a zone and then return to its departure airport or zone.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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:

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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:

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.

Defined in:

RAT

Parameter:

#number alt

Altitude ASL in meters.

Return value:

#RAT:

RAT self object.

Set the maximum cruise speed of the aircraft.

Defined in:

RAT

Parameter:

#number speed

Speed in km/h.

Return value:

#RAT:

RAT self object.

Set maximum distance between departure and destination.

Default is 5000 km but aircarft range is also taken into account automatically.

Defined in:

RAT

Parameter:

#number dist

Distance in km.

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Parameter:

#number alt

Altitude ASL in meters.

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Parameter:

#number dist

Distance in km.

Return value:

#RAT:

RAT self object.

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. 001, 002, ...

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

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Enables scanning for scenery objects around parking spots which might block the spot.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

A parking spot is free as soon as possible aircraft has left the place.

This is the default.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

A parking spot is not free until a possible aircraft has left and taken off.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Set takeoff type cold.

Aircraft will spawn at a parking spot with engines off.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Set takeoff type to cold or hot.

Aircraft will spawn at a parking spot with 50:50 change of engines on or off.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Set takeoff type to hot.

Aircraft will spawn at a parking spot with engines on.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

Set takeoff type to runway.

Aircraft will spawn directly on the runway.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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:

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.

Defined in:

RAT

Return value:

#RAT:

RAT self object.

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.

ATC status report about flights.

Defined in:

RAT

Randomly activates an uncontrolled aircraft.

Defined in:

RAT

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:

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:

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:

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.

Defined in:

RAT

Parameter:

Group to be activated.

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.

Delete all markers on F10 map.

Defined in:

RAT

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:

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.

Defined in:

RAT

Parameter:

The RAT group to be destroyed.

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:

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 all airports of the current map.

Defined in:

RAT

Get (relative) life of first unit of a group.

Defined in:

RAT

Parameter:

Group of unit.

Return value:

#number:

Life of unit in percent.

Get aircraft dimensions length, width, height.

Defined in:

RAT

Parameter:

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.

Defined in:

RAT

Parameter:

DCS#Group DCSgroup

Group of the aircraft 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.

(Optional) Place where spawning should happen. If not present, first waypoint is taken.

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.

Defined in:

RAT

Parameter:

Function is executed when a unit crashes.

Defined in:

RAT

Parameter:

Function is executed when a unit is dead.

Defined in:

RAT

Parameter:

Function is executed when a unit is dead or crashes.

Defined in:

RAT

Parameter:

Function is executed when a unit shuts down its engines.

Defined in:

RAT

Parameter:

Function is executed when a unit starts its engines.

Defined in:

RAT

Parameter:

Function is executed when a unit is hit.

Defined in:

RAT

Parameter:

Function is executed when a unit lands.

Defined in:

RAT

Parameter:

Function is executed when a unit takes off.

Defined in:

RAT

Parameter:

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:

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.

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:

Group for which the ROE is set.

#string roe

ROE of group.

Set ROT for a group.

Defined in:

RAT

Parameters:

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.

(Optional) Departure airbase.

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

Defined in:

RAT

Parameters:

Group.

#string status

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

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

Defined in:

RAT

Parameters:

The point to hold the position.

#number Altitude

The altitude ASL at which to hold the position.

#number Speed

The speed flying when holding the position in m/s.

#number Duration

Duration of holding pattern in seconds.

Return value:

DCSTask

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.

3D coordinate of the waypoint.

#number Speed

Speed in m/s.

#number Altitude

Altitude in m.

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:

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.

Field(s)

#table RAT.ATC

RAT ATC.

#boolean RAT.ATCswitch

Enable/disable ATC if set to true/false.

#number RAT.AlphaDescent

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.

#string RAT.ClassName

Name of the Class.

#boolean RAT.Debug

Turn debug messages on or off.

#number RAT.FLcruise

Cruise altitude of aircraft. Default FL200 for planes and F005 for helos.

#number RAT.FLmaxuser

Maximum flight level set by user.

#number RAT.FLminuser

Minimum flight level set by user.

#number RAT.FLuser

Flight level set by users explicitly.

#table RAT.Menu

F10 menu items for this RAT object.

#string RAT.MenuF10

Main F10 menu.

#number RAT.Ndeparture_Airports

Number of departure airports set via SetDeparture().

#number RAT.Ndeparture_Zones

Number of departure zones set via SetDeparture.

#number RAT.Ndestination_Airports

Number of destination airports set via SetDestination().

#number RAT.Ndestination_Zones

Number of destination zones set via SetDestination().

#table RAT.ROE

RAT rules of engagement.

#table RAT.ROT

RAT reaction to threat.

#boolean RAT.SpawnUnControlled

This is used in the SPAWN:SpawnWithIndex() function. Some values are overwritten there!

#string RAT.SubMenuName

Submenu name for RAT object.

#number RAT.Tinactive

Time in seconds after which inactive units will be destroyed. Default is 300 seconds.

#number RAT.Vclimb

Default climb rate in ft/min.

#number RAT.Vcruisemax

Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.

#number RAT.activate_delay

Delay in seconds before first uncontrolled group is activated. Default is 5 seconds.

#number RAT.activate_delta

Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds.

#number RAT.activate_frand

Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0.

#number RAT.activate_max

Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1.

#boolean RAT.activate_uncontrolled

If true, uncontrolled are activated randomly after certain time intervals.

#boolean RAT.addfriendlydepartures

Add all friendly airports to departures.

#boolean RAT.addfriendlydestinations

Add all friendly airports to destinations.

#table RAT.aircraft

Table which holds the basic aircraft properties (speed, range, ...).

#table RAT.airports

All airports of friedly coalitions.

#table RAT.airports_map

All airports available on current map (Caucasus, Nevada, Normandy, ...).

#string RAT.alias

Alias for spawned group.

#number RAT.alive

Number of groups which are alive.

#table RAT.cat
#string RAT.category

Category of aircarft: "plane" or "heli".

#boolean RAT.checkonrunway

Aircraft are checked if they were accidentally spawned on the runway. Default is true.

#boolean RAT.checkontop

Aircraft are checked if they were accidentally spawned on top of another unit. Default is true.

#table RAT.coal

RAT friendly coalitions.

#number RAT.coalition

Coalition of spawn group template.

#boolean RAT.commute

Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation.

#boolean RAT.continuejourney

Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination.

#number RAT.country

Country of spawn group template.

#table RAT.ctable

Table with the valid coalitions from choice self.friendly.

Core.Zone#ZONE RAT.departure_Azone

Zone containing the departure airports.

#table RAT.departure_ports

Array containing the names of the destination airports or zones.

#boolean RAT.despawnair

If true, aircraft are despawned when they reach their destination zone. Default.

Core.Zone#ZONE RAT.destination_Azone

Zone containing the destination airports.

#table RAT.destination_ports

Array containing the names of the destination airports or zones.

#boolean RAT.destinationzone

Destination is a zone and not an airport.

#boolean RAT.eplrs

If true, turn on EPLSR datalink for the RAT group.

#table RAT.excluded_ports

Array containing the names of explicitly excluded airports.

#boolean RAT.f10menu

If true, add an F10 radiomenu for RAT. Default is false.

#number RAT.frequency

Radio frequency used by the RAT groups.

#string RAT.friendly

Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.

#number RAT.groupsize

Number of aircraft in group.

#string RAT.homebase

Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way.

#string RAT.id

Some ID to identify who we are in output of the DCS.log file.

#boolean RAT.immortal

If true, aircraft are spawned as immortal.

#boolean RAT.invisible

If true aircraft are set to invisible for other AI forces.

#number RAT.landing

Landing type. Determines if we actually land at an airport or treat it as zone.

#string RAT.livery

Livery of the aircraft set by user.

#number RAT.markerid

Running number of placed markers on the F10 map.

#table RAT.markerids

Array with marker IDs.

#number RAT.maxdist

Max distance from departure to destination in meters. Default 5000 km.

#number RAT.mindist

Min distance from departure to destination in meters. Default 5 km.

#string RAT.modulation

Ratio modulation. Either "FM" or "AM".

#number RAT.ngroups

Number of groups to be spawned in total.

#boolean RAT.norespawn

Aircraft will not be respawned after they have finished their route.

#string RAT.onboardnum

Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor.

#number RAT.onboardnum0

(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1.

#number RAT.onrunwaymaxretry

Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3.

#number RAT.onrunwayradius

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.

#number RAT.ontopradius

Radius in meters until which a unit is considered to be on top of another. Default is 2 m.

#number RAT.parkingscanradius

Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery.

#boolean RAT.parkingscanscenery

If true, area around parking spots is scanned for scenery objects. Default is false.

#boolean RAT.parkingverysafe

If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false.

#boolean RAT.placemarkers

Place markers of waypoints on F10 map.

#boolean RAT.radio

If true/false disables radio messages from the RAT groups.

#boolean RAT.random_departure

By default a random friendly airport is chosen as departure.

#boolean RAT.random_destination

By default a random friendly airport is chosen as destination.

#table RAT.ratcraft

Array with the spawned RAT aircraft.

#boolean RAT.reportstatus

Aircraft report status.

#boolean RAT.respawn_after_crash

Aircraft will be respawned after a crash, e.g. when they get shot down.

#boolean RAT.respawn_after_takeoff

Aircraft will be respawned directly after take-off.

#boolean RAT.respawn_at_landing

Respawn aircraft the moment they land rather than at engine shutdown.

#number RAT.respawn_delay

Delay in seconds until a repawn happens.

#boolean RAT.respawn_inair

Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true.

#table RAT.return_zones

Array containing the names of the return zones.

#boolean RAT.returnzone

Zone where aircraft will fly to before returning to their departure airport.

#string RAT.roe

ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free".

#string RAT.rot

ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade".

#string RAT.skill

Skill of AI.

#number RAT.spawndelay

Delay time in seconds before first spawning happens.

#boolean RAT.spawninitialized

If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again.

#number RAT.spawninterval

Interval between spawning units/groups. Note that we add a randomization of 50%.

#boolean RAT.starshape

If true, aircraft travel A-->B-->A-->C-->A-->D... for commute.

#table RAT.status

RAT aircraft status.

#number RAT.statusinterval

Intervall between status checks (and reports if enabled).

#number RAT.takeoff

Takeoff type. 0=coldorhot.

Wrapper.Group#GROUP RAT.templategroup

Group serving as template for the RAT aircraft.

Wrapper.Airbase#AIRBASE.TerminalType RAT.termtype

Type of terminal to be used when spawning at an airbase.

#boolean RAT.uncontrolled

If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated.

#table RAT.unit

RAT unit conversions.

#table RAT.version

RAT version.

#table RAT.waypointdescriptions

Table with strings for waypoint descriptions of markers.

#table RAT.waypointstatus

Table with strings of waypoint status.

#table RAT.wp

RAT waypoint type.

Function(s)

Get the Coordinate of the Group that is Late Activated as the template for the SPAWN object.

Defined in:

Return value:

The Coordinate

Will find the first alive Wrapper.Group it has spawned, and return the alive Wrapper.Group object and the first Index where the first alive Wrapper.Group object has been found.

Defined in:

Return values:

The Wrapper.Group object found, the new Index where the group was found.

#nil, #nil:

When no group is found, #nil is returned.

Usage:


  -- Find the first alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
  local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
  while GroupPlane ~= nil do
    -- Do actions with the GroupPlane object.
    GroupPlane, Index = SpawnPlanes:GetNextAliveGroup( Index )
  end

Get the group from an index.

Returns the group from the SpawnGroups list. If no index is given, it will return the first group in the list.

Defined in:

Parameter:

#number SpawnIndex

The index of the group to return.

Return value:

Will find the last alive Wrapper.Group object, and will return a reference to the last live Wrapper.Group object and the last Index where the last alive Wrapper.Group object has been found.

Defined in:

Return values:

The last alive Wrapper.Group object found, the last Index where the last alive Wrapper.Group object was found.

#nil, #nil:

When no alive Wrapper.Group object is found, #nil is returned.

Usage:


  -- Find the last alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
  local GroupPlane, Index = SpawnPlanes:GetLastAliveGroup()
  if GroupPlane then -- GroupPlane can be nil!!!
    -- Do actions with the GroupPlane object.
  end

Will find the next alive Wrapper.Group object from a given Index, and return a reference to the alive Wrapper.Group object and the next Index where the alive Wrapper.Group has been found.

Defined in:

Parameter:

#number SpawnIndexStart

A Index holding the start position to search from. This method can also be used to find the first alive Wrapper.Group object from the given Index.

Return values:

The next alive Wrapper.Group object found, the next Index where the next alive Wrapper.Group object was found.

#nil, #nil:

When no alive Wrapper.Group object is found from the start Index position, #nil is returned.

Usage:


  -- Find the first alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
  local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
  while GroupPlane ~= nil do
    -- Do actions with the GroupPlane object.
    GroupPlane, Index = SpawnPlanes:GetNextAliveGroup( Index )
  end

Get the index from a given group.

The function will search the name of the group for a #, and will return the number behind the #-mark.

Defined in:

Parameter:

SpawnGroup

Turns the AI Off for the Wrapper.Group when spawning.

Defined in:

Return value:

The SPAWN object

Turns the AI On for the Wrapper.Group when spawning.

Defined in:

Return value:

The SPAWN object

Turns the AI On or Off for the Wrapper.Group when spawning.

Defined in:

Parameter:

#boolean AIOnOff

A value of true sets the AI On, a value of false sets the AI Off.

Return value:

The SPAWN object

Set spawns to happen at a particular airbase.

Only for aircraft, of course.

Defined in:

Parameters:

#string AirbaseName

Name of the airbase.

#number Takeoff

(Optional) Takeoff type. Can be SPAWN.Takeoff.Hot (default), SPAWN.Takeoff.Cold or SPAWN.Takeoff.Runway.

#number TerminalType

(Optional) The terminal type.

Return value:

self

Makes the groups visible before start (like a battalion).

The method will take the position of the group as the first position in the array. CAUTION: this directive will NOT work with OnSpawnGroup function.

Defined in:

Parameters:

#number SpawnAngle

The angle in degrees how the groups and each unit of the group will be positioned.

#number SpawnWidth

The amount of Groups that will be positioned on the X axis.

#number SpawnDeltaX

The space between each Group on the X-axis.

#number SpawnDeltaY

The space between each Group on the Y-axis.

Return value:

self

Usage:


  -- Define an array of Groups.
  Spawn_BE_Ground = SPAWN:New( 'BE Ground' )
                         :InitLimit( 2, 24 )
                         :InitArray( 90, 10, 100, 50 )

[BLUE AIR only!] This method sets a specific callsign for a spawned group.

Use for a group with one unit only!

Defined in:

Parameters:

#number ID

ID of the callsign enumerator, e.g. CALLSIGN.Tanker.Texaco - - resulting in e.g. Texaco-2-1

#string Name

Name of this callsign as it cannot be determined from the ID because of the dependency on the task type of the plane, and the plane type. E.g. "Texaco"

#number Minor

Minor number, i.e. the unit number within the group, e.g 2 - resulting in e.g. Texaco-2-1

#number Major

Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1

Return value:

self

Sets category ID of the group.

Defined in:

Parameter:

#number Category

Category id.

Return value:

self

Delete groups that have not moved for X seconds - AIR ONLY!!! DO NOT USE ON GROUPS THAT DO NOT MOVE OR YOUR SERVER WILL BURN IN HELL (Pikes - April 2020) When groups are still alive and have become inactive due to damage and are unable to contribute anything, then this group will be removed at defined intervals in seconds.

Defined in:

Parameter:

#string SpawnCleanUpInterval

The interval to check for inactive groups within seconds.

Return value:

self

Usage:


  Spawn_Helicopter:InitCleanUp( 20 )  -- CleanUp the spawning of the helicopters every 20 seconds when they become inactive.

Sets the coalition of the spawned group.

Note that it might be necessary to also set the country explicitly!

Defined in:

Parameter:

DCS#coalition.side Coalition

Coalition of the group as number of enumerator:

Return value:

self

Sets the country of the spawn group.

Note that the country determines the coalition of the group depending on which country is defined to be on which side for each specific mission!

Defined in:

Parameter:

#number Country

Country id as number or enumerator:

Return value:

self

Turns the Delay Off for the Wrapper.Group when spawning.

Defined in:

Return value:

The SPAWN object

Turns the Delay On for the Wrapper.Group when spawning with #SpawnScheduled().

In effect then the 1st group will only be spawned after the number of seconds given in SpawnScheduled as arguments, and not immediately.

Defined in:

Return value:

The SPAWN object

Defined in:

Parameter:

DelayOnOff

Defines the heading of the overall formation of the new spawned group.

The heading can be given as one fixed degree, or can be randomized between minimum and maximum degrees. The Group's formation as laid out in its template will be rotated around the first unit in the group Group individual units facings will rotate to match. If InitHeading is also applied to this SPAWN then that will take precedence for individual unit facings. Note that InitGroupHeading does not rotate the groups route; only its initial facing!

Defined in:

Parameters:

#number HeadingMin

The minimum or fixed heading in degrees.

#number HeadingMax

(optional) The maximum heading in degrees. This there is no maximum heading, then the heading for the group will be HeadingMin.

#number unitVar

(optional) Individual units within the group will have their heading randomized by +/- unitVar degrees. Default is zero.

Return value:

self

Usage:


mySpawner = SPAWN:New( ... )

  -- Spawn the Group with the formation rotated +100 degrees around unit #1, compared to the mission template.
  mySpawner:InitGroupHeading( 100 )

  -- Spawn the Group with the formation rotated units between +100 and +150 degrees around unit #1, compared to the mission template, and with individual units varying by +/- 10 degrees from their templated facing.
  mySpawner:InitGroupHeading( 100, 150, 10 )

  -- Spawn the Group with the formation rotated -60 degrees around unit #1, compared to the mission template, but with all units facing due north regardless of how they were laid out in the template.
  mySpawner:InitGroupHeading(-60):InitHeading(0)
  -- or
  mySpawner:InitHeading(0):InitGroupHeading(-60)

When spawning a new group, make the grouping of the units according the InitGrouping setting.

Defined in:

Parameter:

#number Grouping

Indicates the maximum amount of units in the group.

Return value:

Defines the Heading for the new spawned units.

The heading can be given as one fixed degree, or can be randomized between minimum and maximum degrees.

Defined in:

Parameters:

#number HeadingMin

The minimum or fixed heading in degrees.

#number HeadingMax

(optional) The maximum heading in degrees. This there is no maximum heading, then the heading will be fixed for all units using minimum heading.

Return value:

self

Usage:


  Spawn = SPAWN:New( ... )

  -- Spawn the units pointing to 100 degrees.
  Spawn:InitHeading( 100 )

  -- Spawn the units pointing between 100 and 150 degrees.
  Spawn:InitHeading( 100, 150 )

Hide the group on MFDs (visible to game master slots!).

Defined in:

Return value:

The SPAWN object

Hide the group on the map view (visible to game master slots!).

Defined in:

Return value:

The SPAWN object

Hide the group on planner (visible to game master slots!).

Defined in:

Return value:

The SPAWN object

Keeps the unit names as defined within the mission editor, but note that anything after a # mark is ignored, and any spaces before and after the resulting name are removed.

IMPORTANT! This method MUST be the first used after :New !!!

Defined in:

Parameter:

#boolean KeepUnitNames

(optional) If true, the unit names are kept, false or not provided to make new unit names.

Return value:

self

Flags that the spawned groups must be spawned late activated.

Defined in:

Parameter:

#boolean LateActivated

(optional) If true, the spawned groups are late activated.

Return value:

self

Stops any more repeat spawns from happening once the UNIT count of Alive units, spawned by the same SPAWN object, exceeds the first parameter.

Also can stop spawns from happening once a total GROUP still alive is met. Exceptionally powerful when combined with SpawnSchedule for Respawning. Note that this method is exceptionally important to balance the performance of the mission. Depending on the machine etc, a mission can only process a maximum amount of units. If the time interval must be short, but there should not be more Units or Groups alive than a maximum amount of units, then this method should be used... When a SPAWN.New is executed and the limit of the amount of units alive is reached, then no new spawn will happen of the group, until some of these units of the spawn object will be destroyed.

Defined in:

Parameters:

#number SpawnMaxUnitsAlive

The maximum amount of units that can be alive at runtime.

#number SpawnMaxGroups

The maximum amount of groups that can be spawned. When the limit is reached, then no more actual spawns will happen of the group. This parameter is useful to define a maximum amount of airplanes, ground troops, helicopters, ships etc within a supply area. This parameter accepts the value 0, which defines that there are no maximum group limits, but there are limits on the maximum of units that can be alive at the same time.

Return value:

self

Usage:


  -- NATO helicopters engaging in the battle field.
  -- This helicopter group consists of one Unit. So, this group will SPAWN maximum 2 groups simultaneously within the DCSRTE.
  -- There will be maximum 24 groups spawned during the whole mission lifetime. 
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitLimit( 2, 24 )

Sets livery of the group.

Defined in:

Parameter:

#string Livery

Livery name. Note that this is not necessarily the same name as displayed in the mission editor.

Return value:

self

Sets the modex of the first unit of the group.

If more units are in the group, the number is increased by one with every unit.

Defined in:

Parameters:

#number modex

Modex of the first unit.

#string prefix

(optional) String to prefix to modex, e.g. for French AdA Modex, eg. -L-102 then "-L-" would be the prefix.

#string postfix

(optional) String to postfix to modex, example tbd.

Return value:

self

This method sets a spawn position for the group that is different from the location of the template.

Defined in:

Parameter:

The position to spawn from

Return value:

self

This method sets a spawn position for the group that is different from the location of the template.

Defined in:

Parameter:

DCS#Vec2 Vec2

The position to spawn from

Return value:

self

Sets the radio communication on or off.

Same as checking/unchecking the COMM box in the mission editor.

Defined in:

Parameter:

#number switch

If true (or nil), enables the radio communication. If false, disables the radio for the spawned group.

Return value:

self

Sets the radio frequency of the group.

Defined in:

Parameter:

#number frequency

The frequency in MHz.

Return value:

self

Set radio modulation.

Default is AM.

Defined in:

Parameter:

#string modulation

Either "FM" or "AM". If no value is given, modulation is set to AM.

Return value:

self

[AIR/Fighter only!] This method randomizes the callsign for a new group.

Defined in:

Return value:

self

Randomizes the position of Wrapper.Groups that are spawned within a radius band, given an Outer and Inner radius, from the point that the spawn happens.

Defined in:

Parameters:

#boolean RandomizePosition

If true, SPAWN will perform the randomization of the Wrapper.Groups position between a given outer and inner radius.

DCS#Distance OuterRadius

(optional) The outer radius in meters where the new group will be spawned.

DCS#Distance InnerRadius

(optional) The inner radius in meters where the new group will NOT be spawned.

Return value:

Randomizes the defined route of the SpawnTemplatePrefix group in the ME.

This is very useful to define extra variation of the behavior of groups.

Defined in:

Parameters:

#number SpawnStartPoint

is the waypoint where the randomization begins. Note that the StartPoint = 0 equaling the point where the group is spawned.

#number SpawnEndPoint

is the waypoint where the randomization ends counting backwards. This parameter is useful to avoid randomization to end at a waypoint earlier than the last waypoint on the route.

#number SpawnRadius

is the radius in meters in which the randomization of the new waypoints, with the original waypoint of the original template located in the middle ...

#number SpawnHeight

(optional) Specifies the additional height in meters that can be added to the base height specified at each waypoint in the ME.

Return value:

Usage:


  -- NATO helicopters engaging in the battle field.
  -- The KA-50 has waypoints Start point ( =0 or SP ), 1, 2, 3, 4, End point (= 5 or DP).
  -- Waypoints 2 and 3 will only be randomized. The others will remain on their original position with each new spawn of the helicopter.
  -- The randomization of waypoint 2 and 3 will take place within a radius of 2000 meters.
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeRoute( 2, 2, 2000 )

This method is rather complicated to understand.

But I'll try to explain. This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.

Defined in:

Parameter:

#string SpawnTemplatePrefixTable

A table with the names of the groups defined within the mission editor, from which one will be chosen when a new group will be spawned.

Return value:

Usage:


  -- NATO Tank Platoons invading Gori.
  -- Choose between 13 different 'US Tank Platoon' configurations for each new SPAWN the Group to be spawned for the
  -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SpawnTemplatePrefixes.
  -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
  -- with a limit set of maximum 12 Units alive simultaneously  and 150 Groups to be spawned during the whole mission.
  Spawn_US_Platoon = { 'US Tank Platoon 1', 'US Tank Platoon 2', 'US Tank Platoon 3', 'US Tank Platoon 4', 'US Tank Platoon 5',
                       'US Tank Platoon 6', 'US Tank Platoon 7', 'US Tank Platoon 8', 'US Tank Platoon 9', 'US Tank Platoon 10',
                       'US Tank Platoon 11', 'US Tank Platoon 12', 'US Tank Platoon 13' }
  Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )

Randomize templates to be used as the unit representatives for the Spawned group, defined by specifying the prefix names.

This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.

Defined in:

Parameter:

#string SpawnTemplatePrefixes

A string or a list of string that contains the prefixes of the groups that are possible unit representatives of the group to be spawned.

Return value:

Usage:


 -- NATO Tank Platoons invading Gori.

  -- Choose between different 'US Tank Platoon Templates' configurations to be spawned for the
  -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.

  -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
  -- with a limit set of maximum 12 Units alive simultaneously  and 150 Groups to be spawned during the whole mission.

  Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )

Randomize templates to be used as the unit representatives for the Spawned group, defined using a SET_GROUP object.

This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.

Defined in:

Parameter:

Core.Set#SET_GROUP SpawnTemplateSet

A SET_GROUP object set, that contains the groups that are possible unit representatives of the group to be spawned.

Return value:

Usage:


  -- NATO Tank Platoons invading Gori.

  -- Choose between different 'US Tank Platoon Template' configurations to be spawned for the
  -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.

  -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
  -- with a limit set of maximum 12 Units alive simultaneously  and 150 Groups to be spawned during the whole mission.

  Spawn_US_PlatoonSet = SET_GROUP:New():FilterPrefixes( "US Tank Platoon Templates" ):FilterOnce()

  -- Now use the Spawn_US_PlatoonSet to define the templates using InitRandomizeTemplateSet.
  Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )

Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius.

Defined in:

Parameters:

#boolean RandomizeUnits

If true, SPAWN will perform the randomization of the Wrapper.Unit#UNITs position within the group between a given outer and inner radius.

DCS#Distance OuterRadius

(optional) The outer radius in meters where the new group will be spawned.

DCS#Distance InnerRadius

(optional) The inner radius in meters where the new group will NOT be spawned.

Return value:

Usage:


  -- NATO helicopters engaging in the battle field.
  -- UNIT positions of this group will be randomized around the base unit #1 in a circle of 50 to 500 meters.
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeUnits( true, 500, 50 )

This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.

Defined in:

Parameter:

#table SpawnZoneTable

A table with Core.Zone objects. If this table is given, then each spawn will be executed within the given list of Core.Zones objects.

Return value:

self

Usage:


   -- Create a zone table of the 2 zones.
   ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }

   Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" )
                          :InitLimit( 10, 10 )
                          :InitRandomizeRoute( 1, 1, 200 )
                          :InitRandomizeZones( ZoneTable )
                          :SpawnScheduled( 5, .5 )

For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.

This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed. This will enable a spawned group to be re-spawned after it lands, until it is destroyed... Note: When the group is respawned, it will re-spawn from the original airbase where it took off. So ensure that the routes for groups that respawn, always return to the original airbase, or players may get confused ...

Defined in:

Return value:

self

Usage:


  -- RU Su-34 - AI Ship Attack
  -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
  SpawnRU_SU34 = SPAWN:New( 'Su-34' )
                      :Schedule( 2, 3, 1800, 0.4 )
                      :SpawnUncontrolled()
                      :InitRandomizeRoute( 1, 1, 3000 )
                      :InitRepeatOnEngineShutDown()

Respawn after landing when its engines have shut down.

Defined in:

Return value:

self

Usage:


  -- RU Su-34 - AI Ship Attack
  -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
  SpawnRU_SU34 = SPAWN:New( 'Su-34' )
                      :SpawnUncontrolled()
                      :InitRandomizeRoute( 1, 1, 3000 )
                      :InitRepeatOnEngineShutDown()
                      :Spawn()

Respawn group after landing.

Defined in:

Return value:

self

Usage:


  -- RU Su-34 - AI Ship Attack
  -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
  SpawnRU_SU34 = SPAWN:New( 'Su-34' )
                      :InitRandomizeRoute( 1, 1, 3000 )
                      :InitRepeatOnLanding()
                      :Spawn()

[Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set.

Defined in:

Parameter:

#number Octal

The octal number (digits 1..7, max 4 digits, i.e. 1..7777) to set the SADL to. Every SADL needs to be unique!

Return value:

self

[Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set.

Defined in:

Parameter:

#number Octal

The octal number (digits 1..7, max 5 digits, i.e. 1..77777) to set the STN to. Every STN needs to be unique!

Return value:

self

Spawn the UNITs of this group with individual absolute positions and individual headings.

Defined in:

Parameter:

#table Positions

Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z absolute positions, and optionally an individual heading.

Return value:

Usage:


  -- NATO helicopter group of three units engaging in the battle field.
  local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitAbsolutePositions(Positions)

Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.

Defined in:

Parameter:

#table Positions

Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z relative positions, and optionally an individual heading.

Return value:

Usage:


  -- NATO helicopter group of three units engaging in the battle field.
  local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitRelativePositions(Positions)

Sets skill of the group.

Defined in:

Parameter:

#string Skill

Skill, possible values "Average", "Good", "High", "Excellent" or "Random".

Return value:

self

[Airplane] Set the initial speed on spawning in knots.

Useful when spawning in-air only.

Defined in:

Parameter:

#number Knots

The speed in knots to use.

Return value:

self

[Airplane] Set the initial speed on spawning in kilometers per hour.

Useful when spawning in-air only.

Defined in:

Parameter:

#number KPH

The speed in KPH to use.

Return value:

self

[Airplane] Set the initial speed on spawning in meters per second.

Useful when spawning in-air only.

Defined in:

Parameter:

#number MPS

The speed in MPS to use.

Return value:

self

(AIR) Will spawn a plane group in UnControlled or Controlled mode...

This will be similar to the uncontrolled flag setting in the ME. You can use UnControlled mode to simulate planes startup and ready for take-off but aren't moving (yet). ReSpawn the plane in Controlled mode, and the plane will move...

Defined in:

Parameter:

#boolean UnControlled

true if UnControlled, false if Controlled.

Return value:

self

Creates the main object to spawn a Wrapper.Group defined in the DCS ME.

Defined in:

Parameter:

#string SpawnTemplatePrefix

is the name of the Group in the ME that defines the Template. Each new group will have the name starting with SpawnTemplatePrefix.

Return value:

Usages:

  • -- NATO helicopters engaging in the battle field.
    Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' )
  • local Plane = SPAWN:New( "Plane" ) -- Creates a new local variable that can initiate new planes with the name "Plane#ddd" using the template "Plane" as defined within the ME.

Creates a new SPAWN instance to create new groups based on the provided template.

This will also register the template for future use.

Defined in:

Parameters:

#table SpawnTemplate

is the Template of the Group. This must be a valid Group Template structure - see Hoggit Wiki!

#string SpawnTemplatePrefix

[Mandatory] is the name of the template and the prefix of the GROUP on spawn. The name in the template will be overwritten!

#string SpawnAliasPrefix

[Optional] is the prefix that will be given to the GROUP on spawn.

#boolean NoMooseNamingPostfix

[Optional] If true, skip the Moose naming additions (like groupname#001-01) - but you need to ensure yourself no duplicate group names exist!

Return value:

self

Usage:

-- Spawn a P51 Mustang from scratch
local ttemp =  
  {
      ["modulation"] = 0,
      ["tasks"] = 
      {
      }, -- end of ["tasks"]
      ["task"] = "Reconnaissance",
      ["uncontrolled"] = false,
      ["route"] = 
      {
          ["points"] = 
          {
              [1] = 
              {
                  ["alt"] = 2000,
                  ["action"] = "Turning Point",
                  ["alt_type"] = "BARO",
                  ["speed"] = 125,
                  ["task"] = 
                  {
                      ["id"] = "ComboTask",
                      ["params"] = 
                      {
                          ["tasks"] = 
                          {
                          }, -- end of ["tasks"]
                      }, -- end of ["params"]
                  }, -- end of ["task"]
                  ["type"] = "Turning Point",
                  ["ETA"] = 0,
                  ["ETA_locked"] = true,
                  ["y"] = 666285.71428571,
                  ["x"] = -312000,
                  ["formation_template"] = "",
                  ["speed_locked"] = true,
              }, -- end of [1]
          }, -- end of ["points"]
      }, -- end of ["route"]
      ["groupId"] = 1,
      ["hidden"] = false,
      ["units"] = 
      {
          [1] = 
          {
              ["alt"] = 2000,
              ["alt_type"] = "BARO",
              ["livery_id"] = "USAF 364th FS",
              ["skill"] = "High",
              ["speed"] = 125,
              ["type"] = "TF-51D",
              ["unitId"] = 1,
              ["psi"] = 0,
              ["y"] = 666285.71428571,
              ["x"] = -312000,
              ["name"] = "P51-1-1",
              ["payload"] = 
              {
                  ["pylons"] = 
                  {
                  }, -- end of ["pylons"]
                  ["fuel"] = 340.68,
                  ["flare"] = 0,
                  ["chaff"] = 0,
                  ["gun"] = 100,
              }, -- end of ["payload"]
              ["heading"] = 0,
              ["callsign"] = 
              {
                  [1] = 1,
                  [2] = 1,
                  ["name"] = "Enfield11",
                  [3] = 1,
              }, -- end of ["callsign"]
              ["onboard_num"] = "010",
          }, -- end of [1]
      }, -- end of ["units"]
      ["y"] = 666285.71428571,
      ["x"] = -312000,
      ["name"] = "P51",
      ["communication"] = true,
      ["start_time"] = 0,
      ["frequency"] = 124,
  } 


local mustang = SPAWN:NewFromTemplate(ttemp,"P51D")
-- you MUST set the next three:
mustang:InitCountry(country.id.FRANCE)
mustang:InitCategory(Group.Category.AIRPLANE)
mustang:InitCoalition(coalition.side.BLUE)
mustang:OnSpawnGroup(
  function(grp)
    MESSAGE:New("Group Spawned: "..grp:GetName(),15,"SPAWN"):ToAll()
  end
)
mustang:Spawn()

Creates a new SPAWN instance to create new groups based on the defined template and using a new alias for each new group.

Defined in:

Parameters:

#string SpawnTemplatePrefix

is the name of the Group in the ME that defines the Template.

#string SpawnAliasPrefix

is the name that will be given to the Group at runtime.

Return value:

self

Usages:

  • -- NATO helicopters engaging in the battle field.
    Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
  • local PlaneWithAlias = SPAWN:NewWithAlias( "Plane", "Bomber" ) -- Creates a new local variable that can instantiate new planes with the name "Bomber#ddd" using the template "Plane" as defined within the ME.

Allows to place a CallFunction hook when a new group spawns.

The provided method will be called when a new group is spawned, including its given parameters. The first parameter of the SpawnFunction is the Wrapper.Group#GROUP that was spawned.

Defined in:

Parameters:

#function SpawnCallBackFunction

The function to be called when a group spawns.

SpawnFunctionArguments

A random amount of arguments to be provided to the function when the group spawns.

...

Return value:

Usage:


   -- Declare SpawnObject and call a function when a new Group is spawned.
   local SpawnObject = SPAWN:New( "SpawnObject" )
                            :InitLimit( 2, 10 )
                            :OnSpawnGroup( function( SpawnGroup )
                                SpawnGroup:E( "I am spawned" )
                                end
                              )
                            :SpawnScheduled( 300, 0.3 )

Will park a group at an Wrapper.Airbase.

Defined in:

Parameters:

The Wrapper.Airbase where to spawn the group.

(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.

#table Parkingdata

(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactily these spots!

SpawnIndex

Return value:

#nil:

Nothing is returned!

Will park a group at an Wrapper.Airbase.

This method is mostly advisable to be used if you want to simulate parking units at an airbase and be visible. Note that each point in the route assigned to the spawning group is reset to the point of the spawn.

All groups that are in the spawn collection and that are alive, and not in the air, are parked.

The Wrapper.Airbase#AIRBASE object must refer to a valid airbase known in the sim. You can use the following enumerations to search for the pre-defined airbases on the current known maps of DCS:

Use the method Wrapper.Airbase#AIRBASE.FindByName() to retrieve the airbase object. The known AIRBASE objects are automatically imported at mission start by MOOSE. Therefore, there isn't any New() constructor defined for AIRBASE objects.

Ships and FARPs are added within the mission, and are therefore not known. For these AIRBASE objects, there isn't an Wrapper.Airbase#AIRBASE enumeration defined. You need to provide the exact name of the airbase as the parameter to the Wrapper.Airbase#AIRBASE.FindByName() method!

Defined in:

Parameters:

The Wrapper.Airbase where to spawn the group.

(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.

#table Parkingdata

(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactily these spots!

Return value:

#nil:

Nothing is returned!

Usage:

  Spawn_Plane = SPAWN:New( "Plane" )
  Spawn_Plane:ParkAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ) )

  Spawn_Heli = SPAWN:New( "Heli")

  Spawn_Heli:ParkAtAirbase( AIRBASE:FindByName( "FARP Cold" ) )

  Spawn_Heli:ParkAtAirbase( AIRBASE:FindByName( "Carrier" ) )

  Spawn_Plane:ParkAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), AIRBASE.TerminalType.OpenBig )

Will re-spawn a group based on a given index.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

Parameter:

#string SpawnIndex

The index of the group to be spawned.

Return value:

The group that was spawned. You can use this group for further actions.

Set the spawn index to a specified index number.

This method can be used to "reset" the spawn counter to a specific index number. This will actually enable a respawn of groups from the specific index.

Defined in:

Parameter:

#string SpawnIndex

The index of the group from where the spawning will start again. The default value would be 0, which means a complete reset of the spawnindex.

Return value:

self

Will spawn a group based on the internal index.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

Return value:

The group that was spawned. You can use this group for further actions.

Will spawn a group at an Wrapper.Airbase.

This method is mostly advisable to be used if you want to simulate spawning units at an airbase. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

The Wrapper.Airbase#AIRBASE object must refer to a valid airbase known in the sim. You can use the following enumerations to search for the pre-defined airbases on the current known maps of DCS:

Use the method Wrapper.Airbase#AIRBASE.FindByName() to retrieve the airbase object. The known AIRBASE objects are automatically imported at mission start by MOOSE. Therefore, there isn't any New() constructor defined for AIRBASE objects.

Ships and FARPs are added within the mission, and are therefore not known. For these AIRBASE objects, there isn't an Wrapper.Airbase#AIRBASE enumeration defined. You need to provide the exact name of the airbase as the parameter to the Wrapper.Airbase#AIRBASE.FindByName() method!

Defined in:

Parameters:

The Wrapper.Airbase where to spawn the group.

#SPAWN.Takeoff Takeoff

(optional) The location and takeoff method. Default is Hot.

#number TakeoffAltitude

(optional) The altitude above the ground.

(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.

#boolean EmergencyAirSpawn

(optional) If true (default), groups are spawned in air if there is no parking spot at the airbase. If false, nothing is spawned if no parking spot is available.

#table Parkingdata

(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactly these spots!

Return value:

The group that was spawned or nil when nothing was spawned.

Usage:


  Spawn_Plane = SPAWN:New( "Plane" )
  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Cold )
  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Hot )
  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Runway )

  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( "Carrier" ), SPAWN.Takeoff.Cold )

  Spawn_Heli = SPAWN:New( "Heli")

  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Cold" ), SPAWN.Takeoff.Cold )
  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Hot" ), SPAWN.Takeoff.Hot )
  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Runway" ), SPAWN.Takeoff.Runway )
  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Air" ), SPAWN.Takeoff.Air )

  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "Carrier" ), SPAWN.Takeoff.Cold )

  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Cold, nil, AIRBASE.TerminalType.OpenBig )

Spawn a group on an Wrapper.Airbase at a specific parking spot.

Defined in:

Parameters:

The Wrapper.Airbase where to spawn the group.

#table Spots

Table of parking spot IDs. Note that these in general are different from the numbering in the mission editor!

#SPAWN.Takeoff Takeoff

(Optional) Takeoff type, i.e. either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is Hot.

Return value:

The group that was spawned or nil when nothing was spawned.

Will spawn a group from a Coordinate in 3D space.

This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

Parameters:

The Coordinate coordinates where to spawn the group.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Will spawn a group from a POINT_VEC2 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning groups on the ground from air units, like vehicles. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

Parameters:

The PointVec2 coordinates where to spawn the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnPointVec2 = ZONE:New( ZoneName ):GetPointVec2() 

  -- Spawn at the zone center position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2 )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2, 2000, 4000 )

Will spawn a group from a PointVec3 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

Parameters:

The PointVec3 coordinates where to spawn the group.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnPointVec3 = ZONE:New( ZoneName ):GetPointVec3( 2000 ) -- Get the center of the ZONE object at 2000 meters from the ground.

  -- Spawn at the zone center position at 2000 meters from the ground!
  SpawnAirplanes:SpawnFromPointVec3( SpawnPointVec3 )

Will spawn a group from a hosting static.

This method is mostly advisable to be used if you want to simulate spawning from buldings and structures (static buildings). You can use the returned group to further define the route to be followed.

Defined in:

Parameters:

The static dropping or unloading the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnStatic = STATIC:FindByName( StaticName )

  -- Spawn from the static position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromStatic( SpawnStatic )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromStatic( SpawnStatic, 2000, 4000 )

Will spawn a group from a hosting unit.

This method is mostly advisable to be used if you want to simulate spawning from air units, like helicopters, which are dropping infantry into a defined Landing Zone. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

Parameters:

The air or ground unit dropping or unloading the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return values:

that was spawned.

#nil:

Nothing was spawned.

Usage:


  local SpawnStatic = STATIC:FindByName( StaticName )

  -- Spawn from the static position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromUnit( SpawnStatic )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromUnit( SpawnStatic, 2000, 4000 )

Will spawn a group from a Vec2 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning groups on the ground from air units, like vehicles. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

Parameters:

DCS#Vec2 Vec2

The Vec2 coordinates where to spawn the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnVec2 = ZONE:New( ZoneName ):GetVec2()

  -- Spawn at the zone center position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromVec2( SpawnVec2 )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromVec2( SpawnVec2, 2000, 4000 )

Will spawn a group from a Vec3 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

Parameters:

DCS#Vec3 Vec3

The Vec3 coordinates where to spawn the group.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Will return the SpawnGroupName either with with a specific count number or without any count.

Defined in:

Parameter:

#number SpawnIndex

Is the number of the Group that is to be spawned.

Return value:

#string:

SpawnGroupName

Will spawn a Group within a given Core.Zone.

The Core.Zone can be of any type derived from Core.Zone#ZONE_BASE. Once the Wrapper.Group is spawned within the zone, the Wrapper.Group will continue on its route. The first waypoint (where the group is spawned) is replaced with the zone location coordinates.

Defined in:

Parameters:

The zone where the group is to be spawned.

#boolean RandomizeGroup

(optional) Randomization of the Wrapper.Group position in the zone.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnZone = ZONE:New( ZoneName )

  -- Spawn at the zone center position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnInZone( SpawnZone )

  -- Spawn in the zone at a random position at the height specified in the Me of the group template.
  SpawnAirplanes:SpawnInZone( SpawnZone, true )

  -- Spawn in the zone at a random position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnInZone( SpawnZone, true, 2000, 4000 )

  -- Spawn at the zone center position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnInZone( SpawnZone, false, 2000, 4000 )

  -- Spawn at the zone center position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnInZone( SpawnZone, nil, 2000, 4000 )

Will re-start the spawning scheduler.

Note: This method is only required to be called when the schedule was stopped.

Defined in:

Return value:

Will stop the scheduled spawning scheduler.

Defined in:

Return value:

Spawns new groups at varying time intervals.

This is useful if you want to have continuity within your missions of certain (AI) groups to be present (alive) within your missions.

Defined in:

Parameters:

#number SpawnTime

The time interval defined in seconds between each new spawn of new groups.

#number SpawnTimeVariation

The variation to be applied on the defined time interval between each new spawn. The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.

#boolean WithDelay

Do not spawn the first group immediately, but delay the spawn as per the calculation below. Effectively the same as #InitDelayOn().

Return value:

self

Usage:

-- NATO helicopters engaging in the battle field.
-- The time interval is set to SPAWN new helicopters between each 600 seconds, with a time variation of 50%.
-- The time variation in this case will be between 450 seconds and 750 seconds.
-- This is calculated as follows:
--      Low limit:   600 * ( 1 - 0.5 / 2 ) = 450
--      High limit:  600 * ( 1 + 0.5 / 2 ) = 750
-- Between these two values, a random amount of seconds will be chosen for each new spawn of the helicopters.
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):SpawnScheduled( 600, 0.5 )

Will spawn a group with a specified index number.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

Parameters:

#string SpawnIndex

The index of the group to be spawned.

NoBirth

Return value:

The group that was spawned. You can use this group for further actions.

Gets the CategoryID of the Group with the given SpawnPrefix

Defined in:

Parameter:

SpawnPrefix

Gets the CoalitionID of the Group with the given SpawnPrefix

Defined in:

Parameter:

SpawnPrefix

Gets the CountryID of the Group with the given SpawnPrefix

Defined in:

Parameter:

SpawnPrefix

Return the last maximum index that can be used.

Defined in:

Return the prefix of a SpawnUnit.

The method will search for a #-mark, and will return the text before the #-mark. It will return nil of no prefix was found.

Defined in:

Parameter:

Wrapper.Group#GROUP SpawnGroup

The GROUP object.

Return value:

#string:

The prefix or #nil if nothing was found.

Return the prefix of a spawned group.

The method will search for a #-mark, and will return the text before the #-mark. It will return nil of no prefix was found.

Defined in:

Parameter:

#string SpawnGroupName

The name of the spawned group.

Return value:

#string:

The prefix or #nil if nothing was found.

Get the next index of the groups to be spawned.

This method is complicated, as it is used at several spaces.

Defined in:

Parameter:

#number SpawnIndex

Spawn index.

Return value:

#number:

self.SpawnIndex

Gets the Group Template from the ME environment definition.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

Parameter:

#string SpawnTemplatePrefix

Return value:

@SPAWN self

Initalize the SpawnGroups collection.

Defined in:

Parameter:

SpawnIndex

@param #SPAWN self @param Core.Event#EVENTDATA EventData

Defined in:

Parameter:

EventData

@param #SPAWN self @param Core.Event#EVENTDATA EventData

Defined in:

Parameter:

EventData

Will detect AIR Units shutting down their engines ...

When the event takes place, and the method #InitRepeatOnEngineShutDown was called, the spawned Group will Re-SPAWN. But only when the Unit was registered to have landed.

Defined in:

Parameter:

Will detect AIR Units landing...

When the event takes place, the spawned Group is registered as landed. This is needed to ensure that Re-SPAWNing is only done for landed AIR Groups.

Defined in:

Parameter:

Will detect AIR Units taking off...

When the event takes place, the spawned Group is registered as airborne... This is needed to ensure that Re-SPAWNing only is done for landed AIR Groups.

Defined in:

Parameter:

Prepares the new Group Template.

Defined in:

Parameters:

#string SpawnTemplatePrefix

#number SpawnIndex

Return value:

self

Private method randomizing the routes.

Defined in:

Parameter:

#number SpawnIndex

The index of the group to be spawned.

Return value:

Private method that randomizes the template of the group.

Defined in:

Parameter:

#number SpawnIndex

Return value:

self

Private method that randomizes the Core.Zones where the Group will be spawned.

Defined in:

Parameter:

#number SpawnIndex

Return value:

self

This function is called automatically by the Spawning scheduler.

It is the internal worker method SPAWNing new Groups on the defined time intervals.

Defined in:

Private method that sets the DCS#Vec2 where the Group will be spawned.

Defined in:

Parameter:

#number SpawnIndex

Return value:

self

Schedules the CleanUp of Groups

Defined in:

Return value:

#boolean:

True = Continue Scheduler

Defined in:

Parameters:

SpawnIndex

SpawnRootX

SpawnRootY

SpawnX

SpawnY

SpawnAngle

Field(s)

#table RAT.ATC

RAT ATC.

#boolean RAT.ATCswitch

Enable/disable ATC if set to true/false.

#number RAT.AlphaDescent

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.

#string RAT.ClassName

Name of the Class.

#boolean RAT.Debug

Turn debug messages on or off.

#number RAT.FLcruise

Cruise altitude of aircraft. Default FL200 for planes and F005 for helos.

#number RAT.FLmaxuser

Maximum flight level set by user.

#number RAT.FLminuser

Minimum flight level set by user.

#number RAT.FLuser

Flight level set by users explicitly.

#table RAT.Menu

F10 menu items for this RAT object.

#string RAT.MenuF10

Main F10 menu.

#number RAT.Ndeparture_Airports

Number of departure airports set via SetDeparture().

#number RAT.Ndeparture_Zones

Number of departure zones set via SetDeparture.

#number RAT.Ndestination_Airports

Number of destination airports set via SetDestination().

#number RAT.Ndestination_Zones

Number of destination zones set via SetDestination().

#table RAT.ROE

RAT rules of engagement.

#table RAT.ROT

RAT reaction to threat.

#boolean RAT.SpawnUnControlled

This is used in the SPAWN:SpawnWithIndex() function. Some values are overwritten there!

#string RAT.SubMenuName

Submenu name for RAT object.

#number RAT.Tinactive

Time in seconds after which inactive units will be destroyed. Default is 300 seconds.

#number RAT.Vclimb

Default climb rate in ft/min.

#number RAT.Vcruisemax

Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.

#number RAT.activate_delay

Delay in seconds before first uncontrolled group is activated. Default is 5 seconds.

#number RAT.activate_delta

Time interval in seconds between activation of uncontrolled groups. Default is 5 seconds.

#number RAT.activate_frand

Randomization factor of time interval (activate_delta) between activating uncontrolled groups. Default is 0.

#number RAT.activate_max

Maximum number of uncontrolled aircraft, which will be activated at the same time. Default is 1.

#boolean RAT.activate_uncontrolled

If true, uncontrolled are activated randomly after certain time intervals.

#boolean RAT.addfriendlydepartures

Add all friendly airports to departures.

#boolean RAT.addfriendlydestinations

Add all friendly airports to destinations.

#table RAT.aircraft

Table which holds the basic aircraft properties (speed, range, ...).

#table RAT.airports

All airports of friedly coalitions.

#table RAT.airports_map

All airports available on current map (Caucasus, Nevada, Normandy, ...).

#string RAT.alias

Alias for spawned group.

#number RAT.alive

Number of groups which are alive.

#table RAT.cat
#string RAT.category

Category of aircarft: "plane" or "heli".

#boolean RAT.checkonrunway

Aircraft are checked if they were accidentally spawned on the runway. Default is true.

#boolean RAT.checkontop

Aircraft are checked if they were accidentally spawned on top of another unit. Default is true.

#table RAT.coal

RAT friendly coalitions.

#number RAT.coalition

Coalition of spawn group template.

#boolean RAT.commute

Aircraft commute between departure and destination, i.e. when respawned the departure airport becomes the new destiation.

#boolean RAT.continuejourney

Aircraft will continue their journey, i.e. get respawned at their destination with a new random destination.

#number RAT.country

Country of spawn group template.

#table RAT.ctable

Table with the valid coalitions from choice self.friendly.

Core.Zone#ZONE RAT.departure_Azone

Zone containing the departure airports.

#table RAT.departure_ports

Array containing the names of the destination airports or zones.

#boolean RAT.despawnair

If true, aircraft are despawned when they reach their destination zone. Default.

Core.Zone#ZONE RAT.destination_Azone

Zone containing the destination airports.

#table RAT.destination_ports

Array containing the names of the destination airports or zones.

#boolean RAT.destinationzone

Destination is a zone and not an airport.

#boolean RAT.eplrs

If true, turn on EPLSR datalink for the RAT group.

#table RAT.excluded_ports

Array containing the names of explicitly excluded airports.

#boolean RAT.f10menu

If true, add an F10 radiomenu for RAT. Default is false.

#number RAT.frequency

Radio frequency used by the RAT groups.

#string RAT.friendly

Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.

#number RAT.groupsize

Number of aircraft in group.

#string RAT.homebase

Home base for commute and return zone. Aircraft will always return to this base but otherwise travel in a star shaped way.

#string RAT.id

Some ID to identify who we are in output of the DCS.log file.

#boolean RAT.immortal

If true, aircraft are spawned as immortal.

#boolean RAT.invisible

If true aircraft are set to invisible for other AI forces.

#number RAT.landing

Landing type. Determines if we actually land at an airport or treat it as zone.

#string RAT.livery

Livery of the aircraft set by user.

#number RAT.markerid

Running number of placed markers on the F10 map.

#table RAT.markerids

Array with marker IDs.

#number RAT.maxdist

Max distance from departure to destination in meters. Default 5000 km.

#number RAT.mindist

Min distance from departure to destination in meters. Default 5 km.

#string RAT.modulation

Ratio modulation. Either "FM" or "AM".

#number RAT.ngroups

Number of groups to be spawned in total.

#boolean RAT.norespawn

Aircraft will not be respawned after they have finished their route.

#string RAT.onboardnum

Sets the onboard number prefix. Same as setting "TAIL #" in the mission editor.

#number RAT.onboardnum0

(Optional) Starting value of the automatically appended numbering of aircraft within a flight. Default is 1.

#number RAT.onrunwaymaxretry

Number of respawn retries (on ground) at other airports if a group gets accidentally spawned on the runway. Default is 3.

#number RAT.onrunwayradius

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.

#number RAT.ontopradius

Radius in meters until which a unit is considered to be on top of another. Default is 2 m.

#number RAT.parkingscanradius

Radius in meters until which parking spots are scanned for obstacles like other units, statics or scenery.

#boolean RAT.parkingscanscenery

If true, area around parking spots is scanned for scenery objects. Default is false.

#boolean RAT.parkingverysafe

If true, parking spots are considered as non-free until a possible aircraft has left and taken off. Default false.

#boolean RAT.placemarkers

Place markers of waypoints on F10 map.

#boolean RAT.radio

If true/false disables radio messages from the RAT groups.

#boolean RAT.random_departure

By default a random friendly airport is chosen as departure.

#boolean RAT.random_destination

By default a random friendly airport is chosen as destination.

#table RAT.ratcraft

Array with the spawned RAT aircraft.

#boolean RAT.reportstatus

Aircraft report status.

#boolean RAT.respawn_after_crash

Aircraft will be respawned after a crash, e.g. when they get shot down.

#boolean RAT.respawn_after_takeoff

Aircraft will be respawned directly after take-off.

#boolean RAT.respawn_at_landing

Respawn aircraft the moment they land rather than at engine shutdown.

#number RAT.respawn_delay

Delay in seconds until a repawn happens.

#boolean RAT.respawn_inair

Aircraft are allowed to spawned in air if they cannot be respawned on ground because there is not free parking spot. Default is true.

#table RAT.return_zones

Array containing the names of the return zones.

#boolean RAT.returnzone

Zone where aircraft will fly to before returning to their departure airport.

#string RAT.roe

ROE of spawned groups, default is weapon hold (this is a peaceful class for civil aircraft or ferry missions). Possible: "hold", "return", "free".

#string RAT.rot

ROT of spawned groups, default is no reaction. Possible: "noreaction", "passive", "evade".

#string RAT.skill

Skill of AI.

#number RAT.spawndelay

Delay time in seconds before first spawning happens.

#boolean RAT.spawninitialized

If RAT:Spawn() was already called this RAT object is set to true to prevent users to call it again.

#number RAT.spawninterval

Interval between spawning units/groups. Note that we add a randomization of 50%.

#boolean RAT.starshape

If true, aircraft travel A-->B-->A-->C-->A-->D... for commute.

#table RAT.status

RAT aircraft status.

#number RAT.statusinterval

Intervall between status checks (and reports if enabled).

#number RAT.takeoff

Takeoff type. 0=coldorhot.

Wrapper.Group#GROUP RAT.templategroup

Group serving as template for the RAT aircraft.

Wrapper.Airbase#AIRBASE.TerminalType RAT.termtype

Type of terminal to be used when spawning at an airbase.

#boolean RAT.uncontrolled

If true aircraft are spawned in uncontrolled state and will only sit on their parking spots. They can later be activated.

#table RAT.unit

RAT unit conversions.

#table RAT.version

RAT version.

#table RAT.waypointdescriptions

Table with strings for waypoint descriptions of markers.

#table RAT.waypointstatus

Table with strings of waypoint status.

#table RAT.wp

RAT waypoint type.

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_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

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.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

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.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

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()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

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:

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.

Defined in:

Parameter:

Arguments

A #table or any field.

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

Defined in:

Return value:

#boolean:

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

Defined in:

Return value:

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.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

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.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

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.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

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.

Defined in:

Parameter:

DCS#Event event

  • RATMANAGER class

Field(s)

#string RATMANAGER.ClassName

Name of the Class.

#boolean RATMANAGER.Debug

If true, be more verbose on output in DCS.log file.

#number RATMANAGER.Tcheck

Time interval in seconds between checking of alive groups.

#table RATMANAGER.alive

Number of currently alive groups.

#number RATMANAGER.dTspawn

Time interval in seconds between spawns of groups.

#string RATMANAGER.id

Some ID to identify who we are in output of the DCS.log file.

Core.Scheduler#SCHEDULER RATMANAGER.manager

Scheduler managing the RAT objects.

#number RATMANAGER.managerid

Managing scheduler id.

#table RATMANAGER.min

Minimum number of RAT groups alive.

#string RATMANAGER.name

Name (alias) of RAT object.

#number RATMANAGER.nrat

Number of RAT objects.

#number RATMANAGER.ntot

Total number of active RAT groups.

#table RATMANAGER.rat

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.

Counts the number of alive RAT objects.

Defined in:

RATMANAGER

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.

Defined in:

RATMANAGER

Parameters:

#RATMANAGER RATMANAGER

self object.

#number i

Index.

Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.

Defined in:

RATMANAGER

Return value:

RATMANAGER self object.

Instantly stops the RAT manager by terminating its scheduler.

Defined in:

RATMANAGER

Return value:

RATMANAGER self object.

Field(s)

#string RATMANAGER.ClassName

Name of the Class.

#boolean RATMANAGER.Debug

If true, be more verbose on output in DCS.log file.

#number RATMANAGER.Tcheck

Time interval in seconds between checking of alive groups.

#table RATMANAGER.alive

Number of currently alive groups.

#number RATMANAGER.dTspawn

Time interval in seconds between spawns of groups.

#string RATMANAGER.id

Some ID to identify who we are in output of the DCS.log file.

Core.Scheduler#SCHEDULER RATMANAGER.manager

Scheduler managing the RAT objects.

#number RATMANAGER.managerid

Managing scheduler id.

#table RATMANAGER.min

Minimum number of RAT groups alive.

#string RATMANAGER.name

Name (alias) of RAT object.

#number RATMANAGER.nrat

Number of RAT objects.

#number RATMANAGER.ntot

Total number of active RAT groups.

#table RATMANAGER.rat

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_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

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.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

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.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

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()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

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:

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.

Defined in:

Parameter:

Arguments

A #table or any field.

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

Defined in:

Return value:

#boolean:

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

Defined in:

Return value:

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.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

The EventData structure.

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.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

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.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

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.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

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.

Defined in:

Parameter:

DCS#Event event