Banner Image

Module AI.AI_Cargo_Ship

AI - Models the intelligent transportation of infantry and other cargo.


Author: acrojason (derived from AI_Cargo_APC by FlightControl)


Global(s)

Global AI_CARGO_SHIP

Brings a dynamic cargo handling capability for an AI naval group.

#AI_CARGO_SHIP AI_CARGO_SHIP

Brings a dynamic cargo handling capability for an AI naval group.

Naval ships can be utilized to transport cargo around the map following naval shipping lanes. The AI_CARGO_SHIP class uses the Cargo.Cargo capabilities within the MOOSE framework. Cargo.Cargo must be declared within the mission or warehouse to make the AI_CARGO_SHIP recognize the cargo. Please consult the Cargo.Cargo module for more information.

Cargo loading.

The module will automatically load cargo when the Ship is within boarding or loading radius. The boarding or loading radius is specified when the cargo is created in the simulation and depends on the type of cargo and the specified boarding radius.

Defending the Ship when enemies are nearby

This is not supported for naval cargo because most tanks don't float. Protect your transports...

Infantry or cargo health.

When cargo is unboarded from the Ship, the cargo is actually respawned into the battlefield. As a result, the unboarding cargo is very healthy every time it unboards. This is due to the limitation of the DCS simulator, which is not able to specify the health of newly spawned units as a parameter. However, cargo that was destroyed when unboarded and following the Ship won't be respawned again (this is likely not a thing for naval cargo due to the lack of support for defending the Ship mentioned above). Destroyed is destroyed. As a result, there is some additional strength that is gained when an unboarding action happens, but in terms of simulation balance this has marginal impact on the overall battlefield simulation. Given the relatively short duration of DCS missions and the somewhat lengthy naval transport times, most units entering the Ship as cargo will be freshly en route to an amphibious landing or transporting between warehouses.

Control the Ships on the map.

Currently, naval transports can only be controlled via scripts due to their reliance upon predefined Shipping Lanes created in the Mission Editor. An interesting future enhancement could leverage new pathfinding functionality for ships in the Ops module.

Cargo deployment.

Using the AI_CARGO_SHIP.Deploy() method, you are able to direct the Ship towards a Deploy zone to unboard/unload the cargo at the specified coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.

Cargo pickup.

Using the AI_CARGO_SHIP.Pickup() method, you are able to direct the Ship towards a Pickup zone to board/load the cargo at the specified coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.

Developer Note

Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE Therefore, this class is considered to be deprecated

Type(s)

Fields and Methods inherited from AI_CARGO Description

AI_CARGO_SHIP.CargoCarrier

AI_CARGO_SHIP.CargoSet

AI_CARGO_SHIP.Carrier_Cargo

AI_CARGO_SHIP:Deploy(Coordinate, Speed)

Deploy Trigger for AI_CARGO

AI_CARGO_SHIP:IsRelocating()

AI_CARGO_SHIP:IsTransporting()

AI_CARGO_SHIP:New(Carrier, CargoSet)

Creates a new AI_CARGO object.

AI_CARGO_SHIP:OnAfterDeploy(From, Event, To, Coordinate, Speed)

Deploy Handler OnAfter for AI_CARGO

AI_CARGO_SHIP:OnAfterDeployed(Carrier, From, Event, To, DeployZone, Defend)

On after Deployed event.

AI_CARGO_SHIP:OnAfterLoaded(Carrier, From, Event, To)

Loaded Handler OnAfter for AI_CARGO

AI_CARGO_SHIP:OnAfterPickup(From, Event, To, Coordinate, Speed)

Pickup Handler OnAfter for AI_CARGO

AI_CARGO_SHIP:OnAfterUnloaded(Carrier, From, Event, To)

Unloaded Handler OnAfter for AI_CARGO

AI_CARGO_SHIP:OnBeforeDeploy(From, Event, To, Coordinate, Speed)

Deploy Handler OnBefore for AI_CARGO

AI_CARGO_SHIP:OnBeforePickup(From, Event, To, Coordinate, Speed)

Pickup Handler OnBefore for AI_CARGO

AI_CARGO_SHIP:Pickup(Coordinate, Speed)

Pickup Trigger for AI_CARGO

AI_CARGO_SHIP.Relocating

AI_CARGO_SHIP.Transporting

AI_CARGO_SHIP:__Deploy(Delay, Coordinate, Speed)

Deploy Asynchronous Trigger for AI_CARGO

AI_CARGO_SHIP:__Pickup(Delay, Coordinate, Speed)

Pickup Asynchronous Trigger for AI_CARGO

AI_CARGO_SHIP:onafterBoard(Carrier, From, Event, To, Cargo, CarrierUnit, PickupZone)

On after Board event.

AI_CARGO_SHIP:onafterDeploy(APC, From, Event, To, Coordinate, Speed, Height, DeployZone)

On after Deploy event.

AI_CARGO_SHIP:onafterDeployed(Carrier, From, Event, To, DeployZone, Defend)

On after Deployed event.

AI_CARGO_SHIP:onafterLoaded(Carrier, From, Event, To, PickupZone, Cargo)

On after Loaded event.

AI_CARGO_SHIP:onafterPickedUp(Carrier, From, Event, To, PickupZone)

On after PickedUp event.

AI_CARGO_SHIP:onafterPickup(APC, From, Event, To, Coordinate, Speed, Height, PickupZone)

On after Pickup event.

AI_CARGO_SHIP:onafterUnboard(Carrier, From, Event, To, Cargo, DeployZone, CarrierUnit, Defend)

On after Unboard event.

AI_CARGO_SHIP:onafterUnload(Carrier, From, Event, To, DeployZone, Defend)

On after Unload event.

AI_CARGO_SHIP:onafterUnloaded(Carrier, From, Event, To, Cargo, Deployed, DeployZone, CarrierUnit, Defend)

On after Unloaded event.

AI_CARGO_SHIP:onbeforeLoad(Carrier, From, Event, To, PickupZone)

On before Load event.

AI_CARGO_SHIP:onbeforeReload(Carrier, From, Event, To, PickupZone)

On before Reload event.

Field(s)

Function(s)

FInd a free Carrier within a radius

Defined in:

AI_CARGO_SHIP

Parameters:

#number Radius

Return value:

NewCarrier

Follow Infantry to the Carrier

Defined in:

AI_CARGO_SHIP

Parameters:

CargoGroup

Return value:

Creates a new AI_CARGO_SHIP object.

Defined in:

AI_CARGO_SHIP

Parameters:

The carrier Ship group

The set of cargo to be transported

#number CombatRadius

Provide the combat radius to defend the carrier by unboarding the cargo when enemies are nearby. When CombatRadius is 0, no defense will occur.

#table ShippingLane

Table containing list of Shipping Lanes to be used

Return value:

Set the Carrier

Defined in:

AI_CARGO_SHIP

Parameter:

Wrapper.Group#GROUP CargoCarrier

Return value:

Defined in:

AI_CARGO_SHIP

Parameter:

CombatRadius

Defined in:

AI_CARGO_SHIP

Parameter:

ShippingLane

Check if cargo ship is alive and trigger Unload event.

Good time to remind people that Lua is case sensitive and Unload != UnLoad

Defined in:

AI_CARGO_SHIP

Parameters:

Coordinate

DeployZone

Check if cargo ship is alive and trigger Load event

Defined in:

AI_CARGO_SHIP

Parameters:

Coordinate

Speed

PickupZone

On after Deploy event.

Defined in:

AI_CARGO_SHIP

Parameters:

From

Event

To

Coordinate of the deploy point

#number Speed

Speed in km/h to sail to the deploy coordinate. Default is 50% of max speed for the unit

#number Height

Altitude in meters to move to the deploy coordinate. This parameter is ignored for Ships

Core.Zone#ZONE DeployZone

The zone where the cargo will be deployed.

Ship

Defined in:

AI_CARGO_SHIP

Parameters:

Ship

From

Event

To

Coordinate

Speed

Height

HomeZone

Defined in:

AI_CARGO_SHIP

Parameters:

Ship

From

Event

To

on after Pickup event.

Defined in:

AI_CARGO_SHIP

Parameters:

AI_CARGO_SHIP

Ship

From

Event

To

of the pickup point

#number Speed

Speed in km/h to sail to the pickup coordinate. Default is 50% of max speed for the unit

#number Height

Altitude in meters to move to the pickup coordinate. This parameter is ignored for Ships

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil if there was no PickupZoneSet provided

self

Ship

On after Unload event.

Defined in:

AI_CARGO_SHIP

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

Defend

Field(s)

Function(s)

Deploy Trigger for AI_CARGO

Defined in:

Parameters:

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Creates a new AI_CARGO object.

Defined in:

Parameters:

Cargo carrier group.

Set of cargo(s) to transport.

Return value:

self

Deploy Handler OnAfter for AI_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

On after Deployed event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

#boolean Defend

Defend for APCs.

Loaded Handler OnAfter for AI_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

Pickup Handler OnAfter for AI_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Unloaded Handler OnAfter for AI_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

Deploy Handler OnBefore for AI_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Return value:

#boolean:

Pickup Handler OnBefore for AI_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Return value:

#boolean:

Pickup Trigger for AI_CARGO

Defined in:

Parameters:

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Deploy Asynchronous Trigger for AI_CARGO

Defined in:

Parameters:

#number Delay

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Pickup Asynchronous Trigger for AI_CARGO

Defined in:

Parameters:

#number Delay

Pickup place. If not given, loading starts at the current location.

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

On after Board event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Cargo object.

Wrapper.Unit#UNIT CarrierUnit

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On after Deploy event.

Defined in:

Parameters:

From

Event

To

Deploy place.

#number Speed

Speed in km/h to drive to the depoly coordinate. Default is 50% of max possible speed the unit can go.

#number Height

Height in meters to move to the deploy coordinate.

Core.Zone#ZONE DeployZone

The zone where the cargo will be deployed.

On after Deployed event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

#boolean Defend

Defend for APCs.

On after Loaded event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

Cargo

Return value:

#boolean:

Cargo loaded.

On after PickedUp event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On after Pickup event.

Defined in:

Parameters:

From

Event

To

of the pickup point.

#number Speed

Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.

#number Height

Height in meters to move to the home coordinate.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On after Unboard event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

#string Cargo

Cargo#CARGO Cargo Cargo object.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

CarrierUnit

Defend

On after Unload event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

Defend

On after Unloaded event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

#string Cargo

Cargo#CARGO Cargo Cargo object.

#boolean Deployed

Cargo is deployed.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

CarrierUnit

Defend

On before Load event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On before Reload event.

Defined in:

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.