Module AI_RAT
+
+-
+
- Functional -- Create random airtraffic in your missions. +
+
+ +
The documentation of the SPAWN class can be found further in this document.
+ ++ +
Global(s)
+| RAT | +
+ RAT class + |
+
| myid | +
+ Some ID to identify where we are +string myid+ |
+
Type RAT
+ | RAT.AlphaDescent | ++ + | +
| RAT.ClassName | ++ + | +
| RAT:Commute(switch) | +
+ Aircraft will commute between their departure and destination airports. + |
+
| RAT:ContinueJourney(switch) | +
+ Aircraft will continue their journey from their destination. + |
+
| RAT.FLmaxuser | ++ + | +
| RAT.FLminuser | ++ + | +
| RAT.FLuser | ++ + | +
| RAT.Menu | ++ + | +
| RAT.MenuF10 | +
+ Main F10 menu. + |
+
| RAT:New(groupname) | +
+ Create a new RAT object. + |
+
| RAT:PlaceMarkers(switch) | +
+ Place markers of waypoints on the F10 map. + |
+
| RAT.RAT | ++ + | +
| RAT.ROE | +
+ RAT rules of engagement. + |
+
| RAT.ROT | +
+ RAT reaction to threat. + |
+
| RAT:RespawnAfterLanding(delay) | +
+ Make aircraft respawn the moment they land rather than at engine shut down. + |
+
| RAT:SetClimbRate(rate) | +
+ Set the climb rate. + |
+
| RAT:SetCoalition(friendly) | +
+ Set the friendly coalitions from which the airports can be used as departure or destination. + |
+
| RAT:SetDeparture(names) | +
+ Set possible departure ports. + |
+
| RAT:SetDescentAngle(angle) | +
+ Set the angle of descent. + |
+
| RAT:SetDestination(names) | +
+ Set name of destination airport for the AI aircraft. + |
+
| RAT:SetFL(height) | +
+ Set flight level. + |
+
| RAT:SetFLcruise(height) | +
+ Set flight level of cruising part. + |
+
| RAT:SetFLmax(height) | +
+ Set max flight level. + |
+
| RAT:SetFLmin(height) | +
+ Set min flight level. + |
+
| RAT:SetMaxCruiseSpeed(speed) | +
+ Set the maximum cruise speed of the aircraft. + |
+
| RAT:SetMaxDistance(dist) | +
+ Set maximum distance between departure and destination. + |
+
| RAT:SetMinDistance(dist) | +
+ Set minimum distance between departure and destination. + |
+
| RAT:SetROE(roe) | +
+ Set rules of engagement (ROE). + |
+
| RAT:SetROT(rot) | +
+ Set reaction to threat (ROT). + |
+
| 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:Spawn(naircraft) | +
+ Triggers the spawning of AI aircraft. + |
+
| RAT:Status(message, forID) | +
+ Report status of RAT groups. + |
+
| RAT:StatusReports(switch) | +
+ Aircraft report status messages. + |
+
| RAT.SubMenuName | ++ + | +
| RAT.Vclimb | ++ + | +
| RAT.Vcruisemax | ++ + | +
| RAT:_AirportExists(name) | +
+ Test if an airport exists on the current map. + |
+
| RAT:_Course(a, b) | +
+ Determine the heading from point a to point b. + |
+
| RAT:_Debug(switch) | +
+ Turn debug messages on or off. + |
+
| RAT:_DeleteMarkers(ids) | +
+ Delete all markers on F10 map. + |
+
| RAT:_Despawn(group) | +
+ Despawn unit. + |
+
| RAT:_EngineStartup(EventData) | +
+ Function is executed when a unit starts its engines. + |
+
| RAT:_FLmax(alpha, beta, d, phi, h0) | +
+ Calculate the max flight level for a given distance and fixed climb and descent rates. + |
+
| RAT:_GetAirportsOfCoalition() | +
+ Get all "friendly" airports of the current map. + |
+
| RAT:_GetAirportsOfMap() | +
+ Get all airports of the current map. + |
+
| RAT:_GetDestinations(q, minrange, maxrange) | +
+ Get all possible destination airports depending on departure position. + |
+
| RAT:_GetLife(group) | +
+ Get (relative) life of first unit of a group. + |
+
| RAT:_InitAircraft(DCSgroup) | +
+ Initialize basic parameters of the aircraft based on its (template) group in the mission editor. + |
+
| RAT:_ModifySpawnTemplate(waypoints) | +
+ Modifies the template of the group to be spawned. + |
+
| 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:_OnEngineShutdown(EventData) | +
+ Function is executed when a unit shuts down its engines. + |
+
| 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(destinations, _random) | +
+ Set the destination airport of the AI. + |
+
| RAT:_PlaceMarkers(waypoints) | +
+ Place markers of the waypoints. + |
+
| RAT:_Randomize(value, fac, lower, upper) | +
+ Randomize a value by a certain amount. + |
+
| RAT:_Respawn(group) | +
+ 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) | +
+ 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, _departure, _destination, takeoff) | +
+ Set the route of the AI plane. + |
+
| RAT:_SetStatus(group, status) | +
+ Set status of group. + |
+
| RAT:_SpawnWithRoute(_departure, _destination) | +
+ Spawn the AI aircraft with a route. + |
+
| RAT:_TaskHolding(P1, Altitude, Speed, Duration) | +
+ Orbit at a specified position at a specified alititude with a specified speed. + |
+
| RAT:_Waypoint(Type, Coord, Speed, Altitude, Airport) | +
+ Create a waypoint that can be used with the Route command. + |
+
| RAT.aircraft | ++ + | +
| RAT.airports | ++ + | +
| RAT.airports_map | ++ + | +
| RAT.alive | ++ + | +
| RAT.cat | +
+ RAT categories. + |
+
| RAT.category | ++ + | +
| RAT.coal | +
+ RAT friendly coalitions. + |
+
| RAT.coalition | ++ + | +
| RAT.commute | ++ + | +
| RAT.continuejourney | ++ + | +
| RAT.ctable | ++ + | +
| RAT.debug | ++ + | +
| RAT.departure_ports | ++ + | +
| RAT.departure_zones | ++ + | +
| RAT.destination_ports | ++ + | +
| RAT.f10menu | ++ + | +
| RAT.friendly | ++ + | +
| RAT.markerid | +
+ Running number of placed markers on the F10 map. + |
+
| RAT.markerids | ++ + | +
| RAT.maxdist | ++ + | +
| RAT.mindist | ++ + | +
| RAT.placemarkers | ++ + | +
| RAT.random_departure | ++ + | +
| RAT.random_destination | ++ + | +
| RAT.ratcraft | ++ + | +
| RAT.reportstatus | ++ + | +
| RAT.respawn_after_landing | ++ + | +
| RAT.respawn_delay | ++ + | +
| RAT.roe | ++ + | +
| RAT.rot | ++ + | +
| RAT.spawndelay | ++ + | +
| RAT.spawninterval | ++ + | +
| RAT.statusinterval | ++ + | +
| RAT.takeoff | ++ + | +
| RAT.unit | +
+ RAT unit conversions. + |
+
| RAT.wp | +
+ RAT waypoint type. + |
+
Global(s)
+ +-
+
- + + #string + +myid + + +
-
+
+
Some ID to identify where we are
+string myid
+ +
+
Type AI_RAT
+
+ Type RAT
+
+RAT class
+ +Field(s)
+-
+
- + + #number + +RAT.AlphaDescent + + +
- + + + + +
-
+
- + + #string + +RAT.ClassName + + +
- + + + + +
-
+
- + + +RAT:Commute(switch) + + +
-
+
+
Aircraft will commute between their departure and destination airports.
+ + +Note, this option is not available if aircraft are spawned in air since they don't have a valid departure airport to fly back to.
+ +Parameter
+-
+
-
+
+
+ +#boolean switch: +Turn commute on=true or off=false. If no value is given switch=true.
+
+ -
+
+
-
+
- + + +RAT:ContinueJourney(switch) + + +
-
+
+
Aircraft will continue their journey from their destination.
+ + +This means they are respawned at their destination and get a new random destination.
+ +Parameter
+-
+
-
+
+
+ +#boolean switch: +Turn journey on=true or off=false. If no value is given switch=true.
+
+ -
+
+
-
+
- + + #number + +RAT.FLmaxuser + + +
- + + + + +
-
+
- + + #number + +RAT.FLminuser + + +
- + + + + +
-
+
- + + #number + +RAT.FLuser + + +
- + + + + +
-
+
- + + #table + +RAT.Menu + + +
- + + + + +
-
+
- + + #RAT + +RAT.MenuF10 + + +
-
+
+
Main F10 menu.
+ +
+
-
+
- + + +RAT:New(groupname) + + +
-
+
+
Create a new RAT object.
+ +Parameter
+-
+
-
+
+
+ +#string groupname: +Name of the group as defined in the mission editor. This group is serving as a template for all spawned units.
+
Return values
+-
+
-
+
+
#RAT: +Object of RAT class.
+ +
+ -
+
+
#nil: +If the group does not exist in the mission editor.
+ +
+
Usage:
+
+ +yak:RAT("RAT_YAK") will create a RAT object called "yak". The template group in the mission editor must have the name "RAT_YAK".
+ -
+
+
-
+
- + + +RAT:PlaceMarkers(switch) + + +
-
+
+
Place markers of waypoints on the F10 map.
+ + +Default is off.
+ +Parameter
+-
+
-
+
+
+ +#boolean switch: +true=yes, false=no.
+
+ -
+
+
-
+
- + + #table + +RAT.RAT + + +
- + + + + +
-
+
- + + #RAT + +RAT.ROE + + +
-
+
+
RAT rules of engagement.
+ +
+
-
+
- + + #RAT + +RAT.ROT + + +
-
+
+
RAT reaction to threat.
+ +
+
-
+
- + + +RAT:RespawnAfterLanding(delay) + + +
-
+
+
Make aircraft respawn the moment they land rather than at engine shut down.
+ +Parameter
+-
+
-
+
+
+ +#number delay: +(Optional) Delay in seconds until respawn happens after landing. Default is 180 seconds.
+
+ -
+
+
-
+
- + + +RAT:SetClimbRate(rate) + + +
-
+
+
Set the climb rate.
+ + +Default is 1500 ft/min. This automatically sets the climb angle.
+ +Parameter
+-
+
-
+
+
+ +#number rate: +Climb rate in ft/min.
+
+ -
+
+
-
+
- + + +RAT:SetCoalition(friendly) + + +
-
+
+
Set the friendly coalitions from which the airports can be used as departure or destination.
+ +Parameter
+-
+
-
+
+
+ +#string friendly: +"same"=own coalition+neutral (default), "all"=neutral+red+blue", "sameonly"=own coalition only, "blue"=blue+neutral, "blueonly"=blue, "red"=red+neutral, "redonly"=red, "neutral"=neutral. +Default is "same", so aircraft will use airports of the coalition their spawn template has plus all neutral airports.
+
Usages:
+-
+
yak:SetCoalition("all") will spawn aircraft randomly on airports of any coaliton, i.e. red, blue and neutral, regardless of its own coalition.
+ yak:SetCoalition("redonly") will spawn aircraft randomly on airports belonging to the red coalition _only_.
+
+ -
+
+
-
+
- + + +RAT:SetDeparture(names) + + +
-
+
+
Set possible departure ports.
+ + +This can be an airport or a zone defined in the mission editor.
+ +Parameter
+-
+
-
+
+
+ +#string names: +Name or table of names of departure airports or zones.
+
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, which has to be defined in the mission editor, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
+
+ -
+
+
-
+
- + + +RAT:SetDescentAngle(angle) + + +
-
+
+
Set the angle of descent.
+ + +Default is 3.6 degrees, which corresponds to 3000 ft descent after one mile of travel.
+ +Parameter
+-
+
-
+
+
+ +#number angle: +Angle of descent in degrees.
+
+ -
+
+
-
+
- + + +RAT:SetDestination(names) + + +
-
+
+
Set name of destination airport for the AI aircraft.
+ + +If no name is given an airport from the friendly coalition(s) is chosen randomly.
+ +Parameter
+-
+
-
+
+
+ +#string names: +Name of the destination airport or table of destination airports.
+
Usage:
+
+ +RAT:SetDestination("Krymsk") makes all aircraft of this RAT oject fly to Krymsk airport.
+ -
+
+
-
+
- + + +RAT:SetFL(height) + + +
-
+
+
Set flight level.
+ + +Setting this value will overrule all other logic. Aircraft will try to fly at this height regardless.
+ +Parameter
+-
+
-
+
+
+ +#number height: +FL in hundrets of feet. E.g. FL200 = 20000 ft ASL.
+
+ -
+
+
-
+
- + + +RAT:SetFLcruise(height) + + +
-
+
+
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.
+ +Parameter
+-
+
-
+
+
+ +#number height: +FL in hundrets of feet. E.g. FL200 = 20000 ft ASL.
+
+ -
+
+
-
+
- + + +RAT:SetFLmax(height) + + +
-
+
+
Set max flight level.
+ + +Setting this value will overrule all other logic. Aircraft will try to fly at less than this FL regardless.
+ +Parameter
+-
+
-
+
+
+ +#number height: +Maximum FL in hundrets of feet.
+
+ -
+
+
-
+
- + + +RAT:SetFLmin(height) + + +
-
+
+
Set min flight level.
+ + +Setting this value will overrule all other logic. Aircraft will try to fly at higher than this FL regardless.
+ +Parameter
+-
+
-
+
+
+ +#number height: +Maximum FL in hundrets of feet.
+
+ -
+
+
-
+
- + + +RAT:SetMaxCruiseSpeed(speed) + + +
-
+
+
Set the maximum cruise speed of the aircraft.
+ +Parameter
+-
+
-
+
+
+ +#number speed: +Speed in km/h.
+
+ -
+
+
-
+
- + + +RAT:SetMaxDistance(dist) + + +
-
+
+
Set maximum distance between departure and destination.
+ + +Default is 5000 km but aircarft range is also taken into account automatically.
+ +Parameter
+-
+
-
+
+
+ +#number dist: +Distance in km.
+
+ -
+
+
-
+
- + + +RAT:SetMinDistance(dist) + + +
-
+
+
Set minimum distance between departure and destination.
+ + +Default is 5 km. +Minimum distance should not be smaller than ~500(?) meters to ensure that departure and destination are different.
+ +Parameter
+-
+
-
+
+
+ +#number dist: +Distance in km.
+
+ -
+
+
-
+
- + + +RAT:SetROE(roe) + + +
-
+
+
Set rules of engagement (ROE).
+ + +Default is weapon hold. This is a peaceful class.
+ +Parameter
+-
+
-
+
+
+ +#string roe: +"hold" = weapon hold, "return" = return fire, "free" = weapons free.
+
+ -
+
+
-
+
- + + +RAT:SetROT(rot) + + +
-
+
+
Set reaction to threat (ROT).
+ + +Default is no reaction, i.e. aircraft will simply ignore all enemies.
+ +Parameter
+-
+
-
+
+
+ +#string rot: +"noreaction = no reactino, "passive" = passive defence, "evade" = weapons free.
+
+ -
+
+
-
+
- + + +RAT:SetSpawnDelay(delay) + + +
-
+
+
Set the delay before first group is spawned.
+ + +Minimum delay is 0.5 seconds.
+ +Parameter
+-
+
-
+
+
+ +#number delay: +Delay in seconds.
+
+ -
+
+
-
+
- + + +RAT:SetSpawnInterval(interval) + + +
-
+
+
Set the interval between spawnings of the template group.
+ + +Minimum interval is 0.5 seconds.
+ +Parameter
+-
+
-
+
+
+ +#number interval: +Interval in seconds.
+
+ -
+
+
-
+
- + + +RAT:SetTakeoff(type) + + +
-
+
+
Set takeoff type.
+ + +Starting cold at airport, starting hot at airport, starting at runway, starting in the air. +Default is "takeoff-hot" for a start at airport with engines already running.
+ +Parameter
+-
+
-
+
+
+ +#string type: +Type can be "takeoff-cold" or "cold", "takeoff-hot" or "hot", "takeoff-runway" or "runway", "air".
+
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.
+
+ -
+
+
-
+
- + + +RAT:Spawn(naircraft) + + +
-
+
+
Triggers the spawning of AI aircraft.
+ + +Note that all additional options should be set before giving the spawn command.
+ +Parameter
+-
+
-
+
+
+ +#number naircraft: +(Optional) Number of aircraft to spawn. Default is one aircraft.
+
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 coaliton.
+ -
+
+
-
+
- + + +RAT:Status(message, forID) + + +
-
+
+
Report status of RAT groups.
+ +Parameters
+-
+
-
+
+
+ +#boolean message: +(Optional) Send message if true.
+ -
+
+
+ +#number forID: +(Optional) Send message only for this ID.
+
+ -
+
+
-
+
- + + +RAT:StatusReports(switch) + + +
-
+
+
Aircraft report status messages.
+ + +Default is off.
+ +Parameter
+-
+
-
+
+
+ +#boolean switch: +true=on, false=off.
+
+ -
+
+
-
+
- + + #string + +RAT.SubMenuName + + +
- + + + + +
-
+
- + + #number + +RAT.Vclimb + + +
- + + + + +
-
+
- + + #number + +RAT.Vcruisemax + + +
- + + + + +
-
+
- + + +RAT:_AirportExists(name) + + +
-
+
+
Test if an airport exists on the current map.
+ +Parameter
+-
+
-
+
+
+ +#string name:
+
Return value
+ +#boolean: +True if airport exsits, false otherwise.
+ +
+ -
+
+
-
+
- + + +RAT:_Course(a, b) + + +
-
+
+
Determine the heading from point a to point b.
+ +Parameters
+-
+
-
+
+
+ +Core.Point#COORDINATE a: +Point from.
+ -
+
+
+ +Core.Point#COORDINATE b: +Point to.
+
Return value
+ +#number: +Heading/angle in degrees.
+ +
+ -
+
+
-
+
- + + +RAT:_Debug(switch) + + +
-
+
+
Turn debug messages on or off.
+ + +Default is off.
+ +Parameter
+-
+
-
+
+
+ +#boolean switch: +true turn messages on, false=off.
+
+ -
+
+
-
+
- + + +RAT:_DeleteMarkers(ids) + + +
-
+
+
Delete all markers on F10 map.
+ +Parameter
+-
+
-
+
+
+ +#table ids: +(Optional) Table holding the marker IDs to be deleted.
+
+ -
+
+
-
+
- + + +RAT:_Despawn(group) + + +
-
+
+
Despawn unit.
+ + +Unit gets destoyed and group is set to nil. +Index of ratcraft array is taken from spawned group name.
+ +Parameter
+-
+
-
+
+
+ +Wrapper.Group#GROUP group: +Group to be despawned.
+
+ -
+
+
-
+
- + + +RAT:_EngineStartup(EventData) + + +
-
+
+
Function is executed when a unit starts its engines.
+ +Parameter
+-
+
-
+
+
+ +EventData:
+
+ -
+
+
-
+
- + + +RAT:_FLmax(alpha, beta, d, phi, h0) + + +
-
+
+
Calculate the max flight level for a given distance and fixed climb and descent rates.
+ + +In other words we have a distance between two airports and want to know how high we +can climb before we must descent again to arrive at the destination without any level/cruising part.
+ +Parameters
+-
+
-
+
+
+ +#number alpha: +Angle of climb [rad].
+ -
+
+
+ +#number beta: +Angle of descent [rad].
+ -
+
+
+ +#number d: +Distance between the two airports [m].
+ -
+
+
+ +#number phi: +Angle between departure and destination [rad].
+ -
+
+
+ +#number h0: +Height [m] of departure airport. Note we implicitly assume that the height difference between departure and destination is negligible.
+
Return value
+ +#number: + Maximal flight level in meters.
+ +
+ -
+
+
-
+
- + + +RAT:_GetAirportsOfCoalition() + + +
-
+
+
Get all "friendly" airports of the current map.
+ +
+
-
+
- + + +RAT:_GetAirportsOfMap() + + +
-
+
+
Get all airports of the current map.
+ +
+
-
+
- + + +RAT:_GetDestinations(q, minrange, maxrange) + + +
-
+
+
Get all possible destination airports depending on departure position.
+ + +The list is sorted w.r.t. distance to departure position.
+ +Parameters
+-
+
-
+
+
+ +Core.Point#COORDINATE q: +Coordinate of the departure point.
+ -
+
+
+ +#number minrange: +Minimum range to q in meters.
+ -
+
+
+ +#number maxrange: +Maximum range to q in meters.
+
Return values
+-
+
-
+
+
#table: +Table with possible destination airports.
+ +
+ -
+
+
#nil: +If no airports could be found.
+ +
+
+ -
+
+
-
+
- + + +RAT:_GetLife(group) + + +
-
+
+
Get (relative) life of first unit of a group.
+ +Parameter
+-
+
-
+
+
+ +Wrapper.Group#GROUP group: +Group of unit.
+
Return value
+ +#number: +Life of unit in percent.
+ +
+ -
+
+
-
+
- + + +RAT:_InitAircraft(DCSgroup) + + +
-
+
+
Initialize basic parameters of the aircraft based on its (template) group in the mission editor.
+ +Parameter
+-
+
-
+
+
+ +Dcs.DCSWrapper.Group#Group DCSgroup: +Group of the aircraft in the mission editor.
+
+ -
+
+
-
+
- + + +RAT:_ModifySpawnTemplate(waypoints) + + +
-
+
+
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".
+ +Parameter
+-
+
-
+
+
+ +#table waypoints: +The waypoints of the AI flight plan.
+
+ -
+
+
-
+
- + + +RAT:_OnBirth(EventData) + + +
-
+
+
Function is executed when a unit is spawned.
+ +Parameter
+-
+
-
+
+
+ +EventData:
+
+ -
+
+
-
+
- + + +RAT:_OnCrash(EventData) + + +
-
+
+
Function is executed when a unit crashes.
+ +Parameter
+-
+
-
+
+
+ +EventData:
+
+ -
+
+
-
+
- + + +RAT:_OnDead(EventData) + + +
-
+
+
Function is executed when a unit is dead.
+ +Parameter
+-
+
-
+
+
+ +EventData:
+
+ -
+
+
-
+
- + + +RAT:_OnEngineShutdown(EventData) + + +
-
+
+
Function is executed when a unit shuts down its engines.
+ +Parameter
+-
+
-
+
+
+ +EventData:
+
+ -
+
+
-
+
- + + +RAT:_OnLand(EventData) + + +
-
+
+
Function is executed when a unit lands.
+ +Parameter
+-
+
-
+
+
+ +EventData:
+
+ -
+
+
-
+
- + + +RAT:_OnTakeoff(EventData) + + +
-
+
+
Function is executed when a unit takes off.
+ +Parameter
+-
+
-
+
+
+ +EventData:
+
+ -
+
+
-
+
- + + +RAT:_PickDeparture(takeoff) + + +
-
+
+
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.
+ +Parameter
+-
+
-
+
+
+ +#number takeoff: +Takeoff type.
+
Return values
+-
+
-
+
+
Wrapper.Airbase#AIRBASE: +Departure airport if spawning at airport.
+ +
+ -
+
+
Coore.Zone#ZONE: +Departure zone if spawning in air.
+ +
+
+ -
+
+
-
+
- + + +RAT:_PickDestination(destinations, _random) + + +
-
+
+
Set the destination airport of the AI.
+ + +If no airport name is given an airport from the coalition is chosen randomly.
+ +Parameters
+-
+
-
+
+
+ +#table destinations: +Table with destination airports.
+ -
+
+
+ +#boolean _random: +Optional switch to activate a random selection of airports.
+
Return value
+ +Wrapper.Airbase#AIRBASE: +Destination airport.
+ +
+ -
+
+
-
+
- + + +RAT:_PlaceMarkers(waypoints) + + +
-
+
+
Place markers of the waypoints.
+ + +Note we assume a very specific number and type of waypoints here.
+ +Parameter
+-
+
-
+
+
+ +#table waypoints: +Table with waypoints.
+
+ -
+
+
-
+
- + + +RAT:_Randomize(value, fac, lower, upper) + + +
-
+
+
Randomize a value by a certain amount.
+ +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.
+
+ -
+
+
-
+
- + + +RAT:_Respawn(group) + + +
-
+
+
Respawn a group.
+ +Parameter
+-
+
-
+
+
+ +Wrapper.Group#GROUP group: +Group to be repawned.
+
+ -
+
+
-
+
- + + +RAT:_Routeinfo(waypoints, comment) + + +
-
+
+
Provide information about the assigned flightplan.
+ +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.
+ +
+ -
+
+
-
+
- + + +RAT:_SetCoalitionTable() + + +
-
+
+
Create a table with the valid coalitions for departure and destination airports.
+ +
+
-
+
- + + +RAT:_SetMarker(text, wp) + + +
-
+
+
Set a marker visible for all on the F10 map.
+ +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.
+
+ -
+
+
-
+
- + + +RAT:_SetROE(group, roe) + + +
-
+
+
Set ROE for a group.
+ +Parameters
+-
+
-
+
+
+ +Wrapper.Group#GROUP group: +Group for which the ROE is set.
+ -
+
+
+ +#string roe: +ROE of group.
+
+ -
+
+
-
+
- + + +RAT:_SetROT(group, rot) + + +
-
+
+
Set ROT for a group.
+ +Parameters
+-
+
-
+
+
+ +Wrapper.Group#GROUP group: +Group for which the ROT is set.
+ -
+
+
+ +#string rot: +ROT of group.
+
+ -
+
+
-
+
- + + +RAT:_SetRoute(Takeoff, _departure, _destination, takeoff) + + +
-
+
+
Set the route of the AI plane.
+ + +Due to DCS landing bug, this has to be done before the unit is spawned.
+ +Parameters
+-
+
-
+
+
+ +takeoff#RAT.wp Takeoff: +type.
+ -
+
+
+ +Wrapper.Airport#AIRBASE _departure: +(Optional) Departure airbase.
+ -
+
+
+ +Wrapper.Airport#AIRBASE _destination: +(Optional) Destination airbase.
+ -
+
+
+ +takeoff:
+
Return values
+-
+
-
+
+
Wrapper.Airport#AIRBASE: +Departure airbase.
+ +
+ -
+
+
Wrapper.Airport#AIRBASE: +Destination airbase.
+ +
+ -
+
+
#table: +Table of flight plan waypoints.
+ +
+
+ -
+
+
-
+
- + + +RAT:_SetStatus(group, status) + + +
-
+
+
Set status of group.
+ +Parameters
+-
+
-
+
+
+ +group:
+ -
+
+
+ +status:
+
+ -
+
+
-
+
- + + +RAT:_SpawnWithRoute(_departure, _destination) + + +
-
+
+
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.
+ +Parameters
+-
+
-
+
+
+ +#string _departure: +(Optional) Name of departure airbase.
+ -
+
+
+ +#string _destination: +(Optional) Name of destination airbase.
+
+ -
+
+
-
+
- + + +RAT:_TaskHolding(P1, Altitude, Speed, Duration) + + +
-
+
+
Orbit at a specified position at a specified alititude with a specified speed.
+ +Parameters
+-
+
-
+
+
+ +Dcs.DCSTypes#Vec2 P1: +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
+ +Dcs.DCSTasking.Task#Task: +DCSTask
+ +
+ -
+
+
-
+
- + + +RAT:_Waypoint(Type, Coord, Speed, Altitude, Airport) + + +
-
+
+
Create a waypoint that can be used with the Route command.
+ +Parameters
+-
+
-
+
+
+ +#number Type: +Type of waypoint.
+ -
+
+
+ +Core.Point#COORDINATE Coord: +3D coordinate of the waypoint.
+ -
+
+
+ +#number Speed: +Speed in m/s.
+ -
+
+
+ +#number Altitude: +Altitude in m.
+ -
+
+
+ +Wrapper.Airbase#AIRBASE Airport: +Airport of object to spawn.
+
Return value
+ +#table: +Waypoints for DCS task route or spawn template.
+ +
+ -
+
+
-
+
- + + #table + +RAT.aircraft + + +
- + + + + +
-
+
- + + #table + +RAT.airports + + +
- + + + + +
-
+
- + + #table + +RAT.airports_map + + +
- + + + + +
-
+
- + + #number + +RAT.alive + + +
- + + + + +
-
+
- + + #RAT + +RAT.cat + + +
-
+
+
RAT categories.
+ +
+
-
+
- + + #string + +RAT.category + + +
- + + + + +
-
+
- + + #RAT + +RAT.coal + + +
-
+
+
RAT friendly coalitions.
+ +
+
-
+
- + + #number + +RAT.coalition + + +
- + + + + +
-
+
- + + #boolean + +RAT.commute + + +
- + + + + +
-
+
- + + #boolean + +RAT.continuejourney + + +
- + + + + +
-
+
- + + #table + +RAT.ctable + + +
- + + + + +
-
+
- + + #boolean + +RAT.debug + + +
- + + + + +
-
+
- + + #table + +RAT.departure_ports + + +
- + + + + +
-
+
- + + #table + +RAT.departure_zones + + +
- + + + + +
-
+
- + + #table + +RAT.destination_ports + + +
- + + + + +
-
+
- + + #boolean + +RAT.f10menu + + +
- + + + + +
-
+
- + + #string + +RAT.friendly + + +
- + + + + +
-
+
- + + #RAT + +RAT.markerid + + +
-
+
+
Running number of placed markers on the F10 map.
+ +
+
-
+
- + + #table + +RAT.markerids + + +
- + + + + +
-
+
- + + #number + +RAT.maxdist + + +
- + + + + +
-
+
- + + #number + +RAT.mindist + + +
- + + + + +
-
+
- + + #boolean + +RAT.placemarkers + + +
- + + + + +
-
+
- + + #boolean + +RAT.random_departure + + +
- + + + + +
-
+
- + + #boolean + +RAT.random_destination + + +
- + + + + +
-
+
- + + #table + +RAT.ratcraft + + +
- + + + + +
-
+
- + + #boolean + +RAT.reportstatus + + +
- + + + + +
-
+
- + + #boolean + +RAT.respawn_after_landing + + +
- + + + + +
-
+
- + + #number + +RAT.respawn_delay + + +
- + + + + +
-
+
- + + #string + +RAT.roe + + +
- + + + + +
-
+
- + + #string + +RAT.rot + + +
- + + + + +
-
+
- + + #number + +RAT.spawndelay + + +
- + + + + +
-
+
- + + #number + +RAT.spawninterval + + +
- + + + + +
-
+
- + + #number + +RAT.statusinterval + + +
- + + + + +
-
+
- + + #string + +RAT.takeoff + + +
- + + + + +
-
+
- + + #RAT + +RAT.unit + + +
-
+
+
RAT unit conversions.
+ +
+