Banner Image

Module Cargo.Cargo

Core -- Management of CARGO logistics, that can be transported from and to transportation carriers.


1) MOOSE Cargo System.

Those who have used the mission editor, know that the DCS mission editor provides cargo facilities.

However, these are merely static objects. Wouldn't it be nice if cargo could bring a new dynamism into your simulations? Where various objects of various types could be treated also as cargo?

This is what MOOSE brings to you, a complete new cargo object model that used the cargo capabilities of DCS world, but enhances it.

MOOSE Cargo introduces also a new concept, called a "carrier". These can be:

  • Helicopters
  • Planes
  • Ground Vehicles
  • Ships

With the MOOSE Cargo system, you can:

  • Take full control of the cargo as objects within your script (see below).
  • Board/Unboard infantry into carriers. Also other objects can be boarded, like mortars.
  • Load/Unload dcs world cargo objects into carriers.
  • Load/Unload other static objects into carriers (like tires etc).
  • Slingload cargo objects.
  • Board units one by one...

2) MOOSE Cargo Objects.

In order to make use of the MOOSE cargo system, you need to declare the DCS objects as MOOSE cargo objects!

This sounds complicated, but it is actually quite simple.

See here an example:

local EngineerCargoGroup = CARGO_GROUP:New( GROUP:FindByName( "Engineers" ), "Workmaterials", "Engineers", 250 )

The above code declares a MOOSE cargo object called EngineerCargoGroup. It actually just refers to an infantry group created within the sim called "Engineers". The infantry group now becomes controlled by the MOOSE cargo object EngineerCargoGroup. A MOOSE cargo object also has properties, like the type of cargo, the logical name, and the reporting range.

There are 4 types of MOOSE cargo objects possible, each represented by its own class:

Note that a CARGO crate is not meant to be slingloaded (it can, but it is not meant to be handled like that. Instead, a CARGO_CRATE is able to load itself into the bays of a carrier.

Each of these MOOSE cargo objects behave in its own way, and have methods to be handled.

local InfantryGroup = GROUP:FindByName( "Infantry" )
local InfantryCargo = CARGO_GROUP:New( InfantryGroup, "Engineers", "Infantry Engineers", 2000 )
local CargoCarrier = UNIT:FindByName( "Carrier" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
InfantryCargo:Board( CargoCarrier, 25 ) 

The above would create a MOOSE cargo object called InfantryCargo, and using that object, you can board the cargo into the carrier CargoCarrier. Simple, isn't it? Told you, and this is only the beginning.

The boarding, unboarding, loading, unloading of cargo is however something that is not meant to be coded manualy by mission designers. It would be too low-level and not end-user friendly to deal with cargo handling complexity. Things can become really complex if you want to make cargo being handled and behave in multiple scenarios.

3) Cargo Handling Classes, the main engines for mission designers!

For this reason, the MOOSE Cargo System is heavily used by 3 important cargo handling class hierarchies within MOOSE, that make cargo come "alive" within your mission in a full automatic manner!

3.1) AI Cargo handlers.

  • AI.AI_Cargo_APC will create for you the capatility to make an APC group handle cargo.
  • AI.AI_Cargo_Helicopter will create for you the capatility to make a Helicopter group handle cargo.

3.2) AI Cargo transportation dispatchers.

There are also dispatchers that make AI work together to transport cargo automatically!!!

  • AI.AI_Cargo_Dispatcher_APC derived classes will create for your dynamic cargo handlers controlled by AI ground vehicle groups (APCs) to transport cargo between sites.
  • AI.AI_Cargo_Dispatcher_Helicopters derived classes will create for your dynamic cargo handlers controlled by AI helicpter groups to transport cargo between sites.

3.3) Cargo transportation tasking.

And there is cargo transportation tasking for human players.

  • Tasking.Task_CARGO derived classes will create for you cargo transportation tasks, that allow human players to interact with MOOSE cargo objects to complete tasks.

Please refer to the documentation reflected within these modules to understand the detailed capabilties.

4) Cargo SETs.

To make life a bit more easy, MOOSE cargo objects can be grouped into a Core.Set#SET_CARGO. This is a collection of MOOSE cargo objects.

This would work as follows:

 -- Define the cargo set.
 local CargoSetWorkmaterials = SET_CARGO:New():FilterTypes( "Workmaterials" ):FilterStart()

 -- Now add cargo the cargo set.
 local EngineerCargoGroup = CARGO_GROUP:New( GROUP:FindByName( "Engineers" ), "Workmaterials", "Engineers", 250 )
 local ConcreteCargo = CARGO_SLINGLOAD:New( STATIC:FindByName( "Concrete" ), "Workmaterials", "Concrete", 150, 50 )
 local CrateCargo = CARGO_CRATE:New( STATIC:FindByName( "Crate" ), "Workmaterials", "Crate", 150, 50 )
 local EnginesCargo = CARGO_CRATE:New( STATIC:FindByName( "Engines" ), "Workmaterials", "Engines", 150, 50 )
 local MetalCargo = CARGO_CRATE:New( STATIC:FindByName( "Metal" ), "Workmaterials", "Metal", 150, 50 )

This is a very powerful concept! Instead of having to deal with multiple MOOSE cargo objects yourself, the cargo set capability will group cargo objects into one set. The key is the cargo type name given at each cargo declaration! In the above example, the cargo type name is "Workmaterials". Each cargo object declared is given that type name. (the 2nd parameter). What happens now is that the cargo set CargoSetWorkmaterials will be added with each cargo object dynamically when the cargo object is created. In other words, the cargo set CargoSetWorkmaterials will incorporate any "Workmaterials" dynamically into its set.

The cargo sets are extremely important for the AI cargo transportation dispatchers and the cargo transporation tasking.

5) Declare cargo directly in the mission editor!

But I am not finished! There is something more, that is even more great! Imagine the mission designers having to code all these lines every time it wants to embed cargo within a mission.

 -- Now add cargo the cargo set.
 local EngineerCargoGroup = CARGO_GROUP:New( GROUP:FindByName( "Engineers" ), "Workmaterials", "Engineers", 250 )
 local ConcreteCargo = CARGO_SLINGLOAD:New( STATIC:FindByName( "Concrete" ), "Workmaterials", "Concrete", 150, 50 )
 local CrateCargo = CARGO_CRATE:New( STATIC:FindByName( "Crate" ), "Workmaterials", "Crate", 150, 50 )
 local EnginesCargo = CARGO_CRATE:New( STATIC:FindByName( "Engines" ), "Workmaterials", "Engines", 150, 50 )
 local MetalCargo = CARGO_CRATE:New( STATIC:FindByName( "Metal" ), "Workmaterials", "Metal", 150, 50 )

This would be extremely tiring and a huge overload. However, the MOOSE framework allows to declare MOOSE cargo objects within the mission editor!!!

So, at mission startup, MOOSE will search for objects following a special naming convention, and will create for you dynamically cargo objects at mission start!!! -- These cargo objects can then be automatically incorporated within cargo set(s)!!! In other words, your mission will be reduced to about a few lines of code, providing you with a full dynamic cargo handling mission!

5.1) Use #CARGO tags in the mission editor:

MOOSE can create automatically cargo objects, if the name of the cargo contains the #CARGO tag. When a mission starts, MOOSE will scan all group and static objects it found for the presence of the #CARGO tag. When found, MOOSE will declare the object as cargo (create in the background a CARGO_ object, like CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD. The creation of these CARGO_ objects will allow to be filtered and automatically added in SET_CARGO objects. In other words, with very minimal code as explained in the above code section, you are able to create vast amounts of cargo objects just from within the editor.

What I talk about is this:

 -- BEFORE THIS SCRIPT STARTS, MOOSE WILL ALREADY HAVE SCANNED FOR OBJECTS WITH THE #CARGO TAG IN THE NAME.
 -- FOR EACH OF THESE OBJECT, MOOSE WILL HAVE CREATED CARGO_ OBJECTS LIKE CARGO_GROUP, CARGO_CRATE AND CARGO_SLINGLOAD.

 HQ = GROUP:FindByName( "HQ", "Bravo" )

 CommandCenter = COMMANDCENTER
   :New( HQ, "Lima" )

 Mission = MISSION
   :New( CommandCenter, "Operation Cargo Fun", "Tactical", "Transport Cargo", coalition.side.RED )

 TransportGroups = SET_GROUP:New():FilterCoalitions( "blue" ):FilterPrefixes( "Transport" ):FilterStart()

 TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, TransportGroups )

 -- This is the most important now. You setup a new SET_CARGO filtering the relevant type.
 -- The actual cargo objects are now created by MOOSE in the background.
 -- Each cargo is setup in the Mission Editor using the #CARGO tag in the group name.
 -- This allows a truly dynamic setup.
 local CargoSetWorkmaterials = SET_CARGO:New():FilterTypes( "Workmaterials" ):FilterStart()

 local WorkplaceTask = TaskDispatcher:AddTransportTask( "Build a Workplace", CargoSetWorkmaterials, "Transport the workers, engineers and the equipment near the Workplace." )
 TaskDispatcher:SetTransportDeployZone( WorkplaceTask, ZONE:New( "Workplace" ) )

The above code example has the CargoSetWorkmaterials, which is a SET_CARGO collection and will include the CARGO_ objects of the type "Workmaterials".
And there is NO cargo object actually declared within the script! However, if you would open the mission, there would be hundreds of cargo objects...

The #CARGO tag even allows for several options to be specified, which are important to learn.

5.2) The #CARGO tag to create CARGO_GROUP objects:

You can also use the #CARGO tag on group objects of the mission editor.

For example, the following #CARGO naming in the group name of the object, will create a CARGO_GROUP object when the mission starts.

Infantry #CARGO(T=Workmaterials,RR=500,NR=25)

This will create a CARGO_GROUP object:

  • with the group name Infantry #CARGO
  • is of type Workmaterials
  • will report when a carrier is within 500 meters
  • will board to carriers when the carrier is within 500 meters from the cargo object
  • will dissapear when the cargo is within 25 meters from the carrier during boarding

So the overall syntax of the #CARGO naming tag and arguments are:

GroupName #CARGO(T=CargoTypeName,RR=Range,NR=Range)

  • T= Provide a text that contains the type name of the cargo object. This type name can be used to filter cargo within a SET_CARGO object.
  • RR= Provide the minimal range in meters when the report to the carrier, and board to the carrier. Note that this option is optional, so can be omitted. The default value of the RR is 250 meters.
  • NR= Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding. Note that this option is optional, so can be omitted. The default value of the RR is 10 meters.

5.2) The #CARGO tag to create CARGO_CRATE objects:

You can also use the #CARGO tag on static objects, including static cargo objects of the mission editor.

For example, the following #CARGO naming in the static name of the object, will create a CARGO_CRATE object when the mission starts.

Static #CARGO(T=Workmaterials,RR=500,NR=25)

This will create a CARGO_CRATE object:

  • with the group name Static #CARGO
  • is of type Workmaterials
  • will report when a carrier is within 500 meters
  • will board to carriers when the carrier is within 500 meters from the cargo object
  • will dissapear when the cargo is within 25 meters from the carrier during boarding

So the overall syntax of the #CARGO naming tag and arguments are:

StaticName #CARGO(T=CargoTypeName,RR=Range,NR=Range)

  • T= Provide a text that contains the type name of the cargo object. This type name can be used to filter cargo within a SET_CARGO object.
  • RR= Provide the minimal range in meters when the report to the carrier, and board to the carrier. Note that this option is optional, so can be omitted. The default value of the RR is 250 meters.
  • NR= Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding. Note that this option is optional, so can be omitted. The default value of the RR is 10 meters.

Author: FlightControl

Contributions:


Global(s)

Global CARGO

Defines the core functions that defines a cargo object within MOOSE.

#CARGO CARGO

Defines the core functions that defines a cargo object within MOOSE.

A cargo is a logical object defined that is available for transport, and has a life status within a simulation.

CARGO is not meant to be used directly by mission designers, but provides a base class for concrete cargo implementation classes to handle:

The above cargo classes are used by the AI_CARGO_ classes to allow AI groups to transport cargo:

The above cargo classes are also used by the TASK_CARGO_ classes to allow human players to transport cargo as part of a tasking:

The CARGO is a state machine: it manages the different events and states of the cargo. All derived classes from CARGO follow the same state machine, expose the same cargo event functions, and provide the same cargo states.

CARGO Events:

  • CARGO.Board( ToCarrier ): Boards the cargo to a carrier.
  • CARGO.Load( ToCarrier ): Loads the cargo into a carrier, regardless of its position.
  • CARGO.UnBoard( ToPointVec2 ): UnBoard the cargo from a carrier. This will trigger a movement of the cargo to the option ToPointVec2.
  • CARGO.UnLoad( ToPointVec2 ): UnLoads the cargo from a carrier.
  • CARGO.Destroyed( Controllable ): The cargo is dead. The cargo process will be ended.

Global CARGOS

#table CARGOS

Global CARGO_PACKAGE

Global CARGO_REPORTABLE

Global CARGO_REPRESENTABLE

Models CARGO that is representable by a Unit.

#CARGO_REPRESENTABLE CARGO_REPRESENTABLE

Models CARGO that is representable by a Unit.

Type(s)

Fields and Methods inherited from CARGO Description

CARGO:Board(ToCarrier, NearRadius)

Boards the cargo to a Carrier.

CARGO:CanBoard()

Check if the cargo can be Boarded.

CARGO:CanLoad()

Check if the cargo can be Loaded.

CARGO:CanSlingload()

Check if the cargo can be Slingloaded.

CARGO:CanUnboard()

Check if the cargo can be Unboarded.

CARGO:CanUnload()

Check if the cargo can be Unloaded.

CARGO.CargoCarrier

The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere...

CARGO.CargoLimit

CARGO.CargoObject

The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...

CARGO.CargoScheduler

CARGO.Containable

This flag defines if the cargo can be contained within a DCS Unit.

CARGO.Deployed

CARGO:Destroy()

Destroy the cargo.

CARGO:FindByName(CargoName)

Find a CARGO in the _DATABASE.

CARGO:Flare(FlareColor)

Signal a flare at the position of the CARGO.

CARGO:FlareGreen()

Signal a green flare at the position of the CARGO.

CARGO:FlareRed()

Signal a red flare at the position of the CARGO.

CARGO:FlareWhite()

Signal a white flare at the position of the CARGO.

CARGO:FlareYellow()

Signal a yellow flare at the position of the CARGO.

CARGO:GetCoalition()

Get the coalition of the Cargo.

CARGO:GetCoordinate()

Get the current coordinates of the Cargo.

CARGO:GetCount()

Get the amount of Cargo.

CARGO:GetHeading()

Get the heading of the cargo.

CARGO:GetLoadRadius()

Get the Load radius, which is the radius till when the Cargo can be loaded.

CARGO:GetName()

Get the name of the Cargo.

CARGO:GetObject()

Get the current active object representing or being the Cargo.

CARGO:GetObjectName()

Get the object name of the Cargo.

CARGO:GetPointVec2()

Get the current PointVec2 of the cargo.

CARGO:GetTransportationMethod()

Get the transportation method of the Cargo.

CARGO:GetType()

Get the type of the Cargo.

CARGO:GetVolume()

Get the volume of the cargo.

CARGO:GetWeight()

Get the weight of the cargo.

CARGO:GetX()

Get the x position of the cargo.

CARGO:GetY()

Get the y position of the cargo.

CARGO:IsAlive()

Check if cargo is alive.

CARGO:IsBoarding()

Check if cargo is boarding.

CARGO:IsDeployed()

Is the cargo deployed

CARGO:IsDestroyed()

Check if cargo is destroyed.

CARGO:IsInLoadRadius(Coordinate)

Check if Cargo is in the LoadRadius for the Cargo to be Boarded or Loaded.

CARGO:IsInReportRadius(Coordinate)

Check if the Cargo can report itself to be Boarded or Loaded.

CARGO:IsInZone(Zone)

Check if Cargo is the given Zone.

CARGO:IsLoaded()

Check if cargo is loaded.

CARGO:IsLoadedInCarrier(Carrier)

Check if cargo is loaded.

CARGO:IsNear(Coordinate, NearRadius)

Check if CargoCarrier is near the coordinate within NearRadius.

CARGO:IsUnLoaded()

Check if cargo is unloaded.

CARGO:IsUnboarding()

Check if cargo is unboarding.

CARGO:Load(ToCarrier)

Loads the cargo to a Carrier.

CARGO.LoadRadius

CARGO:MessageToGroup(Message, CarrierGroup, Name)

Send a CC message to a Wrapper.Group.

CARGO.Moveable

This flag defines if the cargo is moveable.

CARGO.Name

A string defining the name of the cargo. The name is the unique identifier of the cargo.

CARGO.NearRadius

(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded.

CARGO:New(Type, Name, Weight, LoadRadius, NearRadius)

CARGO Constructor.

CARGO:OnEnterBoarding(Controllable, NearRadius)

CARGO:OnEnterLoaded(Controllable)

CARGO:OnEnterUnBoarding(Controllable)

CARGO:OnEnterUnLoaded(Controllable)

CARGO:OnLeaveBoarding(Controllable)

CARGO:OnLeaveLoaded(Controllable)

CARGO:OnLeaveUnBoarding(Controllable)

CARGO:OnLeaveUnLoaded(Controllable)

CARGO:Report(Action, CarrierGroup, ReportText)

Report to a Carrier Group.

CARGO:ReportFlare(FlareColor)

Report to a Carrier Group with a Flaring signal.

CARGO.ReportFlareColor

CARGO:ReportReset(Action, CarrierGroup)

Reset the reporting for a Carrier Group.

CARGO:ReportResetAll(CarrierGroup)

Reset all the reporting for a Carrier Group.

CARGO:ReportSmoke(SmokeColor)

Report to a Carrier Group with a Smoking signal.

CARGO.ReportSmokeColor

CARGO.Representable

This flag defines if the cargo can be represented by a DCS Unit.

CARGO:RespawnOnDestroyed(RespawnDestroyed)

Respawn the cargo when destroyed

CARGO:SetDeployed(Deployed)

Set the cargo as deployed.

CARGO:SetLoadRadius(LoadRadius)

Set the Load radius, which is the radius till when the Cargo can be loaded.

CARGO:SetVolume(Volume)

Set the volume of the cargo.

CARGO:SetWeight(Weight)

Set the weight of the cargo.

CARGO.Slingloadable

This flag defines if the cargo can be slingloaded.

CARGO:Smoke(SmokeColor, Radius)

Smoke the CARGO.

CARGO:SmokeBlue()

Smoke the CARGO Blue.

CARGO:SmokeGreen()

Smoke the CARGO Green.

CARGO:SmokeOrange()

Smoke the CARGO Orange.

CARGO:SmokeRed()

Smoke the CARGO Red.

CARGO:SmokeWhite()

Smoke the CARGO White.

CARGO:Spawn(PointVec2)

Template method to spawn a new representation of the CARGO in the simulator.

CARGO.Type

A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.

CARGO:UnBoard(ToPointVec2)

UnBoards the cargo to a Carrier.

CARGO:UnLoad(ToPointVec2)

UnLoads the cargo to a Carrier.

CARGO.Volume

CARGO.Weight

A number defining the weight of the cargo. The weight is expressed in kg.

CARGO:__Board(DelaySeconds, ToCarrier, NearRadius)

Boards the cargo to a Carrier.

CARGO:__Load(DelaySeconds, ToCarrier)

Loads the cargo to a Carrier.

CARGO:__UnBoard(DelaySeconds, ToPointVec2)

UnBoards the cargo to a Carrier.

CARGO:__UnLoad(DelaySeconds, ToPointVec2)

UnLoads the cargo to a Carrier.

CARGO:onenterDestroyed()

Fields and Methods inherited from FSM_PROCESS Description

CARGO:Assign(Task, ProcessUnit)

Assign the process to a Wrapper.Unit and activate the process.

CARGO:Copy(Controllable, Task)

Creates a new FSM_PROCESS object based on this FSM_PROCESS.

CARGO:GetCommandCenter()

Gets the mission of the process.

CARGO:GetMission()

Gets the mission of the process.

CARGO:GetTask()

Gets the task of the process.

CARGO:Init(FsmProcess)

CARGO:Message(Message)

Send a message of the Task to the Group of the Unit.

CARGO:New(Controllable, Task)

Creates a new FSM_PROCESS object.

CARGO:Remove()

Removes an FSM_PROCESS object.

CARGO:SetTask(Task)

Sets the task of the process.

CARGO.Task

CARGO:_call_handler(step, trigger, params, EventName)

CARGO:onenterFailed(ProcessUnit, Task, From, Event, To)

CARGO:onstatechange(ProcessUnit, Event, From, To, Task)

StateMachine callback function for a FSM_PROCESS

Fields and Methods inherited from FSM_CONTROLLABLE Description

CARGO.Controllable

CARGO:GetControllable()

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

CARGO:New(FSMT, Controllable)

Creates a new FSM_CONTROLLABLE object.

CARGO:OnAfterStop(Controllable, From, Event, To)

OnAfter Transition Handler for Event Stop.

CARGO:OnBeforeStop(Controllable, From, Event, To)

OnBefore Transition Handler for Event Stop.

CARGO:OnEnterStopped(Controllable, From, Event, To)

OnEnter Transition Handler for State Stopped.

CARGO:OnLeaveStopped(Controllable, From, Event, To)

OnLeave Transition Handler for State Stopped.

CARGO:SetControllable(FSMControllable)

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

CARGO:Stop()

Synchronous Event Trigger for Event Stop.

CARGO:__Stop(Delay)

Asynchronous Event Trigger for Event Stop.

CARGO:_call_handler(step, trigger, params, EventName)

Fields and Methods inherited from FSM Description

CARGO:AddEndState(State)

Adds an End state.

CARGO:AddProcess(From, Event, Process, ReturnEvents)

Set the default Process template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

CARGO:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

CARGO:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

CARGO:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

CARGO.CallScheduler

CARGO.Events

CARGO:GetCurrentState()

CARGO:GetEndStates()

Returns the End states.

CARGO:GetProcess(From, Event)

CARGO:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

CARGO:GetScores()

Returns a table with the scores defined.

CARGO:GetStartState()

Returns the start state of the FSM.

CARGO:GetState()

CARGO:GetSubs()

Returns a table with the Subs defined.

CARGO:GetTransitions()

Returns a table of the transition rules defined within the FSM.

CARGO:Is(State)

CARGO:LoadCallBacks(CallBackTable)

CARGO:New()

Creates a new FSM object.

CARGO.Scores

CARGO:SetProcess(From, Event, Fsm)

CARGO:SetStartState(State)

Sets the start state of the FSM.

CARGO._EndStates

CARGO._EventSchedules

CARGO._Processes

CARGO._Scores

CARGO._StartState

CARGO._Transitions

CARGO:_add_to_map(Map, Event)

CARGO:_call_handler(step, trigger, params, EventName)

CARGO:_create_transition(EventName)

CARGO:_delayed_transition(EventName)

CARGO:_eventmap(Events, EventStructure)

CARGO:_gosub(ParentFrom, ParentEvent)

CARGO:_handler(EventName, ...)

CARGO:_isendstate(Current)

CARGO:_submap(subs, sub, name)

CARGO:can(e)

CARGO:cannot(e)

CARGO.current

CARGO.endstates

CARGO:is(state)

CARGO.options

CARGO.subs

Fields and Methods inherited from BASE Description

CARGO.ClassID

The ID number of the class.

CARGO.ClassName

The name of the class.

CARGO.ClassNameAndID

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

CARGO:ClearState(Object, StateName)

Clear the state of an object.

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

Creation of a Birth Event.

CARGO:CreateEventCrash(EventTime, Initiator)

Creation of a Crash Event.

CARGO:CreateEventDead(EventTime, Initiator)

Creation of a Dead Event.

CARGO:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

CARGO:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

CARGO:E(Arguments)

Log an exception which will be traced always.

CARGO:EventDispatcher()

Returns the event dispatcher

CARGO:EventRemoveAll()

Remove all subscribed events

CARGO:F(Arguments)

Trace a function call.

CARGO:F2(Arguments)

Trace a function call level 2.

CARGO:F3(Arguments)

Trace a function call level 3.

CARGO:GetClassID()

Get the ClassID of the class instance.

CARGO:GetClassName()

Get the ClassName of the class instance.

CARGO:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

CARGO:GetEventPriority()

Get the Class Event processing Priority.

CARGO:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

CARGO:GetState(Object, Key)

Get a Value given a Key from the Object.

CARGO:HandleEvent(Event, EventFunction)

Subscribe to a DCS Event.

CARGO:I(Arguments)

Log an information which will be traced always.

CARGO:Inherit(Child, Parent)

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

CARGO:IsInstanceOf(ClassName)

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

CARGO:IsTrace()

Enquires if tracing is on (for the class).

CARGO:New()

BASE constructor.

CARGO:OnEvent(EventData)

Occurs when an object is completely destroyed.

CARGO:OnEventBaseCaptured(EventData)

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

CARGO:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

CARGO:OnEventCrash(EventData)

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

CARGO:OnEventDead(EventData)

Occurs when an object is dead.

CARGO:OnEventDetailedFailure(EventData)

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

CARGO:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft initiator : The unit that has ejected

CARGO:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

CARGO:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

CARGO:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

CARGO:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

CARGO:OnEventKill(EventData)

Occurs on the death of a unit.

CARGO:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship initiator : The unit that has landed place: Object that the unit landed on.

CARGO:OnEventLandingAfterEjection(EventData)

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

CARGO:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

CARGO:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

CARGO:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

CARGO:OnEventMissionEnd(EventData)

Occurs when a mission ends

CARGO:OnEventMissionStart(EventData)

Occurs when a mission starts

CARGO:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

CARGO:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

CARGO:OnEventPlayerLeaveUnit(EventData)

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

CARGO:OnEventRefueling(EventData)

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

CARGO:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

CARGO:OnEventScore(EventData)

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

CARGO:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

CARGO:OnEventShootingStart(EventData)

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

CARGO:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

CARGO:OnEventTakeoff(EventData)

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

CARGO:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

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

Schedule a new time event.

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

Schedule a new time event.

CARGO:ScheduleStop(SchedulerFunction)

Stops the Schedule.

CARGO.Scheduler

CARGO:SetEventPriority(EventPriority)

Set the Class Event processing Priority.

CARGO:SetState(Object, Key, Value)

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

CARGO:T(Arguments)

Trace a function logic level 1.

CARGO:T2(Arguments)

Trace a function logic level 2.

CARGO:T3(Arguments)

Trace a function logic level 3.

CARGO:TraceAll(TraceAll)

Trace all methods in MOOSE

CARGO:TraceClass(Class)

Set tracing for a class

CARGO:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

CARGO:TraceLevel(Level)

Set trace level

CARGO:TraceOff()

Set trace off.

CARGO:TraceOn()

Set trace on.

CARGO: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.

CARGO:UnHandleEvent(Event)

UnSubscribe to a DCS event.

CARGO._

CARGO:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

CARGO:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

CARGO.__

CARGO:onEvent(event)

Fields and Methods inherited from CARGO_REPORTABLE Description

CARGO_REPORTABLE.ClassName

CARGO_REPORTABLE:MessageToGroup(Message, TaskGroup, Name)

Send a CC message to a Wrapper.Group.

CARGO_REPORTABLE:New(Type, Name, Weight, LoadRadius, NearRadius)

CARGO_REPORTABLE Constructor.

Fields and Methods inherited from CARGO_REPRESENTABLE Description

CARGO_REPRESENTABLE:Destroy()

CARGO_REPRESENTABLE Destructor.

CARGO_REPRESENTABLE:MessageToGroup(Message, TaskGroup, Name)

Send a message to a Wrapper.Group through a communication channel near the cargo.

CARGO_REPRESENTABLE:New(Type, Name, LoadRadius, NearRadius, CargoObject)

CARGO_REPRESENTABLE Constructor.

CARGO_REPRESENTABLE:RouteTo(ToPointVec2, Speed)

Route a cargo unit to a PointVec2.

CARGO_REPRESENTABLE.test

Field(s)

Wrapper.Client#CLIENT CARGO.CargoCarrier

The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere...

Wrapper.Unit#UNIT CARGO.CargoObject

The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...

#boolean CARGO.Containable

This flag defines if the cargo can be contained within a DCS Unit.

#boolean CARGO.Moveable

This flag defines if the cargo is moveable.

#string CARGO.Name

A string defining the name of the cargo. The name is the unique identifier of the cargo.

#number CARGO.NearRadius

(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded.

#boolean CARGO.Representable

This flag defines if the cargo can be represented by a DCS Unit.

#boolean CARGO.Slingloadable

This flag defines if the cargo can be slingloaded.

#string CARGO.Type

A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.

#number CARGO.Weight

A number defining the weight of the cargo. The weight is expressed in kg.

Function(s)

Boards the cargo to a Carrier.

The event will create a movement (= running or driving) of the cargo to the Carrier. The cargo must be in the UnLoaded state.

Defined in:

CARGO

Parameters:

The Carrier that will hold the cargo.

#number NearRadius

The radius when the cargo will board the Carrier (to avoid collision).

Check if the cargo can be Boarded.

Defined in:

CARGO

Check if the cargo can be Loaded.

Defined in:

CARGO

Check if the cargo can be Slingloaded.

Defined in:

CARGO

Check if the cargo can be Unboarded.

Defined in:

CARGO

Check if the cargo can be Unloaded.

Defined in:

CARGO

Destroy the cargo.

Defined in:

CARGO

Find a CARGO in the _DATABASE.

Defined in:

CARGO

Parameter:

#string CargoName

The Cargo Name.

Return value:

self

Signal a flare at the position of the CARGO.

Defined in:

CARGO

Parameter:

Signal a green flare at the position of the CARGO.

Defined in:

CARGO

Signal a red flare at the position of the CARGO.

Defined in:

CARGO

Signal a white flare at the position of the CARGO.

Defined in:

CARGO

Signal a yellow flare at the position of the CARGO.

Defined in:

CARGO

Get the coalition of the Cargo.

Defined in:

CARGO

Return value:

Coalition

Get the current coordinates of the Cargo.

Defined in:

CARGO

Return value:

The coordinates of the Cargo.

Get the amount of Cargo.

Defined in:

CARGO

Return value:

#number:

The amount of Cargo.

Get the heading of the cargo.

Defined in:

CARGO

Return value:

#number:

Get the Load radius, which is the radius till when the Cargo can be loaded.

Defined in:

CARGO

Return value:

#number:

The radius till Cargo can be loaded.

Get the name of the Cargo.

Defined in:

CARGO

Return value:

#string:

The name of the Cargo.

Get the current active object representing or being the Cargo.

Defined in:

CARGO

Return value:

The object representing or being the Cargo.

Get the object name of the Cargo.

Defined in:

CARGO

Return value:

#string:

The object name of the Cargo.

Get the current PointVec2 of the cargo.

Defined in:

CARGO

Return value:

Get the transportation method of the Cargo.

Defined in:

CARGO

Return value:

#string:

The transportation method of the Cargo.

Get the type of the Cargo.

Defined in:

CARGO

Return value:

#string:

The type of the Cargo.

Get the volume of the cargo.

Defined in:

CARGO

Return value:

#number:

Volume The volume in kg.

Get the weight of the cargo.

Defined in:

CARGO

Return value:

#number:

Weight The weight in kg.

Get the x position of the cargo.

Defined in:

CARGO

Return value:

#number:

Get the y position of the cargo.

Defined in:

CARGO

Return value:

#number:

Check if cargo is alive.

Defined in:

CARGO

Return value:

#boolean:

true if unloaded

Check if cargo is boarding.

Defined in:

CARGO

Return value:

#boolean:

true if boarding

Is the cargo deployed

Defined in:

CARGO

Return value:

#boolean:

Check if cargo is destroyed.

Defined in:

CARGO

Return value:

#boolean:

true if destroyed

Check if Cargo is in the LoadRadius for the Cargo to be Boarded or Loaded.

Defined in:

CARGO

Parameter:

Return value:

#boolean:

true if the CargoGroup is within the loading radius.

Check if the Cargo can report itself to be Boarded or Loaded.

Defined in:

CARGO

Parameter:

Return value:

#boolean:

true if the Cargo can report itself.

Check if Cargo is the given Zone.

Defined in:

CARGO

Parameter:

Return value:

#boolean:

true if cargo is in the Zone, false if cargo is not in the Zone.

Check if cargo is loaded.

Defined in:

CARGO

Return value:

#boolean:

true if loaded

Check if cargo is loaded.

Defined in:

CARGO

Parameter:

Return value:

#boolean:

true if loaded

Check if CargoCarrier is near the coordinate within NearRadius.

Defined in:

CARGO

Parameters:

#number NearRadius

The radius when the cargo will board the Carrier (to avoid collision).

Return value:

#boolean:

Check if cargo is unloaded.

Defined in:

CARGO

Return value:

#boolean:

true if unloaded

Check if cargo is unboarding.

Defined in:

CARGO

Return value:

#boolean:

true if unboarding

Loads the cargo to a Carrier.

The event will load the cargo into the Carrier regardless of its position. There will be no movement simulated of the cargo loading. The cargo must be in the UnLoaded state.

Defined in:

CARGO

Parameter:

The Carrier that will hold the cargo.

Send a CC message to a Wrapper.Group.

Defined in:

CARGO

Parameters:

#string Message

Wrapper.Group#GROUP CarrierGroup

The Carrier Group.

#string Name

(optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.

CARGO Constructor.

This class is an abstract class and should not be instantiated.

Defined in:

CARGO

Parameters:

#string Type

#string Name

#number Weight

#number LoadRadius

(optional)

#number NearRadius

(optional)

Return value:

Defined in:

CARGO

Parameters:

#number NearRadius

The radius when the cargo will board the Carrier (to avoid collision).

Defined in:

CARGO

Parameter:

Defined in:

CARGO

Parameter:

Return value:

#boolean:

Defined in:

CARGO

Parameter:

Return value:

#boolean:

Defined in:

CARGO

Parameter:

Return value:

#boolean:

Defined in:

CARGO

Parameter:

Return value:

#boolean:

Report to a Carrier Group.

Defined in:

CARGO

Parameters:

#string Action

The string describing the action for the cargo.

Wrapper.Group#GROUP CarrierGroup

The Carrier Group to send the report to.

ReportText

Return value:

Report to a Carrier Group with a Flaring signal.

Defined in:

CARGO

Parameter:

the color of the flare.

Return value:

Reset the reporting for a Carrier Group.

Defined in:

CARGO

Parameters:

#string Action

The string describing the action for the cargo.

Wrapper.Group#GROUP CarrierGroup

The Carrier Group to send the report to.

Return value:

Reset all the reporting for a Carrier Group.

Defined in:

CARGO

Parameter:

Wrapper.Group#GROUP CarrierGroup

The Carrier Group to send the report to.

Return value:

Report to a Carrier Group with a Smoking signal.

Defined in:

CARGO

Parameter:

the color of the smoke.

Return value:

Respawn the cargo when destroyed

Defined in:

CARGO

Parameter:

#boolean RespawnDestroyed

Set the cargo as deployed.

Defined in:

CARGO

Parameter:

#boolean Deployed

true if the cargo is to be deployed. false or nil otherwise.

Set the Load radius, which is the radius till when the Cargo can be loaded.

Defined in:

CARGO

Parameter:

#number LoadRadius

The radius till Cargo can be loaded.

Return value:

Set the volume of the cargo.

Defined in:

CARGO

Parameter:

#number Volume

The volume in kg.

Return value:

Set the weight of the cargo.

Defined in:

CARGO

Parameter:

#number Weight

The weight in kg.

Return value:

Smoke the CARGO.

Defined in:

CARGO

Parameters:

The color of the smoke.

#number Radius

The radius of randomization around the center of the Cargo.

Smoke the CARGO Blue.

Defined in:

CARGO

Smoke the CARGO Green.

Defined in:

CARGO

Smoke the CARGO Orange.

Defined in:

CARGO

Smoke the CARGO Red.

Defined in:

CARGO

Smoke the CARGO White.

Defined in:

CARGO

Template method to spawn a new representation of the CARGO in the simulator.

Defined in:

CARGO

Parameter:

PointVec2

Return value:

UnBoards the cargo to a Carrier.

The event will create a movement (= running or driving) of the cargo from the Carrier. The cargo must be in the Loaded state.

Defined in:

CARGO

Parameter:

Core.Point#POINT_VEC2 ToPointVec2

(optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.

UnLoads the cargo to a Carrier.

The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading. The cargo must be in the Loaded state.

Defined in:

CARGO

Parameter:

Core.Point#POINT_VEC2 ToPointVec2

(optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.

Boards the cargo to a Carrier.

The event will create a movement (= running or driving) of the cargo to the Carrier. The cargo must be in the UnLoaded state.

Defined in:

CARGO

Parameters:

#number DelaySeconds

The amount of seconds to delay the action.

The Carrier that will hold the cargo.

#number NearRadius

The radius when the cargo will board the Carrier (to avoid collision).

Loads the cargo to a Carrier.

The event will load the cargo into the Carrier regardless of its position. There will be no movement simulated of the cargo loading. The cargo must be in the UnLoaded state.

Defined in:

CARGO

Parameters:

#number DelaySeconds

The amount of seconds to delay the action.

The Carrier that will hold the cargo.

UnBoards the cargo to a Carrier.

The event will create a movement (= running or driving) of the cargo from the Carrier. The cargo must be in the Loaded state.

Defined in:

CARGO

Parameters:

#number DelaySeconds

The amount of seconds to delay the action.

Core.Point#POINT_VEC2 ToPointVec2

(optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.

UnLoads the cargo to a Carrier.

The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading. The cargo must be in the Loaded state.

Defined in:

CARGO

Parameters:

#number DelaySeconds

The amount of seconds to delay the action.

Core.Point#POINT_VEC2 ToPointVec2

(optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.

Defined in:

CARGO

Field(s)

Wrapper.Client#CLIENT CARGO.CargoCarrier

The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere...

Wrapper.Unit#UNIT CARGO.CargoObject

The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...

#boolean CARGO.Containable

This flag defines if the cargo can be contained within a DCS Unit.

#boolean CARGO.Moveable

This flag defines if the cargo is moveable.

#string CARGO.Name

A string defining the name of the cargo. The name is the unique identifier of the cargo.

#number CARGO.NearRadius

(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded.

#boolean CARGO.Representable

This flag defines if the cargo can be represented by a DCS Unit.

#boolean CARGO.Slingloadable

This flag defines if the cargo can be slingloaded.

#string CARGO.Type

A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.

#number CARGO.Weight

A number defining the weight of the cargo. The weight is expressed in kg.

Function(s)

Assign the process to a Wrapper.Unit and activate the process.

Defined in:

Parameters:

Wrapper.Unit#UNIT ProcessUnit

Return value:

self

Creates a new FSM_PROCESS object based on this FSM_PROCESS.

Defined in:

Parameters:

Controllable

Task

Return value:

Gets the mission of the process.

Gets the mission of the process.

Defined in:

Return value:

Gets the task of the process.

Defined in:

Return value:

Defined in:

Parameter:

FsmProcess

Send a message of the Task to the Group of the Unit.

Defined in:

Parameter:

Message

Creates a new FSM_PROCESS object.

Defined in:

Parameters:

Controllable

Task

Return value:

Removes an FSM_PROCESS object.

Defined in:

Return value:

Sets the task of the process.

Defined in:

Parameter:

Return value:

Defined in:

Parameters:

step

trigger

params

EventName

Defined in:

Parameters:

ProcessUnit

Task

From

Event

To

StateMachine callback function for a FSM_PROCESS

Defined in:

Parameters:

#string Event

#string From

#string To

Task

Field(s)

Wrapper.Client#CLIENT CARGO.CargoCarrier

The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere...

Wrapper.Unit#UNIT CARGO.CargoObject

The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...

#boolean CARGO.Containable

This flag defines if the cargo can be contained within a DCS Unit.

#boolean CARGO.Moveable

This flag defines if the cargo is moveable.

#string CARGO.Name

A string defining the name of the cargo. The name is the unique identifier of the cargo.

#number CARGO.NearRadius

(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded.

#boolean CARGO.Representable

This flag defines if the cargo can be represented by a DCS Unit.

#boolean CARGO.Slingloadable

This flag defines if the cargo can be slingloaded.

#string CARGO.Type

A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.

#number CARGO.Weight

A number defining the weight of the cargo. The weight is expressed in kg.

Function(s)

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Creates a new FSM_CONTROLLABLE object.

Defined in:

Parameters:

#table FSMT

Finite State Machine Table

(optional) The CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Return value:

OnAfter Transition Handler for Event Stop.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnBefore Transition Handler for Event Stop.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnEnter Transition Handler for State Stopped.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnLeave Transition Handler for State Stopped.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Defined in:

Parameter:

Return value:

Synchronous Event Trigger for Event Stop.

Asynchronous Event Trigger for Event Stop.

Defined in:

Parameter:

#number Delay

The delay in seconds.

Defined in:

Parameters:

step

trigger

params

EventName

Field(s)

Wrapper.Client#CLIENT CARGO.CargoCarrier

The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere...

Wrapper.Unit#UNIT CARGO.CargoObject

The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...

#boolean CARGO.Containable

This flag defines if the cargo can be contained within a DCS Unit.

#boolean CARGO.Moveable

This flag defines if the cargo is moveable.

#string CARGO.Name

A string defining the name of the cargo. The name is the unique identifier of the cargo.

#number CARGO.NearRadius

(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded.

#boolean CARGO.Representable

This flag defines if the cargo can be represented by a DCS Unit.

#boolean CARGO.Slingloadable

This flag defines if the cargo can be slingloaded.

#string CARGO.Type

A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.

#number CARGO.Weight

A number defining the weight of the cargo. The weight is expressed in kg.

Function(s)

Adds an End state.

Defined in:

Parameter:

State

Set the default 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.

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.

Returns the End states.

Defined in:

Defined in:

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

Return value:

#table:

Returns a table with the scores defined.

Defined in:

Returns the start state of the FSM.

Defined in:

Return value:

#string:

A string containing the start state.

Returns a table with the Subs defined.

Defined in:

Returns a table of the transition rules defined within the FSM.

Defined in:

Return value:

#table:

Defined in:

Parameter:

State

Defined in:

Parameter:

CallBackTable

Creates a new FSM object.

Defined in:

Return value:

#FSM:

Defined in:

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

Parameter:

#string State

A string defining the start state.

Defined in:

Parameters:

Map

Event

Defined in:

Parameters:

step

trigger

params

EventName

Defined in:

Parameter:

EventName

Defined in:

Parameter:

EventName

Defined in:

Parameters:

Events

EventStructure

Defined in:

Parameters:

ParentFrom

ParentEvent

Defined in:

Parameters:

EventName

...

Defined in:

Parameter:

Current

Defined in:

Parameters:

subs

sub

name

Defined in:

Parameter:

e

Defined in:

Parameter:

e

Defined in:

Parameter:

state

Field(s)

Wrapper.Client#CLIENT CARGO.CargoCarrier

The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere...

Wrapper.Unit#UNIT CARGO.CargoObject

The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...

#boolean CARGO.Containable

This flag defines if the cargo can be contained within a DCS Unit.

#boolean CARGO.Moveable

This flag defines if the cargo is moveable.

#string CARGO.Name

A string defining the name of the cargo. The name is the unique identifier of the cargo.

#number CARGO.NearRadius

(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded.

#boolean CARGO.Representable

This flag defines if the cargo can be represented by a DCS Unit.

#boolean CARGO.Slingloadable

This flag defines if the cargo can be slingloaded.

#string CARGO.Type

A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.

#number CARGO.Weight

A number defining the weight of the cargo. The weight is expressed in kg.

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.

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.

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.

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 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 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, nillified 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:

#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 object is completely destroyed.

initiator : The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

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

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.

initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

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

initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

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.

Occurs when a pilot ejects from an aircraft initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

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.

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.

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

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

Occurs when a new mark was added.

MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts

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. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

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.

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.

initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

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.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. 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. 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.

Defined in:

Parameter:

The EventData structure.

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

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.

Occurs when the game thinks an object is destroyed.

  • 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:

#number:

The ScheduleID 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:

#number:

The ScheduleID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

Set the Class 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 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, nillified 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

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

#string 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:

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

TODO: Complete DCS#Event structure.
- The main event handling function... This function captures all events generated for the class. @param #BASE self @param DCS#Event event

Defined in:

Parameter:

event

Field(s)

Function(s)

Check if CargoCarrier is near the Cargo to be Loaded.

Defined in:

CARGO_PACKAGE

Parameter:

Wrapper.Unit#UNIT CargoCarrier

Return value:

#boolean:

CARGO_PACKAGE Constructor.

Defined in:

CARGO_PACKAGE

Parameters:

Wrapper.Unit#UNIT CargoCarrier

The UNIT carrying the package.

#string Type

#string Name

#number Weight

#number LoadRadius

(optional)

#number NearRadius

(optional)

Return value:

Load Event.

Defined in:

CARGO_PACKAGE

Parameters:

#string Event

#string From

#string To

Wrapper.Unit#UNIT CargoCarrier

#number Speed

#number LoadDistance

#number Angle

Board Event.

Defined in:

CARGO_PACKAGE

Parameters:

#string Event

#string From

#string To

Wrapper.Unit#UNIT CargoCarrier

#number Speed

#number BoardDistance

#number Angle

LoadDistance

Boarded Event.

Defined in:

CARGO_PACKAGE

Parameters:

#string Event

#string From

#string To

Wrapper.Unit#UNIT CargoCarrier

#number Speed

#number BoardDistance

#number LoadDistance

#number Angle

UnBoard Event.

Defined in:

CARGO_PACKAGE

Parameters:

#string Event

#string From

#string To

Wrapper.Unit#UNIT CargoCarrier

#number Speed

#number UnLoadDistance

#number UnBoardDistance

#number Radius

#number Angle

UnBoarded Event.

Defined in:

CARGO_PACKAGE

Parameters:

#string Event

#string From

#string To

Wrapper.Unit#UNIT CargoCarrier

#number Speed

UnLoad Event.

Defined in:

CARGO_PACKAGE

Parameters:

#string Event

#string From

#string To

Wrapper.Unit#UNIT CargoCarrier

#number Speed

#number Distance

#number Angle

Field(s)

Function(s)

Send a CC message to a Wrapper.Group.

Defined in:

CARGO_REPORTABLE

Parameters:

#string Message

#string Name

(optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.

CARGO_REPORTABLE Constructor.

Defined in:

CARGO_REPORTABLE

Parameters:

#string Type

#string Name

#number Weight

#number LoadRadius

(optional)

#number NearRadius

(optional)

Return value:

Field(s)

Function(s)

CARGO_REPRESENTABLE Destructor.

Defined in:

CARGO_REPRESENTABLE

Return value:

Send a message to a Wrapper.Group through a communication channel near the cargo.

Defined in:

CARGO_REPRESENTABLE

Parameters:

#string Message

#string Name

(optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.

CARGO_REPRESENTABLE Constructor.

Defined in:

CARGO_REPRESENTABLE

Parameters:

#string Type

#string Name

#number LoadRadius

(optional)

#number NearRadius

(optional)

CargoObject

Return value:

Route a cargo unit to a PointVec2.

Defined in:

CARGO_REPRESENTABLE

Parameters:

Core.Point#POINT_VEC2 ToPointVec2

#number Speed

Return value: