Module Ops.RescueHelo
Ops - Rescue helicopter for carrier operations.
Recue helicopter for carrier operations.
Main Features:
- Close formation with carrier.
- No restrictions regarding carrier waypoints and heading.
- Automatic respawning on empty fuel for 24/7 operations.
- Automatic rescuing of crashed or ejected pilots in the vicinity of the carrier.
- Multiple helos at different carriers due to object oriented approach.
- Finite State Machine (FSM) implementation.
Known (DCS) Issues
- CH-53E does only report 27.5% fuel even if fuel is set to 100% in the ME. See bug report
- CH-53E does not accept USS Tarawa as landing airbase (even it can be spawned on it).
- Helos dont move away from their landing position on carriers.
Author: funkyfranky
Contributions: Flightcontrol (AI.AI_Formation class being used here)
Global(s)
Global RESCUEHELO |
Rescue Helo Recue HeloThe rescue helo will fly in close formation with another unit, which is typically an aircraft carrier. |
Rescue Helo
Recue Helo
The rescue helo will fly in close formation with another unit, which is typically an aircraft carrier.
It's mission is to rescue crashed or ejected pilots. Well, and to look cool...
Simple Script
In the mission editor you have to set up a carrier unit, which will act as "mother". In the following, this unit will be named "USS Stennis".
Secondly, you need to define a rescue helicopter group in the mission editor and set it to "LATE ACTIVATED". The name of the group we'll use is "Recue Helo".
The basic script is very simple and consists of only two lines.
RescueheloStennis=RESCUEHELO:New(UNIT:FindByName("USS Stennis"), "Rescue Helo")
RescueheloStennis:Start()
The first line will create a new #RESCUEHELO object via RESCUEHELO.New and the second line starts the process by calling RESCUEHELO.Start.
NOTE that it is very important to define the RESCUEHELO object as global variable. Otherwise, the lua garbage collector will kill the formation for unknown reasons!
By default, the helo will be spawned on the USS Stennis with hot engines. Then it will take off and go on station on the starboard side of the boat.
Once the helo is out of fuel, it will return to the carrier. When the helo lands, it will be respawned immidiately and go back on station.
If a unit crashes or a pilot ejects within a radius of 30 km from the USS Stennis, the helo will automatically fly to the crash side and rescue to pilot. This will take around 5 minutes. After that, the helo will return to the Stennis, land there and bring back the poor guy. When this is done, the helo will go back on station.
Fine Tuning
The implementation allows to customize quite a few settings easily via user API functions.
Takeoff Type
By default, the helo is spawned with running engines on the carrier. The mission designer has set option to set the take off type via the RESCUEHELO.SetTakeoff function. Or via shortcuts
- RESCUEHELO.SetTakeoffHot(): Will set the takeoff to hot, which is also the default.
- RESCUEHELO.SetTakeoffCold(): Will set the takeoff type to cold, i.e. with engines off.
- RESCUEHELO.SetTakeoffAir(): Will set the takeoff type to air, i.e. the helo will be spawned in air near the unit which he follows.
For example,
RescueheloStennis=RESCUEHELO:New(UNIT:FindByName("USS Stennis"), "Rescue Helo")
RescueheloStennis:SetTakeoffAir()
RescueheloStennis:Start()
will spawn the helo near the USS Stennis in air.
Spawning in air is not as realistic but can be useful do avoid DCS bugs and shortcomings like aircraft crashing into each other on the flight deck.
Note that when spawning in air is set, the helo will also not return to the boat, once it is out of fuel. Instead it will be respawned in air.
If only the first spawning should happen on the carrier, one use the RESCUEHELO.SetRespawnInAir() function to command that all subsequent spawning will happen in air.
If the helo should no be respawned at all, one can set RESCUEHELO.SetRespawnOff().
Home Base
It is possible to define a "home base" other than the aircraft carrier using the RESCUEHELO.SetHomeBase(airbase) function, where airbase is a Wrapper.Airbase#AIRBASE object or simply the name of the airbase.
For example, one could imagine a strike group, and the helo will be spawned from another ship which has a helo pad.
RescueheloStennis=RESCUEHELO:New(UNIT:FindByName("USS Stennis"), "Rescue Helo")
RescueheloStennis:SetHomeBase(AIRBASE:FindByName("USS Normandy"))
RescueheloStennis:Start()
In this case, the helo will be spawned on the USS Normandy and then make its way to the USS Stennis to establish the formation. Note that the distance to the mother ship should be rather small since the helo will go there very slowly.
Once the helo runs out of fuel, it will return to the USS Normandy and not the Stennis for respawning.
Formation Position
The position of the helo relative to the mother ship can be tuned via the functions
- RESCUEHELO.SetAltitude(altitude), where altitude is the altitude the helo flies at in meters. Default is 70 meters.
- RESCUEHELO.SetOffsetX(distance), where *distance is the distance in the direction of movement of the carrier. Default is 200 meters.
- RESCUEHELO.SetOffsetZ(distance), where *distance is the distance on the starboard side. Default is 100 meters.
Rescue Operations
By default the rescue helo will start a rescue operation if an aircraft crashes or a pilot ejects in the vicinity of the carrier. This is restricted to aircraft of the same coalition as the rescue helo. Enemy (or neutral) pilots will be left on their own.
The standard "rescue zone" has a radius of 15 NM (~28 km) around the carrier. The radius can be adjusted via the RESCUEHELO.SetRescueZone(radius) functions, where radius is the radius of the zone in nautical miles. If you use multiple rescue helos in the same mission, you might want to ensure that the radii are not overlapping so that two helos try to rescue the same pilot. But it should not hurt either way.
Once the helo reaches the crash site, the rescue operation will last 5 minutes. This time can be changed by RESCUEHELO.SetRescueDuration(speed), where the speed is given in knots.
If no rescue operations should be carried out by the helo, this option can be completely disabled by using RESCUEHELO.SetRescueOff().
Finite State Machine
The implementation uses a Finite State Machine (FSM). This allows the mission designer to hook in to certain events.
- RESCUEHELO.Start: This eventfunction starts the FMS process and initialized parameters and spawns the helo. DCS event handling is started.
- RESCUEHELO.Status: This eventfunction is called in regular intervals (~60 seconds) and checks the status of the helo and carrier. It triggers other events if necessary.
- RESCUEHELO.Rescue: This eventfunction commands the helo to go on a rescue operation at a certain coordinate.
- RESCUEHELO.RTB: This eventsfunction sends the helo to its home base (usually the carrier). This is called once the helo runs low on gas.
- RESCUEHELO.Run: This eventfunction is called when the helo resumes normal operations and goes back on station.
- RESCUEHELO.Stop: This eventfunction stops the FSM by unhandling DCS events.
The mission designer can capture these events by RESCUEHELO.OnAfterEventname functions, e.g. RESCUEHELO.OnAfterRescue.
Debugging
In case you have problems, it is always a good idea to have a look at your DCS log file. You find it in your "Saved Games" folder, so for example in
C:\Users\<yourname>\Saved Games\DCS\Logs\dcs.log
All output concerning the #RESCUEHELO class should have the string "RESCUEHELO" in the corresponding line. Searching for lines that contain the string "error" or "nil" can also give you a hint what's wrong.
The verbosity of the output can be increased by adding the following lines to your script:
BASE:TraceOnOff(true)
BASE:TraceLevel(1)
BASE:TraceClass("RESCUEHELO")
To get even more output you can increase the trace level to 2 or even 3, c.f. Core.Base#BASE for more details.
Debug Mode
You have the option to enable the debug mode for this class via the RESCUEHELO.SetDebugModeON function. If enabled, text messages about the helo status will be displayed on screen and marks of the pattern created on the F10 map.
Global _RESCUEHELOID |
Type(s)
Fields and Methods inherited from RESCUEHELO | Description |
---|---|
Name of the class. |
|
Debug mode on/off. |
|
Alias of helo spawn group. |
|
Get unit name of the spawned helo. |
|
Initial fuel of helo in percent. Necessary due to DCS bug that helo with full tank does not return fuel via API function. |
|
Check if helo is on a rescue mission. |
|
Check if helo is returning to base. |
|
Check if helo is operating. |
|
Check if FMS was stopped. |
|
Create a new RESCUEHELO object. |
|
On after "RTB" event user function. |
|
On after "Rescue" event user function. |
|
On after "Returned" event user function. |
|
On after "Start" event function. |
|
Handle landing event of rescue helo. |
|
Triggers the FSM event "RTB" that sends the helo home. |
|
Triggers the FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate. |
|
Triggers the FSM event "Returned" after the helo has landed. |
|
Route helo back to its home base. |
|
Triggers the FSM event "Run". |
|
Set altitude of helo. |
|
Deactivate debug mode. |
|
Activate debug mode. |
|
Set follow time update interval. |
|
Set home airbase of the helo. |
|
Set low fuel state of helo. |
|
Set modex (tail number) of the helo. |
|
Set offset parallel to orientation of carrier. |
|
Set offset perpendicular to orientation to carrier. |
|
Set rescue duration. |
|
Set rescue hover speed. |
|
Deactivate rescue option. |
|
Activate rescue option. |
|
Do not stop carrier during rescue operations. |
|
Stop carrier during rescue operations. |
|
Set rescue zone radius. |
|
Helo will be respawned in air, even it was initially spawned on the carrier. |
|
Disable respawning of helo. |
|
Enable respawning of helo. |
|
Set whether helo shall be respawned or not. |
|
Set takeoff type. |
|
Set takeoff in air near the carrier. |
|
Set takeoff with engines off (cold). |
|
Set takeoff with engines running (hot). |
|
Use an uncontrolled aircraft already present in the mission rather than spawning a new helo as initial rescue helo. |
|
Triggers the FSM event "Start" that starts the rescue helo. |
|
Triggers the FSM event "Status" that updates the helo status. |
|
Triggers the FSM event "Stop" that stops the rescue helo. |
|
A unit crashed or a player ejected. |
|
Task to send the helo RTB. |
|
Triggers the FSM event "RTB" that sends the helo home after a delay. |
|
Triggers the delayed FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate. |
|
Triggers the delayed FSM event "Returned" after the helo has landed. |
|
Triggers the delayed FSM event "Run". |
|
Triggers the FSM event "Start" that starts the rescue helo after a delay. |
|
Triggers the delayed FSM event "Status" that updates the helo status. |
|
Triggers the FSM event "Stop" that stops the rescue helo after a delay. |
|
The airbase object acting as home base of the helo. |
|
Alias of the spawn group. |
|
Altitude of helo in meters. |
|
The carrier the helo is attached to. |
|
If true, route of carrier was stopped. |
|
Carrier type. |
|
Follow time update interval in seconds. Default 1.0 sec. |
|
Follow group set. |
|
AI_FORMATION object. |
|
Helo group. |
|
Name of the late activated helo template group. |
|
Unit ID of the helo group. (Global) Running number. |
|
Log debug id text. |
|
Low fuel threshold of helo in percent. |
|
Tail number of the helo. |
|
Offset in meters to carrier in longitudinal direction. |
|
Offset in meters to carrier in latitudinal direction. |
|
On after RTB event. |
|
On after "Rescue" event. |
|
On after Returned event. |
|
On after "Run" event. |
|
On after Start event. |
|
On after Status event. |
|
On after Stop event. |
|
Time the rescue helicopter hovers over the crash site in seconds. |
|
If true, helo will rescue crashed pilots. If false, no recuing will happen. |
|
Speed in m/s the rescue helicopter hovers at over the crash site. |
|
If true, stop carrier during rescue operations. |
|
Zone around the carrier in which helo will rescue crashed or ejected units. |
|
If true, helo be respawned (default). If false, no respawning will happen. |
|
If true, helo will always be respawned in air. This has no impact on the initial spawn setting. |
|
If true, Helo will be return to base on the next status check. |
|
Takeoff type. |
|
Unique ID of this helo. |
|
If true, use and uncontrolled helo group already present in the mission. |
|
Class version. |
Fields and Methods inherited from FSM | Description |
---|---|
Adds an End state. |
|
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task. |
|
Adds a score for the FSM to be achieved. |
|
RESCUEHELO:AddScoreProcess(From, Event, State, ScoreText, Score) |
Adds a score for the FSM_PROCESS to be achieved. |
Add a new transition rule to the FSM. |
|
Call scheduler. |
|
Name of the class. |
|
Get current state. |
|
Returns the End states. |
|
Returns a table of the SubFSM rules defined within the FSM. |
|
Returns a table with the scores defined. |
|
Returns the start state of the FSM. |
|
Get current state. |
|
Returns a table with the Subs defined. |
|
Returns a table of the transition rules defined within the FSM. |
|
Check if FSM is in state. |
|
Load call backs. |
|
Creates a new FSM object. |
|
Scores. |
|
Sets the start state of the FSM. |
|
Add to map. |
|
Call handler. |
|
Create transition. |
|
Delayed transition. |
|
Event map. |
|
Go sub. |
|
Handler. |
|
Is end state. |
|
Sub maps. |
|
Check if can do an event. |
|
Check if cannot do an event. |
|
Current state name. |
|
Check if FSM is in state. |
|
Options. |
|
Subs. |
Fields and Methods inherited from BASE | Description |
---|---|
The ID number of the class. |
|
The name of the class. |
|
The name of the class concatenated with the ID number of the class. |
|
Clear the state of an object. |
|
RESCUEHELO:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace) |
Creation of a Birth Event. |
RESCUEHELO:CreateEventCrash(EventTime, Initiator, IniObjectCategory) |
Creation of a Crash Event. |
RESCUEHELO:CreateEventDead(EventTime, Initiator, IniObjectCategory) |
Creation of a Dead Event. |
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event. |
|
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event. |
|
Creation of a |
|
Creation of a Remove Unit Event. |
|
Creation of a Takeoff Event. |
|
Creation of a Crash Event. |
|
Log an exception which will be traced always. |
|
Returns the event dispatcher |
|
Remove all subscribed events |
|
Trace a function call. |
|
Trace a function call level 2. |
|
Trace a function call level 3. |
|
Get the ClassID of the class instance. |
|
Get the ClassName of the class instance. |
|
Get the ClassName + ClassID of the class instance. |
|
Get the Class Core.Event processing Priority. |
|
This is the worker method to retrieve the Parent class. |
|
Get a Value given a Key from the Object. |
|
Subscribe to a DCS Event. |
|
Log an information which will be traced always. |
|
This is the worker method to inherit from a parent class. |
|
This is the worker method to check if an object is an (sub)instance of a class. |
|
Enquires if tracing is on (for the class). |
|
BASE constructor. |
|
Occurs when an Event for an object is triggered. |
|
BDA. |
|
Occurs when a ground unit captures either an airbase or a farp. |
|
Occurs when any object is spawned into the mission. |
|
Occurs when any aircraft crashes into the ground and is completely destroyed. |
|
Occurs when an object is dead. |
|
Unknown precisely what creates this event, likely tied into newer damage model. |
|
Discard chair after ejection. |
|
Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo. |
|
Occurs when a dynamic cargo crate is removed. |
|
Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo. |
|
Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when any aircraft shuts down its engines. |
|
Occurs when any aircraft starts its engines. |
|
Occurs whenever an object is hit by a weapon. |
|
Occurs when any system fails on a human controlled aircraft. |
|
Occurs on the death of a unit. |
|
Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up. |
|
Landing quality mark. |
|
Occurs when a new mark was added. |
|
Occurs when a mark text was changed. |
|
Occurs when a mark was removed. |
|
Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a player creates a dynamic cargo object from the F8 ground crew menu. |
|
Weapon add. |
|
Occurs when the pilot of an aircraft is killed. |
|
Occurs when a player enters a slot and takes control of an aircraft. |
|
Occurs when any player assumes direct control of a unit. |
|
Occurs when any player relieves control of a unit to the AI. |
|
Occurs when an aircraft connects with a tanker and begins taking on fuel. |
|
Occurs when an aircraft is finished taking fuel. |
|
Occurs when any modification to the "Score" as seen on the debrief menu would occur. |
|
Occurs when any unit stops firing its weapon. |
|
Occurs when any unit begins firing a weapon that has a high rate of fire. |
|
Occurs whenever any unit in a mission fires a weapon. |
|
Occurs when an aircraft takes off from an airbase, farp, or ship. |
|
Trigger zone. |
|
Occurs when the game thinks an object is destroyed. |
|
Schedule a new time event. |
|
RESCUEHELO:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...) |
Schedule a new time event. |
Stops the Schedule. |
|
Set the Class Core.Event processing Priority. |
|
Set a state or property of the Object given a Key and a Value. |
|
Trace a function logic level 1. |
|
Trace a function logic level 2. |
|
Trace a function logic level 3. |
|
Trace all methods in MOOSE |
|
Set tracing for a class |
|
Set tracing for a specific method of class |
|
Set trace level |
|
Set trace off. |
|
Set trace on. |
|
Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default. |
|
UnSubscribe to a DCS event. |
|
RESCUEHELO:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function call. |
(Internal) Serialize arguments |
|
RESCUEHELO:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function logic. |
The main event handling function... |
RESCUEHELO class.
Field(s)
Name of the class.
Debug mode on/off.
Initial fuel of helo in percent. Necessary due to DCS bug that helo with full tank does not return fuel via API function.
Alias of the spawn group.
Altitude of helo in meters.
If true, route of carrier was stopped.
Carrier type.
Follow time update interval in seconds. Default 1.0 sec.
Name of the late activated helo template group.
Unit ID of the helo group. (Global) Running number.
Log debug id text.
Low fuel threshold of helo in percent.
Tail number of the helo.
Offset in meters to carrier in longitudinal direction.
Offset in meters to carrier in latitudinal direction.
Time the rescue helicopter hovers over the crash site in seconds.
If true, helo will rescue crashed pilots. If false, no recuing will happen.
Speed in m/s the rescue helicopter hovers at over the crash site.
If true, stop carrier during rescue operations.
Zone around the carrier in which helo will rescue crashed or ejected units.
If true, helo be respawned (default). If false, no respawning will happen.
If true, helo will always be respawned in air. This has no impact on the initial spawn setting.
If true, Helo will be return to base on the next status check.
Takeoff type.
Unique ID of this helo.
If true, use and uncontrolled helo group already present in the mission.
Class version.
Function(s)
Alias of helo spawn group.
Defined in:
RESCUEHELO
Return value:
#string:
Alias of the helo.
Get unit name of the spawned helo.
Defined in:
RESCUEHELO
Return value:
#string:
Name of the helo unit or nil if it does not exist.
Check if helo is on a rescue mission.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, helo is rescuing somebody.
Check if helo is returning to base.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, helo is returning to base.
Check if helo is operating.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, helo is operating.
Check if FMS was stopped.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, is stopped.
Create a new RESCUEHELO object.
Defined in:
RESCUEHELO
Parameters:
Wrapper.Unit#UNIT carrierunit
Carrier unit object or simply the unit name.
#string helogroupname
Name of the late activated rescue helo template group.
Return value:
RESCUEHELO object.
On after "RTB" event user function.
Called when a the the helo returns to its home base.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The airbase to return to. Default is the home base.
On after "Rescue" event user function.
Called when a the the helo goes on a rescue mission.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Core.Point#COORDINATE RescueCoord
Crash site where the rescue operation takes place.
On after "Returned" event user function.
Called when a the the helo has landed at an airbase.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The airbase the helo has landed.
On after "Start" event function.
Called when FSM is started.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Handle landing event of rescue helo.
Triggers the FSM event "RTB" that sends the helo home.
Defined in:
RESCUEHELO
Parameter:
Wrapper.Airbase#AIRBASE airbase
The airbase to return to. Default is the home base.
Triggers the FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate.
Defined in:
RESCUEHELO
Parameter:
Core.Point#COORDINATE RescueCoord
Coordinate where the resue mission takes place.
Triggers the FSM event "Returned" after the helo has landed.
Route helo back to its home base.
Set altitude of helo.
Defined in:
RESCUEHELO
Parameter:
#number alt
Altitude in meters. Default 70 m.
Return value:
self
Deactivate debug mode.
This is also the default setting.
Activate debug mode.
Display debug messages on screen.
Set follow time update interval.
Defined in:
RESCUEHELO
Parameter:
#number dt
Time interval in seconds. Default 1.0 sec.
Return value:
self
Set home airbase of the helo.
This is the airbase where the helo is spawned (if not in air) and will go when it is out of fuel.
Defined in:
RESCUEHELO
Parameter:
Wrapper.Airbase#AIRBASE airbase
The home airbase. Can be the airbase name (passed as a string) or a Moose AIRBASE object.
Return value:
self
Set low fuel state of helo.
When fuel is below this threshold, the helo will RTB or be respawned if takeoff type is in air.
Defined in:
RESCUEHELO
Parameter:
#number threshold
Low fuel threshold in percent. Default 5%.
Return value:
self
Set modex (tail number) of the helo.
Set offset parallel to orientation of carrier.
Defined in:
RESCUEHELO
Parameter:
#number distance
Offset distance in meters. Default 200 m (~660 ft).
Return value:
self
Set offset perpendicular to orientation to carrier.
Defined in:
RESCUEHELO
Parameter:
#number distance
Offset distance in meters. Default 240 m (~780 ft).
Return value:
self
Set rescue duration.
This is the time it takes to rescue a pilot at the crash site.
Defined in:
RESCUEHELO
Parameter:
#number duration
Duration in minutes. Default 5 min.
Return value:
self
Set rescue hover speed.
Defined in:
RESCUEHELO
Parameter:
#number speed
Speed in knots. Default 5 kts.
Return value:
self
Deactivate rescue option.
Crashed and ejected pilots will not be rescued.
Activate rescue option.
Crashed and ejected pilots will be rescued. This is the default setting.
Do not stop carrier during rescue operations.
This is the default setting.
Stop carrier during rescue operations.
NOT WORKING!
Set rescue zone radius.
Crashed or ejected units inside this radius of the carrier will be rescued if possible.
Defined in:
RESCUEHELO
Parameter:
#number radius
Radius of rescue zone in nautical miles. Default is 15 NM.
Return value:
self
Helo will be respawned in air, even it was initially spawned on the carrier.
So only the first spawn will be on the carrier while all subsequent spawns will happen in air. This allows for undisrupted operations and less problems on the carrier deck.
Disable respawning of helo.
Enable respawning of helo.
Note that this is the default behaviour.
Set whether helo shall be respawned or not.
Defined in:
RESCUEHELO
Parameter:
#boolean switch
If true (or nil), helo will be respawned. If false, helo will not be respawned.
Return value:
self
Set takeoff type.
Defined in:
RESCUEHELO
Parameter:
#number takeofftype
Takeoff type. Default SPAWN.Takeoff.Hot.
Return value:
self
Set takeoff in air near the carrier.
Set takeoff with engines off (cold).
Set takeoff with engines running (hot).
Use an uncontrolled aircraft already present in the mission rather than spawning a new helo as initial rescue helo.
This can be useful when interfaced with, e.g., a warehouse. The group name is the one specified in the RESCUEHELO.New function.
Triggers the FSM event "Start" that starts the rescue helo.
Initializes parameters and starts event handlers.
Defined in:
RESCUEHELO
Triggers the FSM event "Status" that updates the helo status.
Defined in:
RESCUEHELO
Triggers the FSM event "Stop" that stops the rescue helo.
Event handlers are stopped.
Defined in:
RESCUEHELO
A unit crashed or a player ejected.
Task to send the helo RTB.
Triggers the FSM event "RTB" that sends the helo home after a delay.
Defined in:
RESCUEHELO
Parameters:
#number delay
Delay in seconds.
Wrapper.Airbase#AIRBASE airbase
The airbase to return to. Default is the home base.
Triggers the delayed FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate.
Defined in:
RESCUEHELO
Parameters:
#number delay
Delay in seconds.
Core.Point#COORDINATE RescueCoord
Coordinate where the resue mission takes place.
Triggers the delayed FSM event "Returned" after the helo has landed.
Defined in:
RESCUEHELO
Parameters:
#number delay
Delay in seconds.
Wrapper.Airbase#AIRBASE airbase
The airbase the helo has landed.
Triggers the delayed FSM event "Run".
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Start" that starts the rescue helo after a delay.
Initializes parameters and starts event handlers.
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
Triggers the delayed FSM event "Status" that updates the helo status.
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Stop" that stops the rescue helo after a delay.
Event handlers are stopped.
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
On after RTB event.
Send helo back to carrier.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The base to return to. Default is the home base.
On after "Rescue" event.
Helo will fly to the given coordinate, orbit there for 5 minutes and then return to the carrier.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Core.Point#COORDINATE RescueCoord
Coordinate where the rescue should happen.
On after Returned event.
Helo has landed.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The base to which the helo has returned.
On after "Run" event.
FSM will go to "Running" state. If formation is stopped, it will be started again.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after Start event.
Starts the warehouse. Addes event handlers and schedules status updates of reqests and queue.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after Status event.
Checks player status.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after Stop event.
Unhandle events and stop status updates. If helo is alive, it is despawned.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Field(s)
Name of the class.
Debug mode on/off.
Initial fuel of helo in percent. Necessary due to DCS bug that helo with full tank does not return fuel via API function.
Alias of the spawn group.
Altitude of helo in meters.
If true, route of carrier was stopped.
Carrier type.
Follow time update interval in seconds. Default 1.0 sec.
Name of the late activated helo template group.
Unit ID of the helo group. (Global) Running number.
Log debug id text.
Low fuel threshold of helo in percent.
Tail number of the helo.
Offset in meters to carrier in longitudinal direction.
Offset in meters to carrier in latitudinal direction.
Time the rescue helicopter hovers over the crash site in seconds.
If true, helo will rescue crashed pilots. If false, no recuing will happen.
Speed in m/s the rescue helicopter hovers at over the crash site.
If true, stop carrier during rescue operations.
Zone around the carrier in which helo will rescue crashed or ejected units.
If true, helo be respawned (default). If false, no respawning will happen.
If true, helo will always be respawned in air. This has no impact on the initial spawn setting.
If true, Helo will be return to base on the next status check.
Takeoff type.
Unique ID of this helo.
If true, use and uncontrolled helo group already present in the mission.
Class version.
Function(s)
Adds an End state.
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
Core.Fsm#FSM_PROCESS Process
An sub-process FSM.
#table ReturnEvents
A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.
Return value:
The SubFSM.
Adds a score for the FSM to be achieved.
Defined in:
Parameters:
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Adds a score for the FSM_PROCESS to be achieved.
Defined in:
Parameters:
#string From
is the From State of the main process.
#string Event
is the Event of the main process.
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Add a new transition rule to the FSM.
A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
#string To
The To state.
Get current state.
Returns the End states.
Returns a table of the SubFSM rules defined within the FSM.
Returns a table with the scores defined.
Returns the start state of the FSM.
Get current state.
Returns a table with the Subs defined.
Returns a table of the transition rules defined within the FSM.
Check if FSM is in state.
Defined in:
Parameter:
#string State
State name.
Return value:
#boolean:
If true, FSM is in this state.
Load call backs.
Sets the start state of the FSM.
Add to map.
Call handler.
Defined in:
Parameters:
#string step
Step "onafter", "onbefore", "onenter", "onleave".
#string trigger
Trigger.
#table params
Parameters.
#string EventName
Event name.
Return value:
Value.
Create transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Delayed transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Event map.
Go sub.
Defined in:
Parameters:
#string ParentFrom
Parent from state.
#string ParentEvent
Parent event name.
Return value:
#table:
Subs.
Handler.
Is end state.
Defined in:
Parameter:
#string Current
Current state name.
Return values:
#table:
FSM parent.
#string:
Event name.
Sub maps.
Check if can do an event.
Defined in:
Parameter:
#string e
Event name.
Return values:
#boolean:
If true, FSM can do the event.
#string:
To state.
Check if cannot do an event.
Defined in:
Parameter:
#string e
Event name.
Return value:
#boolean:
If true, FSM cannot do the event.
Check if FSM is in state.
Defined in:
Parameters:
#string State
State name.
state
Return value:
#boolean:
If true, FSM is in this state.
Field(s)
Name of the class.
Debug mode on/off.
Initial fuel of helo in percent. Necessary due to DCS bug that helo with full tank does not return fuel via API function.
Alias of the spawn group.
Altitude of helo in meters.
If true, route of carrier was stopped.
Carrier type.
Follow time update interval in seconds. Default 1.0 sec.
Name of the late activated helo template group.
Unit ID of the helo group. (Global) Running number.
Log debug id text.
Low fuel threshold of helo in percent.
Tail number of the helo.
Offset in meters to carrier in longitudinal direction.
Offset in meters to carrier in latitudinal direction.
Time the rescue helicopter hovers over the crash site in seconds.
If true, helo will rescue crashed pilots. If false, no recuing will happen.
Speed in m/s the rescue helicopter hovers at over the crash site.
If true, stop carrier during rescue operations.
Zone around the carrier in which helo will rescue crashed or ejected units.
If true, helo be respawned (default). If false, no respawning will happen.
If true, helo will always be respawned in air. This has no impact on the initial spawn setting.
If true, Helo will be return to base on the next status check.
Takeoff type.
Unique ID of this helo.
If true, use and uncontrolled helo group already present in the mission.
Class version.
Function(s)
Clear the state of an object.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
StateName
The key that is should be cleared.
Creation of a Birth Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
#string IniUnitName
The initiating unit name.
place
subplace
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a Dead Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT
event.
Creation of a Remove Unit Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Takeoff Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Log an exception which will be traced always.
Can be anywhere within the function logic.
Returns the event dispatcher
Remove all subscribed events
Trace a function call.
Must be at the beginning of the function logic.
Trace a function call level 2.
Must be at the beginning of the function logic.
Trace a function call level 3.
Must be at the beginning of the function logic.
Get the ClassID of the class instance.
Get the ClassName of the class instance.
Get the ClassName + ClassID of the class instance.
The ClassName + ClassID is formatted as '%s#%09d'.
Get the Class Core.Event processing Priority.
The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.
This is the worker method to retrieve the Parent class.
Note that the Parent class must be passed to call the parent class method.
self:GetParent(self):ParentMethod()
Get a Value given a Key from the Object.
Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
Key
The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!
Return value:
The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.
Subscribe to a DCS Event.
Defined in:
Parameters:
Core.Event#EVENTS EventID
Event ID.
#function EventFunction
(optional) The function to be called when the event occurs for the unit.
Return value:
Log an information which will be traced always.
Can be anywhere within the function logic.
This is the worker method to inherit from a parent class.
Defined in:
Parameters:
Child
is the Child class that inherits.
#BASE Parent
is the Parent class that the Child inherits from.
Return value:
Child
This is the worker method to check if an object is an (sub)instance of a class.
Examples:
ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false
Defined in:
Parameter:
ClassName
is the name of the class or the class itself to run the check against
Return value:
#boolean:
Enquires if tracing is on (for the class).
BASE constructor.
This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
function EVENT:New()
local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
return self
end
Occurs when an Event for an object is triggered.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.
Occurs when a ground unit captures either an airbase or a farp.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
Occurs when any object is spawned into the mission.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned
Occurs when any aircraft crashes into the ground and is completely destroyed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed
Occurs when an object is dead.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.
Unknown precisely what creates this event, likely tied into newer damage model.
Will update this page when new information become available.
- initiator: The unit that had the failure.
Discard chair after ejection.
Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a dynamic cargo crate is removed.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.
initiator : The unit that has ejected
Occurs when any aircraft shuts down its engines.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.
Occurs when any aircraft starts its engines.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.
Occurs whenever an object is hit by a weapon.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.
Occurs when any system fails on a human controlled aircraft.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure
Occurs on the death of a unit.
Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: The unit that killed the target
- target: Target Object
- weapon: Weapon Object
Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.
initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.
Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
- place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
- subplace: is always 0 for unknown reasons.
Occurs when a new mark was added.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mark text was changed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mark was removed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Weapon add.
Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when the pilot of an aircraft is killed.
Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.
Occurs when a player enters a slot and takes control of an aircraft.
Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.
Occurs when any player assumes direct control of a unit.
Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.
Occurs when any player relieves control of a unit to the AI.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.
Occurs when an aircraft connects with a tanker and begins taking on fuel.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.
Occurs when an aircraft is finished taking fuel.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.
Occurs when any modification to the "Score" as seen on the debrief menu would occur.
There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when any unit stops firing its weapon.
Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.
Occurs when any unit begins firing a weapon that has a high rate of fire.
Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.
Occurs whenever any unit in a mission fires a weapon.
But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when an aircraft takes off from an airbase, farp, or ship.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
Occurs when the game thinks an object is destroyed.
Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: The unit that is was destroyed.
Schedule a new time event.
Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.
Defined in:
Parameters:
#number Start
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
#function SchedulerFunction
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
#table ...
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
Return value:
#string:
The Schedule ID of the planned schedule.
Schedule a new time event.
Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.
Defined in:
Parameters:
#number Start
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
#number Repeat
Specifies the interval in seconds when the scheduler will call the event function.
#number RandomizeFactor
Specifies a randomization factor between 0 and 1 to randomize the Repeat.
#number Stop
Specifies the amount of seconds when the scheduler will be stopped.
#function SchedulerFunction
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
#table ...
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
Return value:
#string:
The Schedule ID of the planned schedule.
Stops the Schedule.
Defined in:
Parameter:
#string SchedulerID
(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.
Set the Class Core.Event processing Priority.
The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.
Set a state or property of the Object given a Key and a Value.
Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
Defined in:
Parameters:
Object
The object that will hold the Value set by the Key.
Key
The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
Value
The value to is stored in the object.
Return value:
The Value set.
Trace a function logic level 1.
Can be anywhere within the function logic.
Trace a function logic level 2.
Can be anywhere within the function logic.
Trace a function logic level 3.
Can be anywhere within the function logic.
Trace all methods in MOOSE
Set tracing for a class
Set tracing for a specific method of class
Set trace off.
Set trace on.
Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.
So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.
Defined in:
Parameter:
#boolean TraceOnOff
Switch the tracing on or off.
Usage:
-- Switch the tracing On
BASE:TraceOnOff( true )
-- Switch the tracing Off
BASE:TraceOnOff( false )
UnSubscribe to a DCS event.
Trace a function call.
This function is private.
Defined in:
Parameters:
Arguments
A #table or any field.
DebugInfoCurrentParam
DebugInfoFromParam
(Internal) Serialize arguments
Trace a function logic.
Defined in:
Parameters:
Arguments
A #table or any field.
DebugInfoCurrentParam
DebugInfoFromParam
The main event handling function...
This function captures all events generated for the class.