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. |
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_SHIP | Description |
---|---|
FInd a free Carrier within a radius |
|
AI_CARGO_SHIP:FollowToCarrier(Me, ShipUnit, Cargo, CargoGroup) |
Follow Infantry to the Carrier |
AI_CARGO_SHIP:New(Ship, CargoSet, CombatRadius, ShippingLane) |
Creates a new AI_CARGO_SHIP object. |
Set the Carrier |
|
Check if cargo ship is alive and trigger Unload event. |
|
AI_CARGO_SHIP._Pickup(Ship, self, Coordinate, Speed, PickupZone) |
Check if cargo ship is alive and trigger Load event |
AI_CARGO_SHIP:onafterDeploy(SHIP, From, Event, To, Coordinate, Speed, Height, DeployZone, Ship) |
On after Deploy event. |
AI_CARGO_SHIP:onafterHome(Ship, From, Event, To, Coordinate, Speed, Height, HomeZone) |
|
on after Pickup event. |
|
AI_CARGO_SHIP:onafterUnload(Ship, From, Event, To, DeployZone, Defend) |
On after Unload event. |
Field(s)
Function(s)
FInd a free Carrier within a radius
Defined in:
AI_CARGO_SHIP
Parameters:
Core.Point#COORDINATE Coordinate
#number Radius
Return value:
NewCarrier
Follow Infantry to the Carrier
Creates a new AI_CARGO_SHIP object.
Defined in:
AI_CARGO_SHIP
Parameters:
Wrapper.Group#GROUP Ship
The carrier Ship group
Core.Set#SET_CARGO CargoSet
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:
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:
Wrapper.Group#GROUP Ship
#AI_CARGO_SHIP self
Coordinate
DeployZone
Check if cargo ship is alive and trigger Load event
Defined in:
AI_CARGO_SHIP
Parameters:
Wrapper.Group#Group Ship
#AI_CARGO_SHIP self
Coordinate
Speed
PickupZone
On after Deploy event.
Defined in:
AI_CARGO_SHIP
Parameters:
Wrapper.Group#GROUP SHIP
From
Event
To
Core.Point#COORDINATE Coordinate
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
Core.Point#COORDINATE Coordinate
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:
Wrapper.Group#GROUP Ship
#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:
Core.Point#COORDINATE Coordinate
#number Speed
Speed in km/h. Default is 50% of max possible speed the group can do.
Defined in:
Defined in:
Creates a new AI_CARGO object.
Defined in:
Parameters:
Wrapper.Group#GROUP Carrier
Cargo carrier group.
Core.Set#SET_CARGO CargoSet
Set of cargo(s) to transport.
Return value:
self
Deploy Handler OnAfter for AI_CARGO
Defined in:
Parameters:
#string From
#string Event
#string To
Core.Point#COORDINATE Coordinate
#number Speed
Speed in km/h. Default is 50% of max possible speed the group can do.
On after Deployed event.
Defined in:
Parameters:
Wrapper.Group#GROUP Carrier
#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
Pickup Handler OnAfter for AI_CARGO
Defined in:
Parameters:
#string From
#string Event
#string To
Core.Point#COORDINATE Coordinate
#number Speed
Speed in km/h. Default is 50% of max possible speed the group can do.
Unloaded Handler OnAfter for AI_CARGO
Deploy Handler OnBefore for AI_CARGO
Defined in:
Parameters:
#string From
#string Event
#string To
Core.Point#COORDINATE Coordinate
#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
Core.Point#COORDINATE Coordinate
#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:
Core.Point#COORDINATE Coordinate
#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
Core.Point#COORDINATE Coordinate
#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
Core.Point#COORDINATE Coordinate
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:
Wrapper.Group#GROUP Carrier
#string From
From state.
#string Event
Event.
#string To
To state.
Cargo.Cargo#CARGO Cargo
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
Core.Point#COORDINATE Coordinate
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:
Wrapper.Group#GROUP Carrier
#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:
Wrapper.Group#GROUP Carrier
#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:
Wrapper.Group#GROUP Carrier
#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
Core.Point#COORDINATE Coordinate
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:
Wrapper.Group#GROUP Carrier
#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:
Wrapper.Group#GROUP Carrier
#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:
Wrapper.Group#GROUP Carrier
#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:
Wrapper.Group#GROUP Carrier
#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:
Wrapper.Group#GROUP Carrier
#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.