Module Functional.Warehouse
Functional - Simulation of logistic operations.
Features:
- Holds (virtual) assets in stock and spawns them upon request.
- Manages requests of assets from other warehouses.
- Queueing system with optional prioritization of requests.
- Realistic transportation of assets between warehouses.
- Different means of automatic transportation (planes, helicopters, APCs, self propelled).
- Strategic components such as capturing, defending and destroying warehouses and their associated infrastructure.
- Intelligent spawning of aircraft on airports (only if enough parking spots are available).
- Possibility to hook into events and customize actions.
- Persistence of assets. Warehouse assets can be saved and loaded from file.
- Can be easily interfaced to other MOOSE classes.
Youtube Videos:
Missions:
The MOOSE warehouse concept simulates the organization and implementation of complex operations regarding the flow of assets between the point of origin and the point of consumption in order to meet requirements of a potential conflict. In particular, this class is concerned with maintaining army supply lines while disrupting those of the enemy, since an armed force without resources and transportation is defenseless.
Author: funkyfranky
Co-author: FlightControl (cargo dispatcher classes)
Global(s)
Global WAREHOUSE |
Have your assets at the right place at the right time - or not! The Warehouse ConceptThe MOOSE warehouse adds a new logistic component to the DCS World. |
Have your assets at the right place at the right time - or not!
The Warehouse Concept
The MOOSE warehouse adds a new logistic component to the DCS World.
Assets, i.e. ground, airborne and naval units, can be transferred from one place to another in a realistic and highly automatic fashion. In contrast to a "DCS warehouse" these assets have a physical representation in game. In particular, this means they can be destroyed during the transport and add more life to the DCS world.
This comes along with some additional interesting strategic aspects since capturing/defending and destroying/protecting an enemy or your own warehouse becomes of critical importance for the development of a conflict.
In essence, creating an efficient network of warehouses is vital for the success of a battle or even the whole war. Likewise, of course, cutting off the enemy of important supply lines by capturing or destroying warehouses or their associated infrastructure is equally important.
What is a warehouse?
A warehouse is an abstract object represented by a physical (static) building that can hold virtual assets in stock. It can (but it must not) be associated with a particular airbase. The associated airbase can be an airdrome, a Helipad/FARP or a ship.
If another warehouse requests assets, the corresponding troops are spawned at the warehouse and being transported to the requestor or go their by themselfs. Once arrived at the requesting warehouse, the assets go into the stock of the requestor and can be activated/deployed when necessary.
What assets can be stored?
Any kind of ground, airborne or naval asset can be stored and are spawned upon request. The fact that the assets live only virtually in stock and are put into the game only when needed has a positive impact on the game performance. It also alliviates the problem of limited parking spots at smaller airbases.
What means of transportation are available?
Firstly, all mobile assets can be send from warehouse to another on their own.
- Ground vehicles will use the road infrastructure. So a good road connection for both warehouses is important but also off road connections can be added if necessary.
- Airborne units get a flightplan from the airbase of the sending warehouse to the airbase of the receiving warehouse. This already implies that for airborne assets both warehouses need an airbase. If either one of the warehouses does not have an associated airbase, direct transportation of airborne assets is not possible.
- Naval units can be exchanged between warehouses which possess a port, which can be defined by the user. Also shipping lanes must be specified manually but the user since DCS does not provide these.
- Trains (would) use the available railroad infrastructure and both warehouses must have a connection to the railroad. Unfortunately, however, trains are not yet implemented to a reasonable degree in DCS at the moment and hence cannot be used yet.
Furthermore, ground assets can be transferred between warehouses by transport units. These are APCs, helicopters and airplanes. The transportation process is modeled in a realistic way by using the corresponding cargo dispatcher classes, i.e.
- AI.AI_Cargo_Dispatcher_APC#AI_DISPATCHER_APC
- AI.AI_Cargo_Dispatcher_Helicopter#AI_DISPATCHER_HELICOPTER
- AI.AI_Cargo_Dispatcher_Airplane#AI_DISPATCHER_AIRPLANE
Depending on which cargo dispatcher is used (ground or airbore), similar considerations like in the self propelled case are necessary. Howver, note that the dispatchers as of yet cannot use user defined off road paths for example since they are classes of their own and use a different routing logic.
Creating a Warehouse
A MOOSE warehouse must be represented in game by a physical static object. For example, the mission editor already has warehouse as static object available. This would be a good first choice but any static object will do.
The positioning of the warehouse static object is very important for a couple of reasons. Firstly, a warehouse needs a good infrastructure so that spawned assets have a proper road connection or can reach the associated airbase easily.
Constructor and Start
Once the static warehouse object is placed in the mission editor it can be used as a MOOSE warehouse by the WAREHOUSE.New(warehousestatic, alias) constructor, like for example:
warehouseBatumi=WAREHOUSE:New(STATIC:FindByName("Warehouse Batumi"), "My optional Warehouse Alias")
warehouseBatumi:Start()
The first parameter warehousestatic is the static MOOSE object. By default, the name of the warehouse will be the same as the name given to the static object. The second parameter alias is optional and can be used to choose a more convenient name if desired. This will be the name the warehouse calls itself when reporting messages.
Note that a warehouse also needs to be started in order to be in service. This is done with the WAREHOUSE.Start() or WAREHOUSE.__Start(delay) functions. The warehouse is now fully operational and requests are being processed.
Adding Assets
Assets can be added to the warehouse stock by using the WAREHOUSE.AddAsset(group, ngroups, forceattribute, forcecargobay, forceweight, loadradius, skill, liveries, assignment) function. The parameter group has to be a MOOSE Wrapper.Group#GROUP. This is also the only mandatory parameters. All other parameters are optional and can be used for fine tuning if nessary. The parameter ngroups specifies how many clones of this group are added to the stock.
infrantry=GROUP:FindByName("Some Infantry Group")
warehouseBatumi:AddAsset(infantry, 5)
This will add five infantry groups to the warehouse stock. Note that the group should normally be a late activated template group, which was defined in the mission editor. But you can also add other groups which are already spawned and present in the mission.
Also note that the coalition of the template group (red, blue or neutral) does not matter. The coalition of the assets is determined by the coalition of the warehouse owner. In other words, it is no problem to add red groups to blue warehouses and vice versa. The assets will automatically have the coalition of the warehouse.
You can add assets with a delay by using the WAREHOUSE.__AddAsset(delay, group, ngroups, forceattribute, forcecargobay, forceweight, loadradius, skill, liveries, assignment), where delay is the delay in seconds before the asset is added.
In game, the warehouse will get a mark which is regularly updated and showing the currently available assets in stock.
Optional Parameters for Fine Tuning
By default, the generalized attribute of the asset is determined automatically from the DCS descriptor attributes. However, this might not always result in the desired outcome. Therefore, it is possible, to force a generalized attribute for the asset with the third optional parameter forceattribute, which is of type WAREHOUSE.Attribute.
Setting the Generalized Attibute
For example, a UH-1H Huey has in DCS the attibute of an attack helicopter. But of course, it can also transport cargo. If you want to use it for transportation, you can specify this manually when the asset is added
warehouseBatumi:AddAsset("Huey", 5, WAREHOUSE.Attribute.AIR_TRANSPORTHELO)
This becomes important when assets are requested from other warehouses as described below. In this case, the five Hueys are now marked as transport helicopters and not attack helicopters. This is also particularly useful when adding assets to a warehouse with the intention of using them to transport other units that are part of a subsequent request (see below). Setting the attribute will help to ensure that warehouse module can find the correct unit when attempting to service a request in its queue. For example, if we want to add an Amphibious Landing Ship, even though most are indeed armed, it's recommended to do the following:
warehouseBatumi:AddAsset("Landing Ship", 1, WAREHOUSE.Attribute.NAVAL_UNARMEDSHIP)
Then when adding the request, you can simply specify WAREHOUSE.TransportType.SHIP (which corresponds to NAVAL_UNARMEDSHIP) as the TransportType.
Setting the Cargo Bay Weight Limit
You can ajust the cargo bay weight limit, in case it is not calculated correctly automatically. For example, the cargo bay of a C-17A is much smaller in DCS than that of a C-130, which is unrealistic. This can be corrected by the forcecargobay parmeter which is here set to 77,000 kg
warehouseBatumi:AddAsset("C-17A", nil, nil, 77000)
The size of the cargo bay is only important when the group is used as transport carrier for other assets.
Setting the Weight
If an asset shall be transported by a carrier it important to note that - as in real life - a carrier can only carry cargo up to a certain weight. The weight of the units is automatically determined from the DCS descriptor table. However, in the current DCS version (2.5.3) a mortar unit has a weight of 5 tons. This confuses the transporter logic, because it appears to be too have for, e.g. all APCs.
As a workaround, you can manually adjust the weight by the optional forceweight parameter:
warehouseBatumi:AddAsset("Mortar Alpha", nil, nil, nil, 210)
In this case we set it to 210 kg. Note, the weight value set is meant for each unit in the group. Therefore, a group consisting of three mortars will have a total weight of 630 kg. This is important as groups cannot be split between carrier units when transporting, i.e. the total weight of the whole group must be smaller than the cargo bay of the transport carrier.
Setting the Load Radius
Boading and loading of cargo into a carrier is modeled in a realistic fashion in the AI_CARGO\DISPATCHER classes, which are used inernally by the WAREHOUSE class. Meaning that troops (cargo) will board, i.e. run or drive to the carrier, and only once they are in close proximity to the transporter they will be loaded (disappear).
Unfortunately, there are some situations where problems can occur. For example, in DCS tanks have the strong tentendcy not to drive around obstacles but rather to roll over them. I have seen cases where an aircraft of the same coalition as the tank was in its way and the tank drove right through the plane waiting on a parking spot and destroying it.
As a workaround it is possible to set a larger load radius so that the cargo units are despawned further away from the carrier via the optional loadradius parameter:
warehouseBatumi:AddAsset("Leopard 2", nil, nil, nil, nil, 250)
Adding the asset like this will cause the units to be loaded into the carrier already at a distance of 250 meters.
Setting the AI Skill
By default, the asset has the skill of its template group. The optional parameter skill allows to set a different skill when the asset is added. See the hoggit page possible values of this enumerator. For example you can use
warehouseBatumi:AddAsset("Leopard 2", nil, nil, nil, nil, nil, AI.Skill.EXCELLENT)
do set the skill of the asset to excellent.
Setting Liveries
By default ,the asset uses the livery of its template group. The optional parameter liveries allows to define one or multiple liveries. If multiple liveries are given in form of a table of livery names, each asset gets a random one.
For example
warehouseBatumi:AddAsset("Mi-8", nil, nil, nil, nil, nil, nil, "China UN")
would spawn the asset with a Chinese UN livery.
Or
warehouseBatumi:AddAsset("Mi-8", nil, nil, nil, nil, nil, nil, {"China UN", "German"})
would spawn the asset with either a Chinese UN or German livery. Mind the curly brackets {} when you want to specify multiple liveries.
Four each unit type, the livery names can be found in the DCS root folder under Bazar\Liveries. You have to use the name of the livery subdirectory. The names of the liveries as displayed in the mission editor might be different and won't work in general.
Setting an Assignment
Assets can be added with a specific assignment given as a text, e.g.
warehouseBatumi:AddAsset("Mi-8", nil, nil, nil, nil, nil, nil, nil, "Go to Warehouse Kobuleti")
This is helpful to establish supply chains once an asset has arrived at its (first) destination and is meant to be forwarded to another warehouse.
Retrieving the Asset
Once a an asset is added to a warehouse, the WAREHOUSE.NewAsset event is triggered. You can hook into this event with the WAREHOUSE.OnAfterNewAsset(asset, assignment) function.
The first parameter asset is a table of type WAREHOUSE.Assetitem and contains a lot of information about the asset. The seconed parameter assignment is optional and is the specific assignment the asset got when it was added.
Note that the assignment is can also be the assignment that was specified when adding a request (see next section). Once an asset that was requested from another warehouse and an assignment was specified in the WAREHOUSE.AddRequest function, the assignment can be checked when the asset has arrived and is added to the receiving warehouse.
Requesting Assets
Assets of the warehouse can be requested by other MOOSE warehouses. A request will first be scrutinized to check if can be fulfilled at all. If the request is valid, it is put into the warehouse queue and processed as soon as possible.
Requested assets spawn in various "Rule of Engagement Rules" (ROE) and Alerts modes. If your assets will cross into dangerous areas, be sure to change these states. You can do this in #WAREHOUSE(*From, *Event, *To, *group, *asset, *request)) function.
Initial Spawn states is as follows: GROUND: ROE, "Return Fire" Alarm, "Green" AIR: ROE, "Return Fire" Reaction to Threat, "Passive Defense" NAVAL ROE, "Return Fire" Alarm,"N/A"
A request can be added by the WAREHOUSE.AddRequest(warehouse, AssetDescriptor, AssetDescriptorValue, nAsset, TransportType, nTransport, Prio, Assignment) function. The parameters are
- warehouse: The requesting MOOSE #WAREHOUSE. Assets will be delivered there.
- AssetDescriptor: The descriptor to describe the asset "type". See the WAREHOUSE.Descriptor enumerator. For example, assets requested by their generalized attibute.
- AssetDescriptorValue: The value of the asset descriptor.
- nAsset: (Optional) Number of asset group requested. Default is one group.
- TransportType: (Optional) The transport method used to deliver the assets to the requestor. Default is that assets go to the requesting warehouse on their own.
- nTransport: (Optional) Number of asset groups used to transport the cargo assets from A to B. Default is one group.
- Prio: (Optional) A number between 1 (high) and 100 (low) describing the priority of the request. Request with high priority are processed first. Default is 50, i.e. medium priority.
- Assignment: (Optional) A free to choose string describing the assignment. For self requests, this can be used to assign the spawned groups to specific tasks.
Requesting by Generalized Attribute
Generalized attributes are similar to DCS attributes. However, they are a bit more general and an asset can only have one generalized attribute by which it is characterized.
For example:
warehouseBatumi:AddRequest(warehouseKobuleti, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 5, WAREHOUSE.TransportType.APC, 2)
Here, warehouse Kobuleti requests 5 infantry groups from warehouse Batumi. These "cargo" assets should be transported from Batumi to Kobuleti by 2 APCS. Note that the warehouse at Batumi needs to have at least five infantry groups and two APC groups in their stock if the request can be processed. If either to few infantry or APC groups are available when the request is made, the request is held in the warehouse queue until enough cargo and transport assets are available.
Also note that the above request is for five infantry groups. So any group in stock that has the generalized attribute "GROUND_INFANTRY" can be selected for the request.
Generalized Attributes
Currently implemented are:
- WAREHOUSE.Attribute.AIR_TRANSPORTPLANE Airplane with transport capability. This can be used to transport other assets.
- WAREHOUSE.Attribute.AIR_AWACS Airborne Early Warning and Control System.
- WAREHOUSE.Attribute.AIR_FIGHTER Fighter, interceptor, ... airplane.
- WAREHOUSE.Attribute.AIR_BOMBER Aircraft which can be used for strategic bombing.
- WAREHOUSE.Attribute.AIR_TANKER Airplane which can refuel other aircraft.
- WAREHOUSE.Attribute.AIR_TRANSPORTHELO Helicopter with transport capability. This can be used to transport other assets.
- WAREHOUSE.Attribute.AIR_ATTACKHELO Attack helicopter.
- WAREHOUSE.Attribute.AIR_UAV Unpiloted Aerial Vehicle, e.g. drones.
- WAREHOUSE.Attribute.AIR_OTHER Any airborne unit that does not fall into any other airborne category.
- WAREHOUSE.Attribute.GROUND_APC Infantry carriers, in particular Amoured Personell Carrier. This can be used to transport other assets.
- WAREHOUSE.Attribute.GROUND_TRUCK Unarmed ground vehicles, which has the DCS "Truck" attribute.
- WAREHOUSE.Attribute.GROUND_INFANTRY Ground infantry assets.
- WAREHOUSE.Attribute.GROUND_IFV Ground infantry fighting vehicle.
- WAREHOUSE.Attribute.GROUND_ARTILLERY Artillery assets.
- WAREHOUSE.Attribute.GROUND_TANK Tanks (modern or old).
- WAREHOUSE.Attribute.GROUND_TRAIN Trains. Not that trains are not yet properly implemented in DCS and cannot be used currently.
- WAREHOUSE.Attribute.GROUND_EWR Early Warning Radar.
- WAREHOUSE.Attribute.GROUND_AAA Anti-Aircraft Artillery.
- WAREHOUSE.Attribute.GROUND_SAM Surface-to-Air Missile system or components.
- WAREHOUSE.Attribute.GROUND_OTHER Any ground unit that does not fall into any other ground category.
- WAREHOUSE.Attribute.NAVAL_AIRCRAFTCARRIER Aircraft carrier.
- WAREHOUSE.Attribute.NAVAL_WARSHIP War ship, i.e. cruisers, destroyers, firgates and corvettes.
- WAREHOUSE.Attribute.NAVAL_ARMEDSHIP Any armed ship that is not an aircraft carrier, a cruiser, destroyer, firgatte or corvette.
- WAREHOUSE.Attribute.NAVAL_UNARMEDSHIP Any unarmed naval vessel.
- WAREHOUSE.Attribute.NAVAL_OTHER Any naval unit that does not fall into any other naval category.
- WAREHOUSE.Attribute.OTHER_UNKNOWN Anything that does not fall into any other category.
Requesting a Specific Unit Type
A more specific request could look like:
warehouseBatumi:AddRequest(warehouseKobuleti, WAREHOUSE.Descriptor.UNITTYPE, "A-10C", 2)
Here, Kobuleti requests a specific unit type, in particular two groups of A-10Cs. Note that the spelling is important as it must exacly be the same as what one get's when using the DCS unit type.
Requesting a Specific Group
An even more specific request would be:
warehouseBatumi:AddRequest(warehouseKobuleti, WAREHOUSE.Descriptor.GROUPNAME, "Group Name as in ME", 3)
In this case three groups named "Group Name as in ME" are requested. This explicitly request the groups named like that in the Mission Editor.
Requesting a General Category
On the other hand, very general and unspecifc requests can be made by the categroy descriptor. The descriptor value parameter can be any group category, i.e.
- Group.Category.AIRPLANE for fixed wing aircraft,
- Group.Category.HELICOPTER for helicopters,
- Group.Category.GROUND for all ground troops,
- Group.Category.SHIP for naval assets,
- Group.Category.TRAIN for trains (not implemented and not working in DCS yet).
For example,
warehouseBatumi:AddRequest(warehouseKobuleti, WAREHOUSE.Descriptor.CATEGORY, Group.Category.GROUND, 10)
means that Kubuleti requests 10 ground groups and does not care which ones. This could be a mix of infantry, APCs, trucks etc.
Note that these general requests should be made with great care due to the fact, that depending on what a warehouse has in stock a lot of different unit types can be spawned.
Requesting Relative Quantities
In addition to requesting absolute numbers of assets it is possible to request relative amounts of assets currently in stock. To this end the WAREHOUSE.Quantity enumerator was introduced:
- WAREHOUSE.Quantity.ALL
- WAREHOUSE.Quantity.HALF
- WAREHOUSE.Quantity.QUARTER
- WAREHOUSE.Quantity.THIRD
- WAREHOUSE.Quantity.THREEQUARTERS
For example,
warehouseBatumi:AddRequest(warehouseKobuleti, WAREHOUSE.Descriptor.CATEGORY, Group.Category.HELICOPTER, WAREHOUSE.Quantity.HALF)
means that Kobuleti warehouse requests half of all available helicopters which Batumi warehouse currently has in stock.
Employing Assets - The Self Request
Transferring assets from one warehouse to another is important but of course once the the assets are at the "right" place it is equally important that they can be employed for specific tasks and assignments.
Assets in the warehouses stock can be used for user defined tasks quite easily. They can be spawned into the game by a "self request", i.e. the warehouse requests the assets from itself:
warehouseBatumi:AddRequest(warehouseBatumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 5)
Note that the sending and requesting warehouses are identical in this case.
This would simply spawn five infantry groups in the spawn zone of the Batumi warehouse if/when they are available.
Accessing the Assets
If a warehouse requests assets from itself, it triggers the event SelfReqeuest. The mission designer can capture this event with the associated WAREHOUSE.OnAfterSelfRequest(From, Event, To, groupset, request) function.
--- OnAfterSelfRequest user function. Access groups spawned from the warehouse for further tasking.
-- @param #WAREHOUSE self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Set#SET_GROUP groupset The set of cargo groups that was delivered to the warehouse itself.
-- @param #WAREHOUSE.Pendingitem request Pending self request.
function WAREHOUSE:OnAfterSelfRequest(From, Event, To, groupset, request)
local groupset=groupset --Core.Set#SET_GROUP
local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
for _,group in pairs(groupset:GetSetObjects()) do
local group=group --Wrapper.Group#GROUP
group:SmokeGreen()
end
end
The variable groupset is a Core.Set#SET_GROUP object and holds all asset groups from the request. The code above shows, how the mission designer can access the groups for further tasking. Here, the groups are only smoked but, of course, you can use them for whatever assignment you fancy.
Note that airborne groups are spawned in uncontrolled state and need to be activated first before they can begin with their assigned tasks and missions. This can be done with the Wrapper.Controllable#CONTROLLABLE.StartUncontrolled function as demonstrated in the example section below.
Infrastructure
A good infrastructure is important for a warehouse to be efficient. Therefore, the location of a warehouse should be chosen with care. This can also help to avoid many DCS related issues such as units getting stuck in buildings, blocking taxi ways etc.
Spawn Zone
By default, the zone were ground assets are spawned is a circular zone around the physical location of the warehouse with a radius of 200 meters. However, the location of the spawn zone can be set by the WAREHOUSE.SetSpawnZone(zone) functions. It is advisable to choose a zone which is clear of obstacles.
The parameter zone is a MOOSE Core.Zone#ZONE object. So one can, e.g., use trigger zones defined in the mission editor. If a cicular zone is not desired, one can use a polygon zone (see Core.Zone#ZONE_POLYGON).
Road Connections
Ground assets will use a road connection to travel from one warehouse to another. Therefore, a proper road connection is necessary.
By default, the closest point on road to the center of the spawn zone is chosen as road connection automatically. But only, if distance between the spawn zone and the road connection is less than 3 km.
The user can set the road connection manually with the WAREHOUSE.SetRoadConnection function. This is only functional for self propelled assets at the moment and not if using the AI dispatcher classes since these have a different logic to find the route.
Off Road Connections
For ground troops it is also possible to define off road paths between warehouses if no proper road connection is available or should not be used.
An off road path can be defined via the WAREHOUSE.AddOffRoadPath(remotewarehouse, group, oneway) function, where remotewarehouse is the warehouse to which the path leads. The parameter group is a late activated template group. The waypoints of this group are used to define the path between the two warehouses. By default, the reverse paths is automatically added to get from the remote warehouse to this warehouse unless the parameter oneway is set to true.
Note that if an off road connection is defined between two warehouses this becomes the default path, i.e. even if there is a path on road possible this will not be used.
Also note that you can define multiple off road connections between two warehouses. If there are multiple paths defined, the connection is chosen randomly. It is also possible to add the same path multiple times. By this you can influence the probability of the chosen path. For example Path1(A->B) has been added two times while Path2(A->B) was added only once. Hence, the group will choose Path1 with a probability of 66.6 % while Path2 is only chosen with a probability of 33.3 %.
Rail Connections
A rail connection is automatically defined as the closest point on a railway measured from the center of the spawn zone. But only, if the distance is less than 3 km.
The mission designer can manually specify a rail connection with the WAREHOUSE.SetRailConnection function.
NOTE however, that trains in DCS are currently not implemented in a way so that they can be used.
Air Connections
In order to use airborne assets, a warehouse needs to have an associated airbase. This can be an airdrome, a FARP/HELOPAD or a ship.
If there is an airbase within 3 km range of the warehouse it is automatically set as the associated airbase. A user can set an airbase manually with the WAREHOUSE.SetAirbase function. Keep in mind that sometimes ground units need to walk/drive from the spawn zone to the airport to get to their transport carriers.
Naval Connections
Natively, DCS does not have the concept of a port/habour or shipping lanes. So in order to have a meaningful transfer of naval units between warehouses, these have to be defined by the mission designer.
Defining a Port
A port in this context is the zone where all naval assets are spawned. This zone can be defined with the function WAREHOUSE.SetPortZone(zone), where the parameter zone is a MOOSE zone. So again, this can be create from a trigger zone defined in the mission editor or if a general shape is desired by a Core.Zone#ZONE_POLYGON.
Defining Shipping Lanes
A shipping lane between to warehouses can be defined by the WAREHOUSE.AddShippingLane(remotewarehouse, group, oneway) function. The first parameter remotewarehouse is the warehouse which should be connected to the present warehouse.
The parameter group should be a late activated group defined in the mission editor. The waypoints of this group are used as waypoints of the shipping lane.
By default, the reverse lane is automatically added to the remote warehouse. This can be disabled by setting the oneway parameter to true.
Similar to off road connections, you can also define multiple shipping lanes between two warehouse ports. If there are multiple lanes defined, one is chosen randomly. It is possible to add the same lane multiple times. By this you can influence the probability of the chosen lane. For example Lane_1(A->B) has been added two times while Lane_2(A->B) was added only once. Therefore, the ships will choose Lane_1 with a probability of 66.6 % while Path_2 is only chosen with a probability of 33.3 %.
Why is my request not processed?
For each request, the warehouse class logic does a lot of consistency and validation checks under the hood. This helps to circumvent a lot of DCS issues and shortcomings. For example, it is checked that enough free parking spots at an airport are available before the assets are spawned. However, this also means that sometimes a request is deemed to be invalid in which case they are deleted from the queue or considered to be valid but cannot be executed at this very moment.
Invalid Requests
Invalid request are requests which can never be processes because there is some logical or physical argument against it. (Or simply because that feature was not implemented (yet).)
- All airborne assets need an associated airbase of any kind on the sending and receiving warehouse.
- Airplanes need an airdrome at the sending and receiving warehouses.
- Not enough parking spots of the right terminal type at the sending warehouse. This avoids planes spawning on runways or on top of each other.
- No parking spots of the right terminal type at the receiving warehouse. This avoids DCS despawning planes on landing if they have no valid parking spot.
- Ground assets need a road connection between both warehouses or an off-road path needs to be added manually.
- Ground assets cannot be send directly to ships, i.e. warehouses on ships.
- Naval units need a user defined shipping lane between both warehouses.
- Warehouses need a user defined port zone to spawn naval assets.
- The receiving warehouse is destroyed or stopped.
- If transport by airplane, both warehouses must have and airdrome.
- If transport by APC, both warehouses must have a road connection.
- If transport by helicopter, the sending airbase must have an associated airbase (airdrome or FARP).
All invalid requests are cancelled and removed from the warehouse queue!
Temporarily Unprocessable Requests
Temporarily unprocessable requests are possible in principle, but cannot be processed at the given time the warehouse checks its queue.
- No enough parking spaces are available for all requested assets but the airbase has enough parking spots in total so that this request is possible once other aircraft have taken off.
- The requesting warehouse is not in state "Running" (could be paused, not yet started or under attack).
- Not enough cargo assets available at this moment.
- Not enough free parking spots for all cargo or transport airborne assets at the moment.
- Not enough transport assets to carry all cargo assets.
Temporarily unprocessable requests are held in the queue. If at some point in time, the situation changes so that these requests can be processed, they are executed.
Cargo Bay and Weight Limitations
The transportation of cargo is handled by the AI_Dispatcher classes. These take the cargo bay of a carrier and the weight of the cargo into account so that a carrier can only load a realistic amount of cargo.
However, if troops are supposed to be transported between warehouses, there is one important limitations one has to keep in mind. This is that cargo asset groups cannot be split and divided into separate carrier units!
For example, a TPz Fuchs has a cargo bay large enough to carry up to 10 soldiers at once, which is a realistic number. If a group consisting of more than ten soldiers needs to be transported, it cannot be loaded into the APC. Even if two APCs are available, which could in principle carry up to 20 soldiers, a group of, let's say 12 soldiers will not be split into a group of ten soldiers using the first APC and a group two soldiers using the second APC.
In other words, there must be at least one carrier unit available that has a cargo bay large enough to load the heaviest cargo group! The warehouse logic will automatically search all available transport assets for a large enough carrier. But if none is available, the request will be queued until a suitable carrier becomes available.
The only realistic solution in this case is to either provide a transport carrier with a larger cargo bay or to reduce the number of soldiers in the group.
A better way would be to have two groups of max. 10 soldiers each and one TPz Fuchs for transport. In this case, the first group is loaded and transported to the receiving warehouse. Once this is done, the carrier will drive back and pick up the remaining group.
As an artificial workaround one can manually set the cargo bay size to a larger value or alternatively reduce the weight of the cargo when adding the assets via the WAREHOUSE.AddAsset function. This might even be unavoidable if, for example, a SAM group should be transported since SAM sites only work when all units are in the same group.
Processing Speed
A warehouse has a limited speed to process requests. Each time the status of the warehouse is updated only one requests is processed. The time interval between status updates is 30 seconds by default and can be adjusted via the WAREHOUSE.SetStatusUpdate(interval) function. However, the status is also updated on other occasions, e.g. when a new request was added.
Strategic Considerations
Due to the fact that a warehouse holds (or can hold) a lot of valuable assets, it makes a (potentially) juicy target for enemy attacks. There are several interesting situations, which can occur.
Capturing a Warehouses Airbase
If a warehouse has an associated airbase, it can be captured by the enemy. In this case, the warehouse looses its ability so employ all airborne assets and is also cut-off from supply by airplanes. Supply of ground troops via helicopters is still possible, because they deliver the troops into the spawn zone.
Technically, the capturing of the airbase is triggered by the DCS S_EVENT_BASE_CAPTURED event. So the capturing takes place when only enemy ground units are in the airbase zone whilst no ground units of the present airbase owner are in that zone.
The warehouse will also create an event AirbaseCaptured, which can be captured by the WAREHOUSE.OnAfterAirbaseCaptured function. So the warehouse chief can react on this attack and for example deploy ground groups to re-capture its airbase.
When an airbase is re-captured the event AirbaseRecaptured is triggered and can be captured by the WAREHOUSE.OnAfterAirbaseRecaptured function. This can be used to put the defending assets back into the warehouse stock.
Capturing the Warehouse
A warehouse can be captured by the enemy coalition. If enemy ground troops enter the warehouse zone the event Attacked is triggered which can be captured by the WAREHOUSE.OnAfterAttacked event. By default the warehouse zone circular zone with a radius of 500 meters located at the center of the physical warehouse. The warehouse zone can be set via the WAREHOUSE.SetWarehouseZone(zone) function. The parameter zone must also be a circular zone.
The WAREHOUSE.OnAfterAttacked function can be used by the mission designer to react to the enemy attack. For example by deploying some or all ground troops currently in stock to defend the warehouse. Note that the warehouse also has a self defence option which can be enabled by the WAREHOUSE.SetAutoDefenceOn() function. In this case, the warehouse will automatically spawn all ground troops. If the spawn zone is further away from the warehouse zone, all mobile troops are routed to the warehouse zone. The self request which is triggered on an automatic defence has the assignment "AutoDefence". So you can use this to give orders to the groups that were spawned using the WAREHOUSE.OnAfterSelfRequest function.
If only ground troops of the enemy coalition are present in the warehouse zone, the warehouse and all its assets falls into the hands of the enemy. In this case the event Captured is triggered which can be captured by the WAREHOUSE.OnAfterCaptured function.
The warehouse turns to the capturing coalition, i.e. its physical representation, and all assets as well. In particular, all requests to the warehouse will spawn assets belonging to the new owner.
If the enemy troops could be defeated, i.e. no more troops of the opposite coalition are in the warehouse zone, the event Defeated is triggered and the WAREHOUSE.OnAfterDefeated function can be used to adapt to the new situation. For example putting back all spawned defender troops back into the warehouse stock. Note that if the automatic defence is enabled, all defenders are automatically put back into the warehouse on the Defeated event.
Destroying a Warehouse
If an enemy destroy the physical warehouse structure, the warehouse will of course stop all its services. In principle, all assets contained in the warehouse are gone as well. So a warehouse should be properly defended.
Upon destruction of the warehouse, the event Destroyed is triggered, which can be captured by the WAREHOUSE.OnAfterDestroyed function. So the mission designer can intervene at this point and for example choose to spawn all or particular types of assets before the warehouse is gone for good.
Hook in and Take Control
The Finite State Machine implementation allows mission designers to hook into important events and add their own code. Most of these events have already been mentioned but here is the list at a glance:
- "NotReadyYet" --> "Start" --> "Running" (Starting the warehouse)
- "*" --> "Status" --> "*" (status updated in regular intervals)
- "*" --> "AddAsset" --> "*" (adding a new asset to the warehouse stock)
- "*" --> "NewAsset" --> "*" (a new asset has been added to the warehouse stock)
- "*" --> "AddRequest" --> "*" (adding a request for the warehouse assets)
- "Running" --> "Request" --> "*" (a request is processed when the warehouse is running)
- "Attacked" --> "Request" --> "*" (a request is processed when the warehouse is attacked)
- "*" --> "Arrived" --> "*" (asset group has arrived at its destination)
- "*" --> "Delivered" --> "*" (all assets of a request have been delivered)
- "Running" --> "SelfRequest" --> "*" (warehouse is requesting asset from itself when running)
- "Attacked" --> "SelfRequest" --> "*" (warehouse is requesting asset from itself while under attack)
- "*" --> "Attacked" --> "Attacked" (warehouse is being attacked)
- "Attacked" --> "Defeated" --> "Running" (an attack was defeated)
- "Attacked" --> "Captured" --> "Running" (warehouse was captured by the enemy)
- "*" --> "AirbaseCaptured" --> "*" (airbase belonging to the warehouse was captured by the enemy)
- "*" --> "AirbaseRecaptured" --> "*" (airbase was re-captured)
- "*" --> "AssetSpawned" --> "*" (an asset has been spawned into the world)
- "*" --> "AssetLowFuel" --> "*" (an asset is running low on fuel)
- "*" --> "AssetDead" --> "*" (a whole asset, i.e. all its units/groups, is dead)
- "*" --> "Destroyed" --> "Destroyed" (warehouse was destroyed)
- "Running" --> "Pause" --> "Paused" (warehouse is paused)
- "Paused" --> "Unpause" --> "Running" (warehouse is unpaused)
- "*" --> "Stop" --> "Stopped" (warehouse is stopped)
The transitions are of the general form "From State" --> "Event" --> "To State". The "" star denotes that the transition is possible from *any state. Some transitions, however, are only allowed from certain "From States". For example, no requests can be processed if the warehouse is in "Paused" or "Destroyed" or "Stopped" state.
Mission designers can capture the events with OnAfterEvent functions, e.g. WAREHOUSE.OnAfterDelivered or WAREHOUSE.OnAfterAirbaseCaptured.
Persistence of Assets
Assets in stock of a warehouse can be saved to a file on your hard drive and then loaded from that file at a later point. This enables to restart the mission and restore the warehouse stock.
Prerequisites
Important By default, DCS does not allow for writing data to files. Therefore, one first has to comment out the line "sanitizeModule('io')", i.e.
do
sanitizeModule('os')
--sanitizeModule('io')
sanitizeModule('lfs')
require = nil
loadlib = nil
end
in the file "MissionScripting.lua", which is located in the subdirectory "Scripts" of your DCS installation root directory.
Don't!
Do not use semi-colons or equal signs in the group names of your assets as these are used as separators in the saved and loaded files texts. If you do, it will cause problems and give you a headache!
Save Assets
Saving asset data to file is achieved by the WAREHOUSE.Save(path, filename) function. The parameter path specifies the path on the file system where the warehouse data is saved. If you do not specify a path, the file is saved your the DCS installation root directory. The parameter filename is optional and defines the name of the saved file. By default this is automatically created from the warehouse id and name, for example "Warehouse-1234_Batumi.txt".
warehouseBatumi:Save("D:\\My Warehouse Data\\")
This will save all asset data to in "D:\My Warehouse Data\Warehouse-1234_Batumi.txt".
Automatic Save at Mission End
The assets can be saved automatically when the mission is ended via the WAREHOUSE.SetSaveOnMissionEnd(path, filename) function, i.e.
warehouseBatumi:SetSaveOnMissionEnd("D:\\My Warehouse Data\\")
Load Assets
Loading assets data from file is achieved by the WAREHOUSE.Load(path, filename) function. The parameter path specifies the path on the file system where the warehouse data is loaded from. If you do not specify a path, the file is loaded from your the DCS installation root directory. The parameter filename is optional and defines the name of the file to load. By default this is automatically generated from the warehouse id and name, for example "Warehouse-1234_Batumi.txt".
Note that the warehouse must not be started and in the Running state in order to load the assets. In other words, loading should happen after the WAREHOUSE.New command is specified in the code but before the WAREHOUSE.Start command is given.
Loading the assets is done by
warehouseBatumi:New(STATIC:FindByName("Warehouse Batumi"))
warehouseBatumi:Load("D:\\My Warehouse Data\\")
warehouseBatumi:Start()
This sequence loads all assets from file. If a warehouse was captured in the last mission, it also respawns the static warehouse structure with the right coalition. However, it due to DCS limitations it is not possible to set the airbase coalition. This has to be done manually in the mission editor. Or alternatively, one could spawn some ground units via a self request and let them capture the airbase.
Examples
This section shows some examples how the WAREHOUSE class is used in practice. This is one of the best ways to explain things, in my opinion.
But first, let me introduce a convenient way to define several warehouses in a table. This is absolutely not necessary but quite handy if you have multiple WAREHOUSE objects in your mission.
Example 0: Setting up a Warehouse Array
If you have multiple warehouses, you can put them in a table. This makes it easier to access them or to loop over them.
-- Define Warehouses.
local warehouse={}
-- Blue warehouses
warehouse.Senaki = WAREHOUSE:New(STATIC:FindByName("Warehouse Senaki"), "Senaki") --Functional.Warehouse#WAREHOUSE
warehouse.Batumi = WAREHOUSE:New(STATIC:FindByName("Warehouse Batumi"), "Batumi") --Functional.Warehouse#WAREHOUSE
warehouse.Kobuleti = WAREHOUSE:New(STATIC:FindByName("Warehouse Kobuleti"), "Kobuleti") --Functional.Warehouse#WAREHOUSE
warehouse.Kutaisi = WAREHOUSE:New(STATIC:FindByName("Warehouse Kutaisi"), "Kutaisi") --Functional.Warehouse#WAREHOUSE
warehouse.Berlin = WAREHOUSE:New(STATIC:FindByName("Warehouse Berlin"), "Berlin") --Functional.Warehouse#WAREHOUSE
warehouse.London = WAREHOUSE:New(STATIC:FindByName("Warehouse London"), "London") --Functional.Warehouse#WAREHOUSE
warehouse.Stennis = WAREHOUSE:New(STATIC:FindByName("Warehouse Stennis"), "Stennis") --Functional.Warehouse#WAREHOUSE
warehouse.Pampa = WAREHOUSE:New(STATIC:FindByName("Warehouse Pampa"), "Pampa") --Functional.Warehouse#WAREHOUSE
-- Red warehouses
warehouse.Sukhumi = WAREHOUSE:New(STATIC:FindByName("Warehouse Sukhumi"), "Sukhumi") --Functional.Warehouse#WAREHOUSE
warehouse.Gudauta = WAREHOUSE:New(STATIC:FindByName("Warehouse Gudauta"), "Gudauta") --Functional.Warehouse#WAREHOUSE
warehouse.Sochi = WAREHOUSE:New(STATIC:FindByName("Warehouse Sochi"), "Sochi") --Functional.Warehouse#WAREHOUSE
Remarks:
- I defined the array as local, i.e. local warehouse={}. This is personal preference and sometimes causes trouble with the lua garbage collection. You can also define it as a global array/table!
- The "--Functional.Warehouse#WAREHOUSE" at the end is only to have the LDT intellisense working correctly. If you don't use LDT (which you should!), it can be omitted.
NOTE that all examples below need this bit or code at the beginning - or at least the warehouses which are used.
The example mission is based on the same template mission, which has defined a lot of airborne, ground and naval assets as templates. Only few of those are used here.
Example 1: Self Request
Ground troops are taken from the Batumi warehouse stock and spawned in its spawn zone. After a short delay, they are added back to the warehouse stock. Also a new request is made. Hence, the groups will be spawned, added back to the warehouse, spawned again and so on and so forth...
-- Start warehouse Batumi.
warehouse.Batumi:Start()
-- Add five groups of infantry as assets.
warehouse.Batumi:AddAsset(GROUP:FindByName("Infantry Platoon Alpha"), 5)
-- Add self request for three infantry at Batumi.
warehouse.Batumi:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 3)
--- Self request event. Triggered once the assets are spawned in the spawn zone or at the airbase.
function warehouse.Batumi:OnAfterSelfRequest(From, Event, To, groupset, request)
local mygroupset=groupset --Core.Set#SET_GROUP
-- Loop over all groups spawned from that request.
for _,group in pairs(mygroupset:GetSetObjects()) do
local group=group --Wrapper.Group#GROUP
-- Gree smoke on spawned group.
group:SmokeGreen()
-- Put asset back to stock after 10 seconds.
warehouse.Batumi:__AddAsset(10, group)
end
-- Add new self request after 20 seconds.
warehouse.Batumi:__AddRequest(20, warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 3)
end
Example 2: Self propelled Ground Troops
Warehouse Berlin, which is a FARP near Batumi, requests infantry and troop transports from the warehouse at Batumi. The groups are spawned at Batumi and move by themselves from Batumi to Berlin using the roads. Once the troops have arrived at Berlin, the troops are automatically added to the warehouse stock of Berlin. While on the road, Batumi has requested back two APCs from Berlin. Since Berlin does not have the assets in stock, the request is queued. After the troops have arrived, Berlin is sending back the APCs to Batumi.
-- Start Warehouse at Batumi.
warehouse.Batumi:Start()
-- Add 20 infantry groups and ten APCs as assets at Batumi.
warehouse.Batumi:AddAsset("Infantry Platoon Alpha", 20)
warehouse.Batumi:AddAsset("TPz Fuchs", 10)
-- Start Warehouse Berlin.
warehouse.Berlin:Start()
-- Warehouse Berlin requests 10 infantry groups and 5 APCs from warehouse Batumi.
warehouse.Batumi:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 10)
warehouse.Batumi:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_APC, 5)
-- Request from Batumi for 2 APCs. Initially these are not in stock. When they become available, the request is executed.
warehouse.Berlin:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_APC, 2)
Example 3: Self Propelled Airborne Assets
Warehouse Senaki receives a high priority request from Kutaisi for one Yak-52s. At the same time, Kobuleti requests half of all available Yak-52s. Request from Kutaisi is first executed and then Kobuleti gets half of the remaining assets. Additionally, London requests one third of all available UH-1H Hueys from Senaki. Once the units have arrived they are added to the stock of the receiving warehouses and can be used for further assignments.
-- Start warehouses
warehouse.Senaki:Start()
warehouse.Kutaisi:Start()
warehouse.Kobuleti:Start()
warehouse.London:Start()
-- Add assets to Senaki warehouse.
warehouse.Senaki:AddAsset("Yak-52", 10)
warehouse.Senaki:AddAsset("Huey", 6)
-- Kusaisi requests 3 Yak-52 form Senaki while Kobuleti wants all the rest.
warehouse.Senaki:AddRequest(warehouse.Kutaisi, WAREHOUSE.Descriptor.GROUPNAME, "Yak-52", 1, nil, nil, 10)
warehouse.Senaki:AddRequest(warehouse.Kobuleti, WAREHOUSE.Descriptor.GROUPNAME, "Yak-52", WAREHOUSE.Quantity.HALF, nil, nil, 70)
-- FARP London wants 1/3 of the six available Hueys.
warehouse.Senaki:AddRequest(warehouse.London, WAREHOUSE.Descriptor.GROUPNAME, "Huey", WAREHOUSE.Quantity.THIRD)
Example 4: Transport of Assets by APCs
Warehouse at FARP Berlin requests five infantry groups from Batumi. These assets shall be transported using two APC groups. Infantry and APC are spawned in the spawn zone at Batumi. The APCs have a cargo bay large enough to pick up four of the five infantry groups in the first run and will bring them to Berlin. There, they unboard and walk to the warehouse where they will be added to the stock. Meanwhile the APCs go back to Batumi and one will pick up the last remaining soldiers. Once the APCs have completed their mission, they return to Batumi and are added back to stock.
-- Start Warehouse at Batumi.
warehouse.Batumi:Start()
-- Start Warehouse Berlin.
warehouse.Berlin:Start()
-- Add 20 infantry groups and five APCs as assets at Batumi.
warehouse.Batumi:AddAsset("Infantry Platoon Alpha", 20)
warehouse.Batumi:AddAsset("TPz Fuchs", 5)
-- Warehouse Berlin requests 5 infantry groups from warehouse Batumi using 2 APCs for transport.
warehouse.Batumi:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 5, WAREHOUSE.TransportType.APC, 2)
Example 5: Transport of Assets by Helicopters
Warehouse at FARP Berlin requests five infantry groups from Batumi. They shall be transported by all available transport helicopters. Note that the UH-1H Huey in DCS is an attack and not a transport helo. So the warehouse logic would be default also register it as an WAREHOUSE.Attribute.AIR_ATTACKHELICOPTER. In order to use it as a transport we need to force it to be added as transport helo. Also note that even though all (here five) helos are requested, only two of them are employed because this number is sufficient to transport all requested assets in one go.
-- Start Warehouses.
warehouse.Batumi:Start()
warehouse.Berlin:Start()
-- Add 20 infantry groups as assets at Batumi.
warehouse.Batumi:AddAsset("Infantry Platoon Alpha", 20)
-- Add five Hueys for transport. Note that a Huey in DCS is an attack and not a transport helo. So we force this attribute!
warehouse.Batumi:AddAsset("Huey", 5, WAREHOUSE.Attribute.AIR_TRANSPORTHELO)
-- Warehouse Berlin requests 5 infantry groups from warehouse Batumi using all available helos for transport.
warehouse.Batumi:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 5, WAREHOUSE.TransportType.HELICOPTER, WAREHOUSE.Quantity.ALL)
Example 6: Transport of Assets by Airplanes
Warehoues Kobuleti requests all (three) APCs from Batumi using one airplane for transport. The available C-130 is able to carry one APC at a time. So it has to commute three times between Batumi and Kobuleti to deliver all requested cargo assets. Once the cargo is delivered, the C-130 transport returns to Batumi and is added back to stock.
-- Start warehouses.
warehouse.Batumi:Start()
warehouse.Kobuleti:Start()
-- Add assets to Batumi warehouse.
warehouse.Batumi:AddAsset("C-130", 1)
warehouse.Batumi:AddAsset("TPz Fuchs", 3)
warehouse.Batumi:AddRequest(warehouse.Kobuleti, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_APC, WAREHOUSE.Quantity.ALL, WAREHOUSE.TransportType.AIRPLANE)
Example 7: Capturing Airbase and Warehouse
A red BMP has made it through our defence lines and drives towards our unprotected airbase at Senaki. Once the BMP captures the airbase (DCS S_EVENT_BASE_CAPTURED is evaluated) the warehouse at Senaki lost its air infrastructure and it is not possible any more to spawn airborne units. All requests for airborne units are rejected and cancelled in this case.
The red BMP then drives further to the warehouse. Once it enters the warehouse zone (500 m radius around the warehouse building), the warehouse is considered to be under attack. This triggers the event Attacked. The WAREHOUSE.OnAfterAttacked function can be used to react to this situation. Here, we only broadcast a distress call and launch a flare. However, it would also be reasonable to spawn all or selected ground troops in order to defend the warehouse. Note, that the warehouse has a self defence option which can be activated via the WAREHOUSE.SetAutoDefenceOn() function. If activated, all ground assets are automatically spawned and assigned to defend the warehouse. Once/if the attack is defeated, these assets go automatically back into the warehouse stock.
If the red coalition manages to capture our warehouse, all assets go into their possession. Now red tries to steal three F/A-18 flights and send them to Sukhumi. These aircraft will be spawned and begin to taxi. However, ...
A blue Bradley is in the area and will attempt to recapture the warehouse. It might also catch the red F/A-18s before they take off.
-- Start warehouses.
warehouse.Senaki:Start()
warehouse.Sukhumi:Start()
-- Add some assets.
warehouse.Senaki:AddAsset("TPz Fuchs", 5)
warehouse.Senaki:AddAsset("Infantry Platoon Alpha", 10)
warehouse.Senaki:AddAsset("F/A-18C 2ship", 10)
-- Enable auto defence, i.e. spawn all group troups into the spawn zone.
--warehouse.Senaki:SetAutoDefenceOn()
-- Activate Red BMP trying to capture the airfield and the warehouse.
local red1=GROUP:FindByName("Red BMP-80 Senaki"):Activate()
-- The red BMP first drives to the airbase which gets captured and changes from blue to red.
-- This triggers the "AirbaseCaptured" event where you can hook in and do things.
function warehouse.Senaki:OnAfterAirbaseCaptured(From, Event, To, Coalition)
-- This request cannot be processed since the warehouse has lost its airbase. In fact it is deleted from the queue.
warehouse.Senaki:AddRequest(warehouse.Senaki,WAREHOUSE.Descriptor.CATEGORY, Group.Category.AIRPLANE, 1)
end
-- Now the red BMP also captures the warehouse. This triggers the "Captured" event where you can hook in.
-- So now the warehouse and the airbase are both red and aircraft can be spawned again.
function warehouse.Senaki:OnAfterCaptured(From, Event, To, Coalition, Country)
-- These units will be spawned as red units because the warehouse has just been captured.
if Coalition==coalition.side.RED then
-- Sukhumi tries to "steals" three F/A-18 from Senaki and brings them to Sukhumi.
-- Well, actually the aircraft wont make it because blue1 will kill it on the taxi way leaving a blood bath. But that's life!
warehouse.Senaki:AddRequest(warehouse.Sukhumi, WAREHOUSE.Descriptor.CATEGORY, Group.Category.AIRPLANE, 3)
warehouse.Senaki.warehouse:SmokeRed()
elseif Coalition==coalition.side.BLUE then
warehouse.Senaki.warehouse:SmokeBlue()
end
-- Activate a blue vehicle to re-capture the warehouse. It will drive to the warehouse zone and kill the red intruder.
local blue1=GROUP:FindByName("blue1"):Activate()
end
Example 8: Destroying a Warehouse
FARP Berlin requests a Huey from Batumi warehouse. This helo is deployed and will be delivered. After 30 seconds into the mission we create and (artificial) big explosion - or a terrorist attack if you like - which completely destroys the the warehouse at Batumi. All assets are gone and requests cannot be processed anymore.
-- Start Batumi and Berlin warehouses.
warehouse.Batumi:Start()
warehouse.Berlin:Start()
-- Add some assets.
warehouse.Batumi:AddAsset("Huey", 5, WAREHOUSE.Attribute.AIR_TRANSPORTHELO)
warehouse.Berlin:AddAsset("Huey", 5, WAREHOUSE.Attribute.AIR_TRANSPORTHELO)
-- Big explosion at the warehose. It has a very nice damage model by the way :)
local function DestroyWarehouse()
warehouse.Batumi:GetCoordinate():Explosion(999)
end
SCHEDULER:New(nil, DestroyWarehouse, {}, 30)
-- First request is okay since warehouse is still alive.
warehouse.Batumi:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.AIR_TRANSPORTHELO, 1)
-- These requests should both not be processed any more since the warehouse at Batumi is destroyed.
warehouse.Batumi:__AddRequest(35, warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.AIR_TRANSPORTHELO, 1)
warehouse.Berlin:__AddRequest(40, warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.AIR_TRANSPORTHELO, 1)
Example 9: Self Propelled Naval Assets
Kobuleti requests all naval assets from Batumi. However, before naval assets can be exchanged, both warehouses need a port and at least one shipping lane defined by the user. See the WAREHOUSE.SetPortZone() and WAREHOUSE.AddShippingLane() functions. We do not want to spawn them all at once, because this will probably be a disaster in the port zone. Therefore, each ship is spawned with a delay of five minutes.
Batumi has quite a selection of different ships (for testing).
-- Start warehouses.
warehouse.Batumi:Start()
warehouse.Kobuleti:Start()
-- Define ports. These are polygon zones created by the waypoints of late activated units.
warehouse.Batumi:SetPortZone(ZONE_POLYGON:NewFromGroupName("Warehouse Batumi Port Zone", "Warehouse Batumi Port Zone"))
warehouse.Kobuleti:SetPortZone(ZONE_POLYGON:NewFromGroupName("Warehouse Kobuleti Port Zone", "Warehouse Kobuleti Port Zone"))
-- Shipping lane. Again, the waypoints of late activated units are taken as points defining the shipping lane.
-- Some units will take lane 1 while others will take lane two. But both lead from Batumi to Kobuleti port.
warehouse.Batumi:AddShippingLane(warehouse.Kobuleti, GROUP:FindByName("Warehouse Batumi-Kobuleti Shipping Lane 1"))
warehouse.Batumi:AddShippingLane(warehouse.Kobuleti, GROUP:FindByName("Warehouse Batumi-Kobuleti Shipping Lane 2"))
-- Large selection of available naval units in DCS.
warehouse.Batumi:AddAsset("Speedboat")
warehouse.Batumi:AddAsset("Perry")
warehouse.Batumi:AddAsset("Normandy")
warehouse.Batumi:AddAsset("Stennis")
warehouse.Batumi:AddAsset("Carl Vinson")
warehouse.Batumi:AddAsset("Tarawa")
warehouse.Batumi:AddAsset("SSK 877")
warehouse.Batumi:AddAsset("SSK 641B")
warehouse.Batumi:AddAsset("Grisha")
warehouse.Batumi:AddAsset("Molniya")
warehouse.Batumi:AddAsset("Neustrashimy")
warehouse.Batumi:AddAsset("Rezky")
warehouse.Batumi:AddAsset("Moskva")
warehouse.Batumi:AddAsset("Pyotr Velikiy")
warehouse.Batumi:AddAsset("Kuznetsov")
warehouse.Batumi:AddAsset("Zvezdny")
warehouse.Batumi:AddAsset("Yakushev")
warehouse.Batumi:AddAsset("Elnya")
warehouse.Batumi:AddAsset("Ivanov")
warehouse.Batumi:AddAsset("Yantai")
warehouse.Batumi:AddAsset("Type 052C")
warehouse.Batumi:AddAsset("Guangzhou")
-- Get Number of ships at Batumi.
local nships=warehouse.Batumi:GetNumberOfAssets(WAREHOUSE.Descriptor.CATEGORY, Group.Category.SHIP)
-- Send one ship every 3 minutes (ships do not evade each other well, so we need a bit space between them).
for i=1, nships do
warehouse.Batumi:__AddRequest(180*(i-1)+10, warehouse.Kobuleti, WAREHOUSE.Descriptor.CATEGORY, Group.Category.SHIP, 1)
end
Example 10: Warehouse on Aircraft Carrier
This example shows how to spawn assets from a warehouse located on an aircraft carrier. The warehouse must still be represented by a physical static object. However, on a carrier space is limit so we take a smaller static. In priciple one could also take something like a windsock.
USS Stennis requests F/A-18s from Batumi. At the same time Kobuleti requests F/A-18s from the Stennis which currently does not have any. So first, Batumi delivers the fighters to the Stennis. After they arrived they are deployed again and send to Kobuleti.
-- Start warehouses.
warehouse.Batumi:Start()
warehouse.Stennis:Start()
warehouse.Kobuleti:Start()
-- Add F/A-18 2-ship flight to Batmi.
warehouse.Batumi:AddAsset("F/A-18C 2ship", 1)
-- USS Stennis requests F/A-18 from Batumi.
warehouse.Batumi:AddRequest(warehouse.Stennis, WAREHOUSE.Descriptor.GROUPNAME, "F/A-18C 2ship")
-- Kobuleti requests F/A-18 from USS Stennis.
warehouse.Stennis:AddRequest(warehouse.Kobuleti, WAREHOUSE.Descriptor.GROUPNAME, "F/A-18C 2ship")
Example 11: Aircraft Carrier - Rescue Helo and Escort
After 10 seconds we make a self request for a rescue helicopter. Note, that the WAREHOUSE.AddRequest function has a parameter which lets you specify an "Assignment". This can be later used to identify the request and take the right actions.
Once the request is processed, the WAREHOUSE.OnAfterSelfRequest function is called. This is where we hook in and postprocess the spawned assets. In particular, we use the AI.AI_Formation#AI_FORMATION class to make some nice escorts for our carrier.
When the resue helo is spawned, we can check that this is the correct asset and make the helo go into formation with the carrier. Once the helo runs out of fuel, it will automatically return to the ship and land. For the warehouse, this means that the "cargo", i.e. the helicopter has been delivered - assets can be delivered to other warehouses and to the same warehouse - hence a self request. When that happens, the Delivered event is triggered and the WAREHOUSE.OnAfterDelivered function called. This can now be used to spawn a fresh helo. Effectively, there we created an infinite, never ending loop. So a rescue helo will be up at all times.
After 30 and 45 seconds requests for five groups of armed speedboats are made. These will be spawned in the port zone right behind the carrier. The first five groups will go port of the carrier an form a left wing formation. The seconds groups will to the analogue on the starboard side. Note that in order to spawn naval assets a warehouse needs a port (zone). Since the carrier and hence the warehouse is mobile, we define a moving zone as Core.Zone#ZONE_UNIT with the carrier as reference unit. The "port" of the Stennis at its stern so all naval assets are spawned behind the carrier.
-- Start warehouse on USS Stennis.
warehouse.Stennis:Start()
-- Aircraft carrier gets a moving zone right behind it as port.
warehouse.Stennis:SetPortZone(ZONE_UNIT:New("Warehouse Stennis Port Zone", UNIT:FindByName("USS Stennis"), 100, {rho=250, theta=180, relative_to_unit=true}))
-- Add speedboat assets.
warehouse.Stennis:AddAsset("Speedboat", 10)
warehouse.Stennis:AddAsset("CH-53E", 1)
-- Self request of speed boats.
warehouse.Stennis:__AddRequest(10, warehouse.Stennis, WAREHOUSE.Descriptor.GROUPNAME, "CH-53E", 1, nil, nil, nil, "Rescue Helo")
warehouse.Stennis:__AddRequest(30, warehouse.Stennis, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.NAVAL_ARMEDSHIP, 5, nil, nil, nil, "Speedboats Left")
warehouse.Stennis:__AddRequest(45, warehouse.Stennis, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.NAVAL_ARMEDSHIP, 5, nil, nil, nil, "Speedboats Right")
--- Function called after self request
function warehouse.Stennis:OnAfterSelfRequest(From, Event, To,_groupset, request)
local groupset=_groupset --Core.Set#SET_GROUP
local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
-- USS Stennis is the mother ship.
local Mother=UNIT:FindByName("USS Stennis")
-- Get assignment of the request.
local assignment=warehouse.Stennis:GetAssignment(request)
if assignment=="Speedboats Left" then
-- Define AI Formation object.
-- Note that this has to be a global variable or the garbage collector will remove it for some reason!
CarrierFormationLeft = AI_FORMATION:New(Mother, groupset, "Left Formation with Carrier", "Escort Carrier.")
-- Formation parameters.
CarrierFormationLeft:FormationLeftWing(200 ,50, 0, 0, 500, 50)
CarrierFormationLeft:__Start(2)
for _,group in pairs(groupset:GetSetObjects()) do
local group=group --Wrapper.Group#GROUP
group:FlareRed()
end
elseif assignment=="Speedboats Right" then
-- Define AI Formation object.
-- Note that this has to be a global variable or the garbage collector will remove it for some reason!
CarrierFormationRight = AI_FORMATION:New(Mother, groupset, "Right Formation with Carrier", "Escort Carrier.")
-- Formation parameters.
CarrierFormationRight:FormationRightWing(200 ,50, 0, 0, 500, 50)
CarrierFormationRight:__Start(2)
for _,group in pairs(groupset:GetSetObjects()) do
local group=group --Wrapper.Group#GROUP
group:FlareGreen()
end
elseif assignment=="Rescue Helo" then
-- Start uncontrolled helo.
local group=groupset:GetFirst() --Wrapper.Group#GROUP
group:StartUncontrolled()
-- Define AI Formation object.
CarrierFormationHelo = AI_FORMATION:New(Mother, groupset, "Helo Formation with Carrier", "Fly Formation.")
-- Formation parameters.
CarrierFormationHelo:FormationCenterWing(-150, 50, 20, 50, 100, 50)
CarrierFormationHelo:__Start(2)
end
--- When the helo is out of fuel, it will return to the carrier and should be delivered.
function warehouse.Stennis:OnAfterDelivered(From,Event,To,request)
local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
-- So we start another request.
if request.assignment=="Rescue Helo" then
warehouse.Stennis:__AddRequest(10, warehouse.Stennis, WAREHOUSE.Descriptor.GROUPNAME, "CH-53E", 1, nil, nil, nil, "Rescue Helo")
end
end
end
Example 12: Pause a Warehouse
This example shows how to pause and unpause a warehouse. In paused state, requests will not be processed but assets can be added and requests be added.
- Warehouse Batumi is paused after 10 seconds.
- Request from Berlin after 15 which will not be processed.
- New tank assets for Batumi after 20 seconds. This is possible also in paused state.
- Batumi unpaused after 30 seconds. Queued request from Berlin can be processed.
- Berlin is paused after 60 seconds.
- Berlin requests tanks from Batumi after 90 seconds. Request is not processed because Berlin is paused and not running.
- Berlin is unpaused after 120 seconds. Queued request for tanks from Batumi can not be processed.
Here is the code:
-- Start Warehouse at Batumi.
warehouse.Batumi:Start()
-- Start Warehouse Berlin.
warehouse.Berlin:Start()
-- Add 20 infantry groups and 5 tank platoons as assets at Batumi.
warehouse.Batumi:AddAsset("Infantry Platoon Alpha", 20)
-- Pause the warehouse after 10 seconds
warehouse.Batumi:__Pause(10)
-- Add a request from Berlin after 15 seconds. A request can be added but not be processed while warehouse is paused.
warehouse.Batumi:__AddRequest(15, warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 1)
-- New asset added after 20 seconds. This is possible even if the warehouse is paused.
warehouse.Batumi:__AddAsset(20, "Abrams", 5)
-- Unpause warehouse after 30 seconds. Now the request from Berlin can be processed.
warehouse.Batumi:__Unpause(30)
-- Pause warehouse Berlin
warehouse.Berlin:__Pause(60)
-- After 90 seconds request from Berlin for tanks.
warehouse.Batumi:__AddRequest(90, warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_TANK, 1)
-- After 120 seconds unpause Berlin.
warehouse.Berlin:__Unpause(120)
Example 13: Battlefield Air Interdiction
This example show how to couple the WAREHOUSE class with the AI.AI_BAI class. Four enemy targets have been located at the famous Kobuleti X. All three available Viggen 2-ship flights are assigned to kill at least one of the BMPs to complete their mission.
-- Start Warehouse at Kobuleti.
warehouse.Kobuleti:Start()
-- Add three 2-ship groups of Viggens.
warehouse.Kobuleti:AddAsset("Viggen 2ship", 3)
-- Self request for all Viggen assets.
warehouse.Kobuleti:AddRequest(warehouse.Kobuleti, WAREHOUSE.Descriptor.GROUPNAME, "Viggen 2ship", WAREHOUSE.Quantity.ALL, nil, nil, nil, "BAI")
-- Red targets at Kobuleti X (late activated).
local RedTargets=GROUP:FindByName("Red IVF Alpha")
-- Activate the targets.
RedTargets:Activate()
-- Do something with the spawned aircraft.
function warehouse.Kobuleti:OnAfterSelfRequest(From,Event,To,groupset,request)
local groupset=groupset --Core.Set#SET_GROUP
local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
if request.assignment=="BAI" then
for _,group in pairs(groupset:GetSetObjects()) do
local group=group --Wrapper.Group#GROUP
-- Start uncontrolled aircraft.
group:StartUncontrolled()
local BAI=AI_BAI_ZONE:New(ZONE:New("Patrol Zone Kobuleti"), 500, 1000, 500, 600, ZONE:New("Patrol Zone Kobuleti"))
-- Tell the program to use the object (in this case called BAIPlane) as the group to use in the BAI function
BAI:SetControllable(group)
-- Function checking if targets are still alive
local function CheckTargets()
local nTargets=RedTargets:GetSize()
local nInitial=RedTargets:GetInitialSize()
local nDead=nInitial-nTargets
local nRequired=1 -- Let's make this easy.
if RedTargets:IsAlive() and nDead < nRequired then
MESSAGE:New(string.format("BAI Mission: %d of %d red targets still alive. At least %d targets need to be eliminated.", nTargets, nInitial, nRequired), 5):ToAll()
else
MESSAGE:New("BAI Mission: The required red targets are destroyed.", 30):ToAll()
BAI:__Accomplish(1) -- Now they should fly back to the patrolzone and patrol.
end
end
-- Start scheduler to monitor number of targets.
local Check, CheckScheduleID = SCHEDULER:New(nil, CheckTargets, {}, 60, 60)
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function BAI:OnAfterAccomplish( Controllable, From, Event, To )
MESSAGE:New( "BAI Mission: Sending the Viggens back to base.", 30):ToAll()
Check:Stop(CheckScheduleID)
BAI:__RTB(1)
end
-- Start BAI
BAI:Start()
-- Engage after 5 minutes.
BAI:__Engage(300)
-- RTB after 30 min max.
BAI:__RTB(-30*60)
end
end
end
Example 14: Strategic Bombing
This example shows how to employ strategic bombers in a mission. Three B-52s are launched at Kobuleti with the assignment to wipe out the enemy warehouse at Sukhumi. The bombers will get a flight path and make their approach from the South at an altitude of 5000 m ASL. After their bombing run, they will return to Kobuleti and added back to stock.
-- Start warehouses
warehouse.Kobuleti:Start()
warehouse.Sukhumi:Start()
-- Add a strategic bomber assets
warehouse.Kobuleti:AddAsset("B-52H", 3)
-- Request bombers for specific task of bombing Sukhumi warehouse.
warehouse.Kobuleti:AddRequest(warehouse.Kobuleti, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.AIR_BOMBER, WAREHOUSE.Quantity.ALL, nil, nil, nil, "Bomb Sukhumi")
-- Specify assignment after bombers have been spawned.
function warehouse.Kobuleti:OnAfterSelfRequest(From, Event, To, groupset, request)
local groupset=groupset --Core.Set#SET_GROUP
-- Get assignment of this request.
local assignment=warehouse.Kobuleti:GetAssignment(request)
if assignment=="Bomb Sukhumi" then
for _,_group in pairs(groupset:GetSet()) do
local group=_group --Wrapper.Group#GROUP
-- Start uncontrolled aircraft.
group:StartUncontrolled()
-- Target coordinate!
local ToCoord=warehouse.Sukhumi:GetCoordinate():SetAltitude(5000)
-- Home coordinate.
local HomeCoord=warehouse.Kobuleti:GetCoordinate():SetAltitude(3000)
-- Task bomb Sukhumi warehouse using all bombs (2032) from direction 180 at altitude 5000 m.
local task=group:TaskBombing(warehouse.Sukhumi:GetCoordinate():GetVec2(), false, "All", nil , 180, 5000, 2032)
-- Define waypoints.
local WayPoints={}
-- Take off position.
WayPoints[1]=warehouse.Kobuleti:GetCoordinate():WaypointAirTakeOffParking()
-- Begin bombing run 20 km south of target.
WayPoints[2]=ToCoord:Translate(20*1000, 180):WaypointAirTurningPoint(nil, 600, {task}, "Bombing Run")
-- Return to base.
WayPoints[3]=HomeCoord:WaypointAirTurningPoint()
-- Land at homebase. Bombers are added back to stock and can be employed in later assignments.
WayPoints[4]=warehouse.Kobuleti:GetCoordinate():WaypointAirLanding()
-- Route bombers.
group:Route(WayPoints)
end
end
end
Example 15: Defining Off-Road Paths
For self propelled assets it is possible to define custom off-road paths from one warehouse to another via the WAREHOUSE.AddOffRoadPath function. The waypoints of a path are taken from late activated units. In this example, two paths have been defined between the warehouses Kobuleti and FARP London. Trucks are spawned at each warehouse and are guided along the paths to the other warehouse. Note that if more than one path was defined, each asset group will randomly select its route.
-- Start warehouses
warehouse.Kobuleti:Start()
warehouse.London:Start()
-- Define a polygon zone as spawn zone at Kobuleti.
warehouse.Kobuleti:SetSpawnZone(ZONE_POLYGON:New("Warehouse Kobuleti Spawn Zone", GROUP:FindByName("Warehouse Kobuleti Spawn Zone")))
-- Add assets.
warehouse.Kobuleti:AddAsset("M978", 20)
warehouse.London:AddAsset("M818", 20)
-- Off two road paths from Kobuleti to London. The reverse path from London to Kobuleti is added automatically.
warehouse.Kobuleti:AddOffRoadPath(warehouse.London, GROUP:FindByName("Warehouse Kobuleti-London OffRoad Path 1"))
warehouse.Kobuleti:AddOffRoadPath(warehouse.London, GROUP:FindByName("Warehouse Kobuleti-London OffRoad Path 2"))
-- London requests all available trucks from Kobuleti.
warehouse.Kobuleti:AddRequest(warehouse.London, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_TRUCK, WAREHOUSE.Quantity.ALL)
-- Kobuleti requests all available trucks from London.
warehouse.London:AddRequest(warehouse.Kobuleti, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_TRUCK, WAREHOUSE.Quantity.HALF)
Example 16: Resupply of Dead Assets
Warehouse at FARP Berlin is located at the front line and sends infantry groups to the battle zone. Whenever a group dies, a new group is send from the warehouse to the battle zone. Additionally, for each dead group, Berlin requests resupply from Batumi.
-- Start warehouses.
warehouse.Batumi:Start()
warehouse.Berlin:Start()
-- Front line warehouse.
warehouse.Berlin:AddAsset("Infantry Platoon Alpha", 6)
-- Resupply warehouse.
warehouse.Batumi:AddAsset("Infantry Platoon Alpha", 50)
-- Battle zone near FARP Berlin. This is where the action is!
local BattleZone=ZONE:New("Virtual Battle Zone")
-- Send infantry groups to the battle zone. Two groups every ~60 seconds.
for i=1,2 do
local time=(i-1)*60+10
warehouse.Berlin:__AddRequest(time, warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 2, nil, nil, nil, "To Battle Zone")
end
-- Take care of the spawned units.
function warehouse.Berlin:OnAfterSelfRequest(From,Event,To,groupset,request)
local groupset=groupset --Core.Set#SET_GROUP
local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
-- Get assignment of this request.
local assignment=warehouse.Berlin:GetAssignment(request)
if assignment=="To Battle Zone" then
for _,group in pairs(groupset:GetSet()) do
local group=group --Wrapper.Group#GROUP
-- Route group to Battle zone.
local ToCoord=BattleZone:GetRandomCoordinate()
group:RouteGroundOnRoad(ToCoord, group:GetSpeedMax()*0.8)
-- After 3-5 minutes we create an explosion to destroy the group.
SCHEDULER:New(nil, Explosion, {group, 50}, math.random(180, 300))
end
end
end
-- An asset has died ==> request resupply for it.
function warehouse.Berlin:OnAfterAssetDead(From, Event, To, asset, request)
local asset=asset --Functional.Warehouse#WAREHOUSE.Assetitem
local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
-- Get assignment.
local assignment=warehouse.Berlin:GetAssignment(request)
-- Request resupply for dead asset from Batumi.
warehouse.Batumi:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, asset.attribute, nil, nil, nil, nil, "Resupply")
-- Send asset to Battle zone either now or when they arrive.
warehouse.Berlin:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, asset.attribute, 1, nil, nil, nil, assignment)
end
Example 17: Supply Chains
Our remote warehouse "Pampa" south of Batumi needs assets but does not have any air infrastructure (FARP or airdrome). Leopard 2 tanks are transported from Kobuleti to Batumi using two C-17As. From there they go be themselfs to Pampa. Eight infantry groups and two mortar groups are also being transferred from Kobuleti to Batumi by helicopter. The infantry has a higher priority and will be transported first using all available Mi-8 helicopters. Once infantry has arrived at Batumi, it will walk by itself to warehouse Pampa. The mortars can only be transported once the Mi-8 helos are available again, i.e. when the infantry has been delivered. Once the mortars arrive at Batumi, they will be transported by APCs to Pampa.
-- Start warehouses.
warehouse.Kobuleti:Start()
warehouse.Batumi:Start()
warehouse.Pampa:Start()
-- Add assets to Kobuleti warehouse, which is our main hub.
warehouse.Kobuleti:AddAsset("C-130", 2)
warehouse.Kobuleti:AddAsset("C-17A", 2, nil, 77000)
warehouse.Kobuleti:AddAsset("Mi-8", 2, WAREHOUSE.Attribute.AIR_TRANSPORTHELO, nil, nil, nil, AI.Skill.EXCELLENT, {"Germany", "United Kingdom"})
warehouse.Kobuleti:AddAsset("Leopard 2", 10, nil, nil, 62000, 500)
warehouse.Kobuleti:AddAsset("Mortar Alpha", 10, nil, nil, 210)
warehouse.Kobuleti:AddAsset("Infantry Platoon Alpha", 20)
-- Transports at Batumi.
warehouse.Batumi:AddAsset("SPz Marder", 2)
warehouse.Batumi:AddAsset("TPz Fuchs", 2)
-- Tanks transported by plane from from Kobuleti to Batumi.
warehouse.Kobuleti:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_TANK, 2, WAREHOUSE.TransportType.AIRPLANE, 2, 10, "Assets for Pampa")
-- Artillery transported by helicopter from Kobuleti to Batumi.
warehouse.Kobuleti:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_ARTILLERY, 2, WAREHOUSE.TransportType.HELICOPTER, 2, 30, "Assets for Pampa via APC")
-- Infantry transported by helicopter from Kobuleti to Batumi.
warehouse.Kobuleti:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 8, WAREHOUSE.TransportType.HELICOPTER, 2, 20, "Assets for Pampa")
--- Function handling assets delivered from Kobuleti warehouse.
function warehouse.Kobuleti:OnAfterDelivered(From, Event, To, request)
local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
-- Get assignment.
local assignment=warehouse.Kobuleti:GetAssignment(request)
-- Check if these assets were meant for Warehouse Pampa.
if assignment=="Assets for Pampa via APC" then
-- Forward everything that arrived at Batumi to Pampa via APC.
warehouse.Batumi:AddRequest(warehouse.Pampa, WAREHOUSE.Descriptor.ATTRIBUTE, request.cargoattribute, request.ndelivered, WAREHOUSE.TransportType.APC, WAREHOUSE.Quantity.ALL)
end
end
-- Forward all mobile ground assets to Pampa once they arrived.
function warehouse.Batumi:OnAfterNewAsset(From, Event, To, asset, assignment)
local asset=asset --Functional.Warehouse#WAREHOUSE.Assetitem
if assignment=="Assets for Pampa" then
if asset.category==Group.Category.GROUND and asset.speedmax>0 then
warehouse.Batumi:AddRequest(warehouse.Pampa, WAREHOUSE.Descriptor.GROUPNAME, asset.templatename)
end
end
end
Global _WAREHOUSEDB |
Type(s)
Fields and Methods inherited from WAREHOUSE | Description |
---|---|
Trigger the FSM event "AddAsset". |
|
Add an off-road path from this warehouse to another and back. |
|
Triggers the FSM event "AddRequest". |
|
Add a shipping lane from this warehouse to another remote warehouse. |
|
Triggers the FSM event "AirbaseCaptured" when the airbase of the warehouse has been captured by another coalition. |
|
Triggers the FSM event "AirbaseRecaptured" when the airbase of the warehouse has been re-captured from the other coalition. |
|
Triggers the FSM event "Arrived" when a group has arrived at the destination warehouse. |
|
Triggers the FSM event "AssetDead" when an asset group has died. |
|
Triggers the FSM event "AssetLowFuel" when an asset runs low on fuel |
|
Triggers the FSM event "AssetSpawned" when the warehouse has spawned an asset. |
|
Triggers the FSM event "Attacked" when a warehouse is under attack by an another coalition. |
|
Triggers the FSM event "Captured" when a warehouse has been captured by another coalition. |
|
Triggers the FSM event "ChangeCountry" so the warehouse is respawned with the new country. |
|
Name of the class. |
|
If true, send debug messages to all. |
|
Triggers the FSM event "Defeated" when an attack from an enemy was defeated. |
|
Triggers the FSM event "Delivered". |
|
Triggers the FSM event "Destroyed" when the warehouse was destroyed. |
|
Filter stock assets by descriptor and attribute. |
|
Find an asset in the the global warehouse data base. |
|
WAREHOUSE:FindNearestWarehouse(MinAssets, Descriptor, DescriptorValue, Coalition, RefCoordinate) |
Find nearest warehouse in service, i.e. |
Find a warehouse in the global warehouse data base. |
|
Get airbase associated to the warehouse. |
|
Get category of airbase associated to the warehouse. |
|
Get name airbase associated to the warehouse. |
|
Get a warehouse asset from its unique id. |
|
Get a warehouse asset from its name. |
|
Get assignment of a request. |
|
Get coalition side of warehouse static. |
|
Get coalition name of warehouse static. |
|
Get coordinate of warehouse static. |
|
Get country id of warehouse static. |
|
Get country name of warehouse static. |
|
WAREHOUSE:GetNumberOfAssets(Descriptor, DescriptorValue, OnlyMobile) |
Get number of assets in warehouse stock. |
Get a warehouse request from its unique id. |
|
Check if runway is operational. |
|
Get the spawn zone. |
|
Returns the number of assets for each generalized attribute. |
|
Get 2D vector of warehouse static. |
|
Get 3D vector of warehouse static. |
|
Get the warehouse zone. |
|
WAREHOUSE:HasConnectionNaval(warehouse, markpath, smokepath) |
Check if the warehouse has a shipping lane defined to another warehouse. |
WAREHOUSE:HasConnectionOffRoad(warehouse, markpath, smokepath) |
Check if the warehouse has an off road path defined to another warehouse. |
Check if the warehouse has a railroad connection to another warehouse. |
|
Check if the warehouse has a road connection to another warehouse. |
|
Check if the warehouse is under attack by another coalition. |
|
Check if the warehouse has been destroyed. |
|
Check if the warehouse has been loaded from disk via the "Load" event. |
|
Check if the warehouse has not been started yet, i.e. |
|
Check if the warehouse is paused. |
|
Check if the warehouse is running. |
|
Check if runway is operational. |
|
Check if warehouse physical representation is a ship. |
|
Check if warehouse physical representation is a static (not a unit) object. |
|
Check if the warehouse is stopped. |
|
Check if warehouse physical representation is a unit (not a static) object. |
|
Triggers the FSM event "Load" when the warehouse is loaded from a file on disk. |
|
The WAREHOUSE constructor. |
|
Triggers the FSM delayed event "NewAsset" when a new asset has been added to the warehouse stock. |
|
WAREHOUSE:OnAfterAirbaseCaptured(From, Event, To, Coalition) |
On after "AirbaseCaptured" even user function. |
WAREHOUSE:OnAfterAirbaseRecaptured(From, Event, To, Coalition) |
On after "AirbaseRecaptured" event user function. |
On after "Arrived" event user function. |
|
On after "AssetDead" event user function. |
|
WAREHOUSE:OnAfterAssetLowFuel(From, Event, To, asset, request) |
On after "AssetLowFuel" event user function. |
WAREHOUSE:OnAfterAssetSpawned(From, Event, To, group, asset, request) |
On after "AssetSpawned" event user function. |
WAREHOUSE:OnAfterAttacked(From, Event, To, Coalition, Country) |
On after "Attacked" event user function. |
WAREHOUSE:OnAfterCaptured(From, Event, To, Coalition, Country) |
On after "Captured" event user function. |
On after "ChangeCountry" event user function. |
|
On after "Defeated" event user function. |
|
On after "Delivered" event user function. |
|
On after "Destroyed" event user function. |
|
On after "Load" event user function. |
|
WAREHOUSE:OnAfterNewAsset(From, Event, To, asset, assignment) |
On after "NewAsset" event user function. |
On after "Request" user function. |
|
On after "Respawn" event user function. |
|
On after "Save" event user function. |
|
WAREHOUSE:OnAfterSelfRequest(From, Event, To, groupset, request) |
On after "SelfRequest" event. |
On before "Request" user function. |
|
Triggers the FSM event "Pause". |
|
If true, send status messages to coalition. |
|
Triggers the FSM event "Request". |
|
Triggers the FSM event "Respawn". |
|
Triggers the FSM event "Restart". |
|
Triggers the FSM event "Save" when the warehouse assets are saved to file on disk. |
|
Triggers the FSM event "SelfRequest". |
|
Set the airbase belonging to this warehouse. |
|
Set wether client parking spots can be used for spawning. |
|
Set auto defence off. |
|
Set auto defence on. |
|
Set debug mode off. |
|
Set debug mode on. |
|
Add a Harbor Zone for this warehouse where naval cargo units will spawn and be received. |
|
Set low fuel threshold. |
|
Show or don't show markers on the F10 map displaying the Warehouse stock and road/rail connections. |
|
Set valid parking spot IDs. |
|
Set the port zone for this warehouse. |
|
Set the connection of the warehouse to the railroad. |
|
Set report off. |
|
Set report on. |
|
Set respawn after destroy. |
|
Set the connection of the warehouse to the road. |
|
Set the time until the runway(s) of an airdrome are repaired after it has been destroyed. |
|
Disable safe parking option. |
|
Enable safe parking option, i.e. |
|
Enable auto save of warehouse assets at mission end event. |
|
Set a zone where the (ground) assets of the warehouse are spawned once requested. |
|
Set interval of status updates. |
|
Set verbosity level. |
|
Set a warehouse zone. |
|
Triggers the FSM event "Start". |
|
Triggers the FSM event "Status". |
|
Triggers the FSM event "Stop". |
|
Triggers the FSM event "Unpause". |
|
Task function for last waypoint. |
|
Asset item characteristics. |
|
Checks if the associated airbase still belongs to the warehouse. |
|
Function that checks if an asset group is still okay. |
|
Checks if the warehouse zone was conquered by antoher coalition. |
|
Checks fuel on all pening assets. |
|
Check parking ID for an asset. |
|
Check parking ID. |
|
Sorts the queue and checks if the request can be fulfilled. |
|
Checks if the request can be fulfilled in general. |
|
Checks if the request can be fulfilled right now. |
|
Check if a request is valid in general. |
|
Debug message. |
|
Delete item from queue. |
|
Delete item from queue. |
|
Delete an asset item from stock. |
|
Display status of warehouse. |
|
Display stock items of warehouse. |
|
Error message. |
|
WAREHOUSE:_FilterStock(stock, descriptor, attribute, nmax, mobile) |
Filter stock assets by table entry. |
Seach unoccupied parking spots at the airbase for a list of assets. |
|
Fireworks! |
|
Get the generalized attribute of a group. |
|
Make a flight plan from a departure to a destination airport. |
|
Get warehouse id, asset id and request id from group name (alias). |
|
Get warehouse id, asset id and request id from group name (alias). |
|
WAREHOUSE:_GetMaxHeight(D, alphaC, alphaD, Hdep, Hdest, Deltahhold) |
Calculate the maximum height an aircraft can reach for the given parameters. |
Get group name without any spawn or cargo suffix #CARGO etc. |
|
Size of the bounding box of a DCS object derived from the DCS descriptor table. |
|
Get the request belonging to a group. |
|
Get text about warehouse stock. |
|
Get the proper terminal type based on generalized attribute of the group. |
|
Get (optimized) transport carriers for the given assets to be transported. |
|
Is the group a used as transporter for a given request? |
|
Check if a group has a generalized attribute. |
|
Info Message. |
|
Function that checks if a pending job is done and can be removed from queue. |
|
Create a new path from a template group. |
|
Arrived event if an air unit/group arrived at its destination. |
|
Warehouse event handling function. |
|
Warehouse event function, handling the birth of a unit. |
|
Warehouse event handling function. |
|
Function handling the event when a (warehouse) unit shuts down its engines. |
|
Function handling the event when a (warehouse) unit starts its engines. |
|
Function handling the event when a (warehouse) unit lands. |
|
Warehouse event handling function. |
|
Function handling the event when a (warehouse) unit takes off. |
|
Task function for when passing a waypoint. |
|
Prints the queue to DCS.log file. |
|
Relative to absolute quantity. |
|
Register new asset in globase warehouse data base. |
|
Route the airplane from one airbase another. |
|
Route ground units to destination. |
|
Route naval units along user defined shipping lanes to destination warehouse. |
|
Route trains to their destination - or at least to the closest point on rail of the desired final destination. |
|
Simple task function. |
|
Simple task function. |
|
Sort requests queue wrt prio and request uid. |
|
WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrolled, lateactivated) |
Spawn an aircraft asset (plane or helo) at the airbase associated with the warehouse. |
WAREHOUSE:_SpawnAssetGroundNaval(alias, asset, request, spawnzone, lateactivated) |
Spawn a ground or naval asset in the corresponding spawn zone of the warehouse. |
Prepare a spawn template for the asset. |
|
Spawns requested assets at warehouse or associated airbase. |
|
A unit of a group just died. |
|
Create or update mark text at warehouse, which is displayed in F10 map showing how many assets of each type are in stock. |
|
Trigger the FSM event "AddAsset" with a delay. |
|
Triggers the FSM event "AddRequest" with a delay. |
|
Triggers the FSM event "AirbaseCaptured" with a delay when the airbase of the warehouse has been captured by another coalition. |
|
Triggers the FSM event "AirbaseRecaptured" with a delay when the airbase of the warehouse has been re-captured from the other coalition. |
|
Triggers the FSM event "Arrived" after a delay when a group has arrived at the destination. |
|
Triggers the delayed FSM event "AssetDead" when an asset group has died. |
|
Triggers the FSM event "AssetLowFuel" with a delay when an asset runs low on fuel. |
|
Triggers the FSM event "AssetSpawned" with a delay when the warehouse has spawned an asset. |
|
Triggers the FSM event "Attacked" with a delay when a warehouse is under attack by an another coalition. |
|
Triggers the FSM event "Captured" with a delay when a warehouse has been captured by another coalition. |
|
Triggers the FSM event "ChangeCountry" after a delay so the warehouse is respawned with the new country. |
|
Triggers the FSM event "Defeated" with a delay when an attack from an enemy was defeated. |
|
Triggers the FSM event "Delivered" after a delay. |
|
Triggers the FSM event "Destroyed" with a delay when the warehouse was destroyed. |
|
Triggers the FSM event "Load" with a delay when the warehouse assets are loaded from disk. |
|
Triggers the FSM delayed event "NewAsset" when a new asset has been added to the warehouse stock. |
|
Triggers the FSM event "Pause" after a delay. |
|
Triggers the FSM event "Request" after a delay. |
|
Triggers the FSM event "Respawn" after a delay. |
|
Triggers the FSM event "Restart" after a delay. |
|
Triggers the FSM event "Save" with a delay when the warehouse assets are saved to a file. |
|
Triggers the FSM event "SelfRequest" with a delay. |
|
Triggers the FSM event "Start" after a delay. |
|
Triggers the FSM event "Status" after a delay. |
|
Triggers the FSM event "Stop" after a delay. |
|
Triggers the FSM event "Unpause" after a delay. |
|
Airbase the warehouse belongs to. |
|
Name of the airbase associated to the warehouse. |
|
Alias of the warehouse. Name its called when sending messages. |
|
When the warehouse is under attack, automatically spawn assets to defend the warehouse. |
|
Automatically save assets to file when mission ends. |
|
File name of the auto asset save file. Default is auto generated from warehouse id and name. |
|
Path where the asset file is saved on auto save. |
|
Time interval in seconds of updating the warehouse status and processing new events. Default 30 seconds. |
|
Table holding all defending requests, i.e. self requests that were if the warehouse is under attack. Table elements are of type WAREHOUSE.Pendingitem. |
|
Table holding all delivered requests. Table elements are #boolean. If true, all cargo has been delivered. |
|
Flight control of this warehouse. |
|
If |
|
If |
|
Low fuel threshold. Triggers the event AssetLowFuel if for any unit fuel goes below this number. |
|
If true, markers are displayed on the F10 map. |
|
Rail road connection. |
|
Road connection. |
|
Marker warehouse. |
|
ID of the warehouse marker at the airbase. |
|
Table holding user defined paths from one warehouse to another. |
|
On after "AddAsset" event. |
|
On after "AddRequest" event. |
|
WAREHOUSE:onafterAirbaseCaptured(From, Event, To, Coalition) |
On after "AirbaseCaptured" event. |
WAREHOUSE:onafterAirbaseRecaptured(From, Event, To, Coalition) |
On after "AirbaseRecaptured" event. |
On after "Arrived" event. |
|
On after "AssetDead" event triggered when an asset group died. |
|
WAREHOUSE:onafterAssetSpawned(From, Event, To, group, asset, request) |
On after "AssetSpawned" event triggered when an asset group is spawned into the cruel world. |
WAREHOUSE:onafterAttacked(From, Event, To, Coalition, Country) |
On after "Attacked" event. |
WAREHOUSE:onafterCaptured(From, Event, To, Coalition, Country) |
On after "Captured" event. |
On after "ChangeCountry" event. |
|
On after "Defeated" event. |
|
On after "Delivered" event. |
|
On after "Destroyed" event. |
|
On after "Load" event. |
|
WAREHOUSE:onafterNewAsset(From, Event, To, asset, assignment) |
On after "NewAsset" event. |
On after "Pause" event. |
|
On after "Request" event. |
|
WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet, TransportGroupSet) |
On after "RequestSpawned" event. |
Respawn warehouse. |
|
On after "Restart" event. |
|
On after "RunwayDestroyed" event. |
|
On after "RunwayRepaired" event. |
|
On after "Save" event. |
|
WAREHOUSE:onafterSelfRequest(From, Event, To, groupset, request) |
On after "SelfRequest" event. |
On after Start event. |
|
On after Status event. |
|
On after "Stop" event. |
|
On after "Unloaded" event. |
|
On after "Unpause" event. |
|
On before "AddRequest" event. |
|
On before "Arrived" event. |
|
WAREHOUSE:onbeforeCaptured(From, Event, To, Coalition, Country) |
On before "Captured" event. |
On before "ChangeCountry" event. |
|
On before "Load" event. |
|
On before "Request" event. |
|
Table holding all pending requests, i.e. those that are currently in progress. Table elements are of type WAREHOUSE.Pendingitem. |
|
Zone defining the port of a warehouse. This is where naval assets are spawned. |
|
Table holding all queued requests. Table entries are of type WAREHOUSE.Queueitem. |
|
Unit id of each request in the queue. Essentially a running number starting at one and incremented when a new request is added. |
|
Closest point to warehouse on rail. |
|
If true, warehouse is respawned after it was destroyed. Assets are kept. |
|
Delay before respawn in seconds. |
|
Closest point to warehouse on road. |
|
Time stamp timer.getAbsTime() when the runway was destroyed. |
|
Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour). |
|
If true, parking spots for aircraft are considered as occupied if e.g. a client aircraft is parked there. Default false. |
|
Table holding the user defined shipping between warehouses. |
|
Zone in which assets are spawned. |
|
Max distance between warehouse and spawn zone. Default 5000 meters. |
|
Table holding all assets in stock. Table entries are of type WAREHOUSE.Assetitem. |
|
Table holding assets currently transporting cargo assets. |
|
Unique ID of the warehouse. |
|
Verbosity level. |
|
Warehouse class version. |
|
The phyical warehouse structure. |
|
Identifier of the warehouse printed before other output to DCS.log file. |
|
Zone around the warehouse. If this zone is captured, the warehouse and all its assets goes to the capturing coalition. |
Fields and Methods inherited from FSM | Description |
---|---|
Adds an End state. |
|
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task. |
|
Adds a score for the FSM to be achieved. |
|
WAREHOUSE:AddScoreProcess(From, Event, State, ScoreText, Score) |
Adds a score for the FSM_PROCESS to be achieved. |
Add a new transition rule to the FSM. |
|
Call scheduler. |
|
Name of the class. |
|
Get current state. |
|
Returns the End states. |
|
Returns a table of the SubFSM rules defined within the FSM. |
|
Returns a table with the scores defined. |
|
Returns the start state of the FSM. |
|
Get current state. |
|
Returns a table with the Subs defined. |
|
Returns a table of the transition rules defined within the FSM. |
|
Check if FSM is in state. |
|
Load call backs. |
|
Creates a new FSM object. |
|
Scores. |
|
Sets the start state of the FSM. |
|
Add to map. |
|
Call handler. |
|
Create transition. |
|
Delayed transition. |
|
Event map. |
|
Go sub. |
|
Handler. |
|
Is end state. |
|
Sub maps. |
|
Check if can do an event. |
|
Check if cannot do an event. |
|
Current state name. |
|
Check if FSM is in state. |
|
Options. |
|
Subs. |
Fields and Methods inherited from BASE | Description |
---|---|
The ID number of the class. |
|
The name of the class. |
|
The name of the class concatenated with the ID number of the class. |
|
Clear the state of an object. |
|
WAREHOUSE:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace) |
Creation of a Birth Event. |
WAREHOUSE:CreateEventCrash(EventTime, Initiator, IniObjectCategory) |
Creation of a Crash Event. |
WAREHOUSE:CreateEventDead(EventTime, Initiator, IniObjectCategory) |
Creation of a Dead Event. |
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event. |
|
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event. |
|
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event. |
|
Creation of a |
|
Creation of a Remove Unit Event. |
|
Creation of a Takeoff Event. |
|
Creation of a Crash Event. |
|
Log an exception which will be traced always. |
|
Returns the event dispatcher |
|
Remove all subscribed events |
|
Trace a function call. |
|
Trace a function call level 2. |
|
Trace a function call level 3. |
|
Get the ClassID of the class instance. |
|
Get the ClassName of the class instance. |
|
Get the ClassName + ClassID of the class instance. |
|
Get the Class Core.Event processing Priority. |
|
This is the worker method to retrieve the Parent class. |
|
Get a Value given a Key from the Object. |
|
Subscribe to a DCS Event. |
|
Log an information which will be traced always. |
|
This is the worker method to inherit from a parent class. |
|
This is the worker method to check if an object is an (sub)instance of a class. |
|
Enquires if tracing is on (for the class). |
|
BASE constructor. |
|
Occurs when an Event for an object is triggered. |
|
BDA. |
|
Occurs when a ground unit captures either an airbase or a farp. |
|
Occurs when any object is spawned into the mission. |
|
Occurs when any aircraft crashes into the ground and is completely destroyed. |
|
Occurs when an object is dead. |
|
Unknown precisely what creates this event, likely tied into newer damage model. |
|
Discard chair after ejection. |
|
Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo. |
|
Occurs when a dynamic cargo crate is removed. |
|
Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo. |
|
Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when any aircraft shuts down its engines. |
|
Occurs when any aircraft starts its engines. |
|
Occurs whenever an object is hit by a weapon. |
|
Occurs when any system fails on a human controlled aircraft. |
|
Occurs on the death of a unit. |
|
Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up. |
|
Landing quality mark. |
|
Occurs when a new mark was added. |
|
Occurs when a mark text was changed. |
|
Occurs when a mark was removed. |
|
Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes. |
|
Occurs when a player creates a dynamic cargo object from the F8 ground crew menu. |
|
Weapon add. |
|
Occurs when the pilot of an aircraft is killed. |
|
Occurs when a player enters a slot and takes control of an aircraft. |
|
Occurs when any player assumes direct control of a unit. |
|
Occurs when any player relieves control of a unit to the AI. |
|
Occurs when an aircraft connects with a tanker and begins taking on fuel. |
|
Occurs when an aircraft is finished taking fuel. |
|
Occurs when any modification to the "Score" as seen on the debrief menu would occur. |
|
Occurs when any unit stops firing its weapon. |
|
Occurs when any unit begins firing a weapon that has a high rate of fire. |
|
Occurs whenever any unit in a mission fires a weapon. |
|
Occurs when an aircraft takes off from an airbase, farp, or ship. |
|
Trigger zone. |
|
Occurs when the game thinks an object is destroyed. |
|
Schedule a new time event. |
|
WAREHOUSE:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...) |
Schedule a new time event. |
Stops the Schedule. |
|
Set the Class Core.Event processing Priority. |
|
Set a state or property of the Object given a Key and a Value. |
|
Trace a function logic level 1. |
|
Trace a function logic level 2. |
|
Trace a function logic level 3. |
|
Trace all methods in MOOSE |
|
Set tracing for a class |
|
Set tracing for a specific method of class |
|
Set trace level |
|
Set trace off. |
|
Set trace on. |
|
Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default. |
|
UnSubscribe to a DCS event. |
|
WAREHOUSE:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function call. |
(Internal) Serialize arguments |
|
WAREHOUSE:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function logic. |
The main event handling function... |
Fields and Methods inherited from WAREHOUSE.Assetitem | Description |
---|---|
All DCS descriptors. |
|
Time stamp when asset returned to its legion (airwing, brigade). |
|
If true, asset arrived at its destination. |
|
Assignment of the asset. This could, e.g., be used in the @{#WAREHOUSE.OnAfterNewAsset) function. |
|
Generalized attribute of the group. |
|
Array of cargo bays of all units in an asset group. |
|
Largest cargo bay of all units in the group. |
|
Total weight in kg that fits in the cargo bay of all asset group units. |
|
Category of the group. |
|
The cohort this asset belongs to. |
|
Damage of asset group in percent. |
|
The flightgroup object. |
|
If |
|
If true, asset is cargo. If false asset is transport. Nil if in stock. |
|
The legion this asset belonts to. |
|
Livery of the asset. |
|
Distance when cargo is loaded into the carrier. |
|
Number of units in the group. |
|
The payload of the asset. |
|
Range of the unit in meters. |
|
If |
|
Request ID of this asset (if any). |
|
Maximum size in length and with of the asset in meters. |
|
Skill of AI unit. |
|
If true, asset was spawned into the cruel world. If false, it is still in stock. |
|
Name of the spawned group. |
|
Maximum speed in km/h the group can do. |
|
Name of the squadron this asset belongs to. |
|
The spawn template of the group. |
|
Name of the template group. |
|
Unique id of the asset. |
|
Type of the first unit of the group as obtained by the Object.getTypeName() DCS API function. |
|
The weight of the whole asset group in kilograms. |
|
ID of the warehouse this asset belongs to. |
Fields and Methods inherited from WAREHOUSE.Attribute | Description |
---|---|
Attack helicopter. |
|
Airborne Early Warning and Control System. |
|
Aircraft which can be used for strategic bombing. |
|
Fighter, interceptor, ... airplane. |
|
Any airborne unit that does not fall into any other airborne category. |
|
Airplane which can refuel other aircraft. |
|
Helicopter with transport capability. This can be used to transport other assets. |
|
Airplane with transport capability. This can be used to transport other assets. |
|
Unpiloted Aerial Vehicle, e.g. drones. |
|
Anti-Aircraft Artillery. |
|
Infantry carriers, in particular Amoured Personell Carrier. This can be used to transport other assets. |
|
Artillery assets. |
|
Early Warning Radar. |
|
Ground infantry fighting vehicle. |
|
Ground infantry assets. |
|
Any ground unit that does not fall into any other ground category. |
|
Surface-to-Air Missile system or components. |
|
Tanks (modern or old). |
|
Trains. Not that trains are not yet properly implemented in DCS and cannot be used currently. |
|
Unarmed ground vehicles, which has the DCS "Truck" attribute. |
|
Aircraft carrier. |
|
Any armed ship that is not an aircraft carrier, a cruiser, destroyer, firgatte or corvette. |
|
Any naval unit that does not fall into any other naval category. |
|
Any unarmed naval vessel. |
|
War ship, i.e. cruisers, destroyers, firgates and corvettes. |
|
Anything that does not fall into any other category. |
Fields and Methods inherited from WAREHOUSE.Descriptor | Description |
---|---|
List of specific assets gives as a table of assets. Mind the curly brackets {}. |
|
Assignment of asset when it was added. |
|
Generalized attribute WAREHOUSE.Attribute. |
|
Asset category of type DCS#Group.Category, i.e. GROUND, AIRPLANE, HELICOPTER, SHIP, TRAIN. |
|
Name of the asset template. |
|
Typename of the DCS unit, e.g. "A-10C". |
Fields and Methods inherited from WAREHOUSE.Pendingitem | Description |
---|---|
Table with assets that might have problems (damage or stuck). |
|
Set of cargo groups do be delivered. |
|
Table holding the cargo groups of each carrier unit. |
|
If true, at least one asset group is low on fuel. |
|
Number of groups delivered to destination. |
|
Number of transports back home. |
|
Absolute mission time in seconds when the request was processed. |
|
Set of cargo objects. |
|
Set of cargo transport carrier groups. |
Fields and Methods inherited from WAREHOUSE.Quantity | Description |
---|---|
All "all" assets currently in stock. |
|
Half "1/2" of assets in stock. |
|
One quarter "1/4" of assets in stock. |
|
One third "1/3" of assets in stock. |
|
Three quarters "3/4" of assets in stock. |
Fields and Methods inherited from WAREHOUSE.Queueitem | Description |
---|---|
The airbase beloning to requesting warehouse if any. |
|
Descriptor of the requested asset. Enumerator of type WAREHOUSE.Descriptor. |
|
Value of the asset descriptor. Type depends on "assetdesc" descriptor. |
|
Table of self propelled (or cargo) and transport assets. Each element of the table is a WAREHOUSE.Assetitem and can be accessed by their asset ID. |
|
A keyword or text that later be used to identify this request and postprocess the assets. |
|
Table of cargo (or self propelled) assets. Each element of the table is a WAREHOUSE.Assetitem. |
|
Attribute of cargo assets of type WAREHOUSE.Attribute. |
|
Category of cargo assets of type WAREHOUSE.Category. |
|
Category of the requesting airbase, i.e. airdrome, helipad/farp or ship. |
|
Assets are spawned in late activated state. |
|
Number of asset groups requested. |
|
Max. number of transport units requested. |
|
Priority of the request. Number between 1 (high) and 100 (low). |
|
Self request, i.e. warehouse requests assets from itself. |
|
Table of transport carrier assets. Each element of the table is a WAREHOUSE.Assetitem. |
|
Attribute of transport assets of type WAREHOUSE.Attribute. |
|
Category of transport assets of type WAREHOUSE.Category. |
|
Transport unit type. |
|
Unique id of the queue item. |
|
Requesting warehouse. |
Fields and Methods inherited from WAREHOUSE.TransportType | Description |
---|---|
Transports are carried out by airplanes. |
|
Transports are conducted by APCs. |
|
Transports are carried out by helicopters. |
|
Assets go to their destination by themselves. No transport carrier needed. |
|
Transports are conducted by ships. Not implemented yet. |
|
Transports are conducted by trains. Not implemented yet. Also trains are buggy in DCS. |
|
Fields and Methods inherited from _WAREHOUSEDB | Description |
---|---|
Unique ID of each asset. This is a running number, which is increased each time a new asset is added. |
|
Table holding registered assets, which are of type Functional.Warehouse#WAREHOUSE.Assetitem.# |
|
Unique ID of the warehouse. Running number. |
|
Table holding all defined #WAREHOUSE objects by their unique ids. |
WAREHOUSE class.
Field(s)
Name of the class.
If true, send debug messages to all.
If true, send status messages to coalition.
Name of the airbase associated to the warehouse.
Alias of the warehouse. Name its called when sending messages.
When the warehouse is under attack, automatically spawn assets to defend the warehouse.
Automatically save assets to file when mission ends.
File name of the auto asset save file. Default is auto generated from warehouse id and name.
Path where the asset file is saved on auto save.
Coalition of the warehouse.
Country of the warehouse.
Time interval in seconds of updating the warehouse status and processing new events. Default 30 seconds.
Table holding all defending requests, i.e. self requests that were if the warehouse is under attack. Table elements are of type WAREHOUSE.Pendingitem.
Table holding all delivered requests. Table elements are #boolean. If true, all cargo has been delivered.
If true
, warehouse is represented by a ship unit.
If true
, warehouse is represented by a unit instead of a static.
Set some string id for output to DCS.log file.
Low fuel threshold. Triggers the event AssetLowFuel if for any unit fuel goes below this number.
If true, markers are displayed on the F10 map.
ID of the warehouse marker at the airbase.
Table holding user defined paths from one warehouse to another.
Table holding all pending requests, i.e. those that are currently in progress. Table elements are of type WAREHOUSE.Pendingitem.
Zone defining the port of a warehouse. This is where naval assets are spawned.
Table holding all queued requests. Table entries are of type WAREHOUSE.Queueitem.
Unit id of each request in the queue. Essentially a running number starting at one and incremented when a new request is added.
If true, warehouse is respawned after it was destroyed. Assets are kept.
Delay before respawn in seconds.
Time stamp timer.getAbsTime() when the runway was destroyed.
Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
If true, parking spots for aircraft are considered as occupied if e.g. a client aircraft is parked there. Default false.
Table holding the user defined shipping between warehouses.
Max distance between warehouse and spawn zone. Default 5000 meters.
Table holding all assets in stock. Table entries are of type WAREHOUSE.Assetitem.
Table holding assets currently transporting cargo assets.
Unique ID of the warehouse.
Verbosity level.
Warehouse class version.
Identifier of the warehouse printed before other output to DCS.log file.
Zone around the warehouse. If this zone is captured, the warehouse and all its assets goes to the capturing coalition.
Function(s)
Trigger the FSM event "AddAsset".
Add a group to the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
Group to be added as new asset.
#number ngroups
(Optional) Number of groups to add to the warehouse stock. Default is 1.
#WAREHOUSE.Attribute forceattribute
(Optional) Explicitly force a generalized attribute for the asset. This has to be an WAREHOUSE.Attribute.
#number forcecargobay
(Optional) Explicitly force cargobay weight limit in kg for cargo carriers. This is for each unit of the group.
#number forceweight
(Optional) Explicitly force weight in kg of each unit in the group.
#number loadradius
(Optional) The distance in meters when the cargo is loaded into the carrier. Default is the bounding box size of the carrier.
DCS#AI.Skill skill
Skill of the asset.
#table liveries
Table of livery names. When the asset is spawned one livery is chosen randomly.
#string assignment
A free to choose string specifying an assignment for the asset. This can be used with the WAREHOUSE.OnAfterNewAsset function.
Add an off-road path from this warehouse to another and back.
The start and end points are automatically set to one random point in the respective spawn zones of the two warehouses. By default, the reverse path is also added as path from the remote warehouse to this warehouse.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE remotewarehouse
The remote warehouse to which the path leads.
Wrapper.Group#GROUP group
Waypoints of this group will define the path between to warehouses.
#boolean oneway
(Optional) If true, the path can only be used from this warehouse to the other but not other way around. Default false.
Return value:
self
Triggers the FSM event "AddRequest".
Add a request to the warehouse queue, which is processed when possible.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE warehouse
The warehouse requesting supply.
#WAREHOUSE.Descriptor AssetDescriptor
Descriptor describing the asset that is requested.
AssetDescriptorValue
Value of the asset descriptor. Type depends on descriptor, i.e. could be a string, etc.
#number nAsset
Number of groups requested that match the asset specification.
#WAREHOUSE.TransportType TransportType
Type of transport.
#number nTransport
Number of transport units requested.
#number Prio
Priority of the request. Number ranging from 1=high to 100=low.
#string Assignment
A keyword or text that later be used to identify this request and postprocess the assets.
Add a shipping lane from this warehouse to another remote warehouse.
Note that both warehouses must have a port zone defined before a shipping lane can be added! Shipping lane is taken from the waypoints of a (late activated) template group. So set up a group, e.g. a ship or a helicopter, and place its waypoints along the shipping lane you want to add.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE remotewarehouse
The remote warehouse to where the shipping lane is added
Wrapper.Group#GROUP group
Waypoints of this group will define the shipping lane between to warehouses.
#boolean oneway
(Optional) If true, the lane can only be used from this warehouse to the other but not other way around. Default false.
Return value:
self
Triggers the FSM event "AirbaseCaptured" when the airbase of the warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameter:
DCS#coalition.side Coalition
Coalition side which captured the airbase, i.e. a number of DCS#coalition.side enumerator.
Triggers the FSM event "AirbaseRecaptured" when the airbase of the warehouse has been re-captured from the other coalition.
Defined in:
WAREHOUSE
Parameter:
DCS#coalition.side Coalition
Coalition which re-captured the airbase, i.e. the same as the current warehouse owner coalition.
Triggers the FSM event "Arrived" when a group has arrived at the destination warehouse.
This function should always be called from the sending and not the receiving warehouse. If the group is a cargo asset, it is added to the receiving warehouse. If the group is a transporter it is added to the sending warehouse since carriers are supposed to return to their home warehouse once all cargo was delivered.
Triggers the FSM event "AssetDead" when an asset group has died.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE.Assetitem asset
The asset that is dead.
#WAREHOUSE.Pendingitem request
The request of the dead asset.
Triggers the FSM event "AssetLowFuel" when an asset runs low on fuel
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE.Assetitem asset
The asset that is low on fuel.
#WAREHOUSE.Pendingitem request
The request of the asset that is low on fuel.
Triggers the FSM event "AssetSpawned" when the warehouse has spawned an asset.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
the group that was spawned.
#WAREHOUSE.Assetitem asset
The asset that was spawned.
#WAREHOUSE.Pendingitem request
The request of the spawned asset.
Triggers the FSM event "Attacked" when a warehouse is under attack by an another coalition.
Defined in:
WAREHOUSE
Parameters:
DCS#coalition.side Coalition
Coalition side which is attacking the warehouse, i.e. a number of DCS#coalition.side enumerator.
DCS#country.id Country
Country ID, which is attacking the warehouse, i.e. a number DCS#country.id enumerator.
Triggers the FSM event "Captured" when a warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameters:
DCS#coalition.side Coalition
Coalition side which captured the warehouse.
DCS#country.id Country
Country id which has captured the warehouse.
Triggers the FSM event "ChangeCountry" so the warehouse is respawned with the new country.
Triggers the FSM event "Defeated" when an attack from an enemy was defeated.
Defined in:
WAREHOUSE
Triggers the FSM event "Delivered".
All (cargo) assets of a request have been delivered to the receiving warehouse.
Defined in:
WAREHOUSE
Parameter:
#WAREHOUSE.Pendingitem request
Pending request that was now delivered.
Triggers the FSM event "Destroyed" when the warehouse was destroyed.
Services are stopped.
Defined in:
WAREHOUSE
Filter stock assets by descriptor and attribute.
Defined in:
WAREHOUSE
Parameters:
#string descriptor
Descriptor describing the filtered assets.
attribute
Value of the descriptor.
#number nmax
(Optional) Maximum number of items that will be returned. Default nmax=nil is all matching items are returned.
#boolean mobile
(Optional) If true, filter only mobile assets.
Return values:
#table:
Filtered assets in stock with the specified descriptor value.
#number:
Total number of (requested) assets available.
#boolean:
If true, enough assets are available.
Find an asset in the the global warehouse data base.
Parameter is the MOOSE group object. Note that the group name must contain they "AID" keyword.
Defined in:
WAREHOUSE
Parameter:
Wrapper.Group#GROUP group
The group from which it is assumed that it has a registered asset.
Return value:
The asset from the data base or nil if it could not be found.
Find nearest warehouse in service, i.e.
warehouses which are not started, stopped or destroyed are not considered. Optionally, only warehouses with (specific) assets can be included in the search or warehouses of a certain coalition.
Defined in:
WAREHOUSE
Parameters:
MinAssets
(Optional) Minimum number of assets the warehouse should have. Default 0.
#string Descriptor
(Optional) Descriptor describing the selected assets which should be in stock. See WAREHOUSE.Descriptor for possible values.
DescriptorValue
(Optional) Descriptor value selecting the type of assets which should be in stock.
DCS#Coalition.side Coalition
(Optional) Coalition side of the warehouse. Default is the same coalition as the present warehouse. Set to false for any coalition.
Core.Point#COORDINATE RefCoordinate
(Optional) Coordinate to which the closest warehouse is searched. Default is the warehouse calling this function.
Return values:
The the nearest warehouse object. Or nil if no warehouse is found.
#number:
The distance to the nearest warehouse in meters. Or nil if no warehouse is found.
Find a warehouse in the global warehouse data base.
Defined in:
WAREHOUSE
Parameter:
#number uid
The unique ID of the warehouse.
Return value:
The warehouse object or nil if no warehouse exists.
Get airbase associated to the warehouse.
Defined in:
WAREHOUSE
Return value:
Airbase object or nil if warehouse has no airbase connection.
Get category of airbase associated to the warehouse.
Defined in:
WAREHOUSE
Return value:
#number:
Category of airbase or -1 if warehouse has (currently) no airbase.
Get name airbase associated to the warehouse.
Defined in:
WAREHOUSE
Return value:
#string:
name of the airbase assosicated to the warehouse or "none" if the airbase has not airbase connection currently.
Get a warehouse asset from its unique id.
Defined in:
WAREHOUSE
Parameter:
#number id
Asset ID.
Return value:
The warehouse asset.
Get a warehouse asset from its name.
Defined in:
WAREHOUSE
Parameter:
#string GroupName
Spawn group name.
Return value:
The warehouse asset.
Get assignment of a request.
Defined in:
WAREHOUSE
Parameter:
#WAREHOUSE.Pendingitem request
The request from which the assignment is extracted.
Return value:
#string:
The assignment text.
Get coalition side of warehouse static.
Get coalition name of warehouse static.
Get coordinate of warehouse static.
Get country id of warehouse static.
Get country name of warehouse static.
Get number of assets in warehouse stock.
Optionally, only specific assets can be counted.
Defined in:
WAREHOUSE
Parameters:
#string Descriptor
(Optional) Descriptor return the number of a specifc asset type. See WAREHOUSE.Descriptor for possible values.
DescriptorValue
(Optional) Descriptor value selecting the type of assets.
#boolean OnlyMobile
(Optional) If true only mobile units are considered.
Return value:
#number:
Number of assets in stock.
Get a warehouse request from its unique id.
Defined in:
WAREHOUSE
Parameter:
#number id
Request ID.
Return values:
The warehouse requested - either queued or pending.
#boolean:
If true, request is queued, if false, request is pending, if nil, request could not be found.
Check if runway is operational.
Defined in:
WAREHOUSE
Return value:
#number:
Time in seconds until the runway is repaired. Will return 0 if runway is repaired.
Get the spawn zone.
Returns the number of assets for each generalized attribute.
Defined in:
WAREHOUSE
Parameter:
#table stock
The stock of the warehouse.
Return value:
#table:
Data table holding the numbers, i.e. data[attibute]=n.
Get 2D vector of warehouse static.
Get 3D vector of warehouse static.
Get the warehouse zone.
Check if the warehouse has a shipping lane defined to another warehouse.
Check if the warehouse has an off road path defined to another warehouse.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE warehouse
The remote warehouse to where the connection is checked.
#boolean markpath
If true, place markers of path segments on the F10 map.
#boolean smokepath
If true, put green smoke on path segments.
Return values:
#boolean:
If true, the two warehouses are connected by road.
#number:
Path length in meters. Negative distance -1 meter indicates no connection.
Check if the warehouse has a railroad connection to another warehouse.
Both warehouses need to be started!
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE warehouse
The remote warehouse to where the connection is checked.
#boolean markpath
If true, place markers of path segments on the F10 map.
#boolean smokepath
If true, put green smoke on path segments.
Return values:
#boolean:
If true, the two warehouses are connected by road.
#number:
Path length in meters. Negative distance -1 meter indicates no connection.
Check if the warehouse has a road connection to another warehouse.
Both warehouses need to be started!
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE warehouse
The remote warehouse to where the connection is checked.
#boolean markpath
If true, place markers of path segments on the F10 map.
#boolean smokepath
If true, put green smoke on path segments.
Return values:
#boolean:
If true, the two warehouses are connected by road.
#number:
Path length in meters. Negative distance -1 meter indicates no connection.
Check if the warehouse is under attack by another coalition.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true, the warehouse is attacked.
Check if the warehouse has been destroyed.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true, the warehouse had been destroyed.
Check if the warehouse has been loaded from disk via the "Load" event.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true, the warehouse was loaded from disk.
Check if the warehouse has not been started yet, i.e.
is in the state "NotReadyYet".
Defined in:
WAREHOUSE
Return value:
#boolean:
If true, the warehouse object has been created but the warehouse has not been started yet.
Check if the warehouse is paused.
In this state, requests are not processed.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true, the warehouse is paused.
Check if the warehouse is running.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true, the warehouse is running and requests are processed.
Check if runway is operational.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true
, runway is operational.
Check if warehouse physical representation is a ship.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true
, warehouse object is a ship.
Check if warehouse physical representation is a static (not a unit) object.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true
, warehouse object is a static.
Check if the warehouse is stopped.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true, the warehouse is stopped.
Check if warehouse physical representation is a unit (not a static) object.
Defined in:
WAREHOUSE
Return value:
#boolean:
If true
, warehouse object is a unit.
Triggers the FSM event "Load" when the warehouse is loaded from a file on disk.
Defined in:
WAREHOUSE
Parameters:
#string path
Path where the file is located. Default is the DCS installation root directory.
#string filename
(Optional) File name. Default is WAREHOUSE-
The WAREHOUSE constructor.
Creates a new WAREHOUSE object from a static object. Parameters like the coalition and country are taken from the static object structure.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Static#STATIC warehouse
The physical structure representing the warehouse. Can also be a Wrapper.Unit#UNIT.
#string alias
(Optional) Alias of the warehouse, i.e. the name it will be called when sending messages etc. Default is the name of the static/unit representing the warehouse.
Return value:
self
Triggers the FSM delayed event "NewAsset" when a new asset has been added to the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE.Assetitem asset
The new asset.
#string assignment
(Optional) Assignment text for the asset.
On after "AirbaseCaptured" even user function.
Called when the airbase of the warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
Coalition side which captured the airbase, i.e. a number of DCS#coalition.side enumerator.
On after "AirbaseRecaptured" event user function.
Called when the airbase of the warehouse has been re-captured from the other coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
Coalition which re-captured the airbase, i.e. the same as the current warehouse owner coalition.
On after "Arrived" event user function.
Called when a group has arrived at its destination.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Group#GROUP group
Group that has arrived.
On after "AssetDead" event user function.
Called when an asset group died.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Assetitem asset
The asset that is dead.
#WAREHOUSE.Pendingitem request
The request of the dead asset.
On after "AssetLowFuel" event user function.
Called when the an asset is low on fuel.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Assetitem asset
The asset that is low on fuel.
#WAREHOUSE.Pendingitem request
The request of the asset that is low on fuel.
On after "AssetSpawned" event user function.
Called when the warehouse has spawned an asset.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Group#GROUP group
the group that was spawned.
#WAREHOUSE.Assetitem asset
The asset that was spawned.
#WAREHOUSE.Pendingitem request
The request of the spawned asset.
On after "Attacked" event user function.
Called when a warehouse (zone) is under attack by an enemy.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
Coalition side which is attacking the warehouse, i.e. a number of DCS#coalition.side enumerator.
DCS#country.id Country
Country ID, which is attacking the warehouse, i.e. a number DCS#country.id enumerator.
On after "Captured" event user function.
Called when the warehouse has been captured by an enemy coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
Coalition side which captured the warehouse, i.e. a number of DCS#coalition.side enumerator.
DCS#country.id Country
Country id which has captured the warehouse, i.e. a number DCS#country.id enumerator.
On after "ChangeCountry" event user function.
Called when the warehouse has changed its country.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#country.id Country
New country id of the warehouse, i.e. a number DCS#country.id enumerator.
On after "Defeated" event user function.
Called when an enemy attack was defeated.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Delivered" event user function.
Called when a group has been delivered from the warehouse to another warehouse.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Pendingitem request
Pending request that was now delivered.
On after "Destroyed" event user function.
Called when the warehouse was destroyed. Services are stopped.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Load" event user function.
Called when the warehouse assets are loaded from disk.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#string path
Path where the file is located. Default is the DCS installation root directory.
#string filename
(Optional) File name. Default is WAREHOUSE-
On after "NewAsset" event user function.
A new asset has been added to the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Assetitem asset
The asset that has just been added.
#string assignment
(Optional) Assignment text for the asset.
On after "Request" user function.
The necessary cargo and transport assets were spawned.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Queueitem Request
Information table of the request.
On after "Respawn" event user function.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Save" event user function.
Called when the warehouse assets are saved to disk.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#string path
Path where the file is saved. Default is the DCS installation root directory.
#string filename
(Optional) File name. Default is WAREHOUSE-
On after "SelfRequest" event.
Request was initiated from the warehouse to itself. Groups are simply spawned at the warehouse or the associated airbase. All requested assets are passed as a Core.Set#SET_GROUP and can be used for further tasks or in other MOOSE classes. Note that airborne assets are spawned in uncontrolled state so they do not simply "fly away" after spawning.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Core.Set#SET_GROUP groupset
The set of (cargo) groups that was delivered to the warehouse itself.
#WAREHOUSE.Pendingitem request
Pending self request.
Usage:
--- Self request event. Triggered once the assets are spawned in the spawn zone or at the airbase.
function mywarehouse:OnAfterSelfRequest(From, Event, To, groupset, request)
local groupset=groupset --Core.Set#SET_GROUP
-- Loop over all groups spawned from that request.
for _,group in pairs(groupset:GetSetObjects()) do
local group=group --Wrapper.Group#GROUP
-- Gree smoke on spawned group.
group:SmokeGreen()
-- Activate uncontrolled airborne group if necessary.
group:StartUncontrolled()
end
end
On before "Request" user function.
The necessary cargo and transport assets will be spawned. Time to set some additional asset parameters.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Queueitem Request
Information table of the request.
Triggers the FSM event "Pause".
Pauses the warehouse. Assets can still be added and requests be made. However, requests are not processed.
Defined in:
WAREHOUSE
Triggers the FSM event "Request".
Executes a request from the queue if possible.
Triggers the FSM event "Restart".
Restarts the warehouse from stopped state by reactivating the event handlers only.
Defined in:
WAREHOUSE
Triggers the FSM event "Save" when the warehouse assets are saved to file on disk.
Defined in:
WAREHOUSE
Parameters:
#string path
Path where the file is saved. Default is the DCS installation root directory.
#string filename
(Optional) File name. Default is WAREHOUSE-
Triggers the FSM event "SelfRequest".
Request was initiated from the warehouse to itself. Groups are just spawned at the warehouse or the associated airbase. If the warehouse is currently under attack when the self request is made, the self request is added to the defending table. One the attack is defeated, this request is used to put the groups back into the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
Core.Set#SET_GROUP groupset
The set of cargo groups that was delivered to the warehouse itself.
#WAREHOUSE.Pendingitem request
Pending self request.
Set the airbase belonging to this warehouse.
Note that it has to be of the same coalition as the warehouse. Also, be reasonable and do not put it too far from the phyiscal warehouse structure because you troops might have a long way to get to their transports.
Defined in:
WAREHOUSE
Parameter:
Wrapper.Airbase#AIRBASE airbase
The airbase object associated to this warehouse.
Return value:
self
Set wether client parking spots can be used for spawning.
Set auto defence off.
This is the default.
Set auto defence on.
When the warehouse is under attack, all ground assets are spawned automatically and will defend the warehouse zone.
Set debug mode off.
This is the default
Set debug mode on.
Error messages will be displayed on screen, units will be smoked at some events.
Add a Harbor Zone for this warehouse where naval cargo units will spawn and be received.
Both warehouses must have the harbor zone defined for units to properly spawn on both the sending and receiving side. The harbor zone should be within 3km of the port zone used for warehouse in order to facilitate the boarding process.
Defined in:
WAREHOUSE
Parameter:
Core.Zone#ZONE zone
The zone defining the naval embarcation/debarcation point for cargo units
Return value:
self
Set low fuel threshold.
If one unit of an asset has less fuel than this number, the event AssetLowFuel will be fired.
Defined in:
WAREHOUSE
Parameter:
#number threshold
Relative low fuel threshold, i.e. a number in [0,1]. Default 0.15 (15%).
Return value:
self
Show or don't show markers on the F10 map displaying the Warehouse stock and road/rail connections.
Defined in:
WAREHOUSE
Parameter:
#boolean switch
If true (or nil), markers are on. If false, markers are not displayed.
Return value:
self
Set valid parking spot IDs.
Set the port zone for this warehouse.
The port zone is the zone, where all naval assets of the warehouse are spawned.
Defined in:
WAREHOUSE
Parameter:
Core.Zone#ZONE zone
The zone defining the naval port of the warehouse.
Return value:
self
Set the connection of the warehouse to the railroad.
This is the place where train assets or transports will be spawned.
Defined in:
WAREHOUSE
Parameter:
Core.Point#COORDINATE coordinate
The railroad connection. Technically, the closest point on rails from this coordinate is determined by DCS API function. So this point must not be exactly on the a railroad connection.
Return value:
self
Set report off.
Warehouse does not report about its status and at certain events.
Set report on.
Messages at events will be displayed on screen to the coalition owning the warehouse.
Set respawn after destroy.
Set the connection of the warehouse to the road.
Ground assets spawned in the warehouse spawn zone will first go to this point and from there travel on road to the requesting warehouse. Note that by default the road connection is set to the closest point on road from the center of the spawn zone if it is withing 3000 meters. Also note, that if the parameter "coordinate" is passed as nil, any road connection is disabled and ground assets cannot travel of be transportet on the ground.
Defined in:
WAREHOUSE
Parameter:
Core.Point#COORDINATE coordinate
The road connection. Technically, the closest point on road from this coordinate is determined by DCS API function. So this point must not be exactly on the road.
Return value:
self
Set the time until the runway(s) of an airdrome are repaired after it has been destroyed.
Note that this is the time, the DCS engine uses not something we can control on a user level or we could get via scripting. You need to input the value. On the DCS forum it was stated that this is currently one hour. Hence this is the default value.
Defined in:
WAREHOUSE
Parameter:
#number RepairTime
Time in seconds until the runway is repaired. Default 3600 sec (one hour).
Return value:
self
Disable safe parking option.
Note that is the default setting.
Enable safe parking option, i.e.
parking spots at an airbase will be considered as occupied when a client aircraft is parked there (even if the client slot is not taken by a player yet). Note that also incoming aircraft can reserve/occupie parking spaces.
Enable auto save of warehouse assets at mission end event.
Defined in:
WAREHOUSE
Parameters:
#string path
Path where to save the asset data file.
#string filename
File name. Default is generated automatically from warehouse id.
Return value:
self
Set a zone where the (ground) assets of the warehouse are spawned once requested.
Defined in:
WAREHOUSE
Parameters:
Core.Zone#ZONE zone
The spawn zone.
#number maxdist
(Optional) Maximum distance in meters between spawn zone and warehouse. Units are not spawned if distance is larger. Default is 5000 m.
Return value:
self
Set interval of status updates.
Note that normally only one request can be processed per time interval.
Defined in:
WAREHOUSE
Parameter:
#number timeinterval
Time interval in seconds.
Return value:
self
Set verbosity level.
Defined in:
WAREHOUSE
Parameter:
#number VerbosityLevel
Level of output (higher=more). Default 0.
Return value:
self
Set a warehouse zone.
If this zone is captured, the warehouse and all its assets fall into the hands of the enemy.
Defined in:
WAREHOUSE
Parameter:
Core.Zone#ZONE zone
The warehouse zone. Note that this cannot be a polygon zone!
Return value:
self
Triggers the FSM event "Start".
Starts the warehouse. Initializes parameters and starts event handlers.
Defined in:
WAREHOUSE
Triggers the FSM event "Status".
Queue is updated and requests are executed.
Defined in:
WAREHOUSE
Triggers the FSM event "Stop".
Stops the warehouse and all its event handlers. All waiting and pending queue items are deleted as well and all assets are removed from stock.
Defined in:
WAREHOUSE
Triggers the FSM event "Unpause".
Unpauses the warehouse. Processing of queued requests is resumed.
Defined in:
WAREHOUSE
Task function for last waypoint.
Triggering the "Arrived" event.
Asset item characteristics.
Defined in:
WAREHOUSE
Parameter:
#WAREHOUSE.Assetitem asset
The asset for which info in printed in trace mode.
Checks if the associated airbase still belongs to the warehouse.
Defined in:
WAREHOUSE
Function that checks if an asset group is still okay.
Defined in:
WAREHOUSE
Checks if the warehouse zone was conquered by antoher coalition.
Defined in:
WAREHOUSE
Check parking ID for an asset.
Defined in:
WAREHOUSE
Parameters:
Parking spot.
asset
Return value:
#boolean:
If true, parking is valid.
Check parking ID.
Defined in:
WAREHOUSE
Parameter:
Parking spot.
Return value:
#boolean:
If true, parking is valid.
Sorts the queue and checks if the request can be fulfilled.
Checks if the request can be fulfilled in general.
If not, it is removed from the queue. Check if departure and destination bases are of the right type.
Defined in:
WAREHOUSE
Parameter:
#table queue
The queue which is holding the requests to check.
Return value:
#boolean:
If true, request can be executed. If false, something is not right.
Checks if the request can be fulfilled right now.
Check for current parking situation, number of assets and transports currently in stock.
Defined in:
WAREHOUSE
Parameter:
#WAREHOUSE.Queueitem request
The request to be checked.
Return value:
#boolean:
If true, request can be executed. If false, something is not right.
Check if a request is valid in general.
If not, it will be removed from the queue. This routine needs to have at least one asset in stock that matches the request descriptor in order to determine whether the request category of troops. If no asset is in stock, the request will remain in the queue but cannot be executed.
Defined in:
WAREHOUSE
Parameter:
#WAREHOUSE.Queueitem request
The request to be checked.
Return value:
#boolean:
If true, request can be executed. If false, something is not right.
Debug message.
Message send to all if debug mode is activated (and duration > 0). Text self:T(text) added to DCS.log file.
Defined in:
WAREHOUSE
Parameters:
#string text
The text of the error message.
#number duration
Message display duration in seconds. Default 20 sec. If duration is zero, no message is displayed.
Delete item from queue.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE.Queueitem qitem
Item of queue to be removed.
#table queue
The queue from which the item should be deleted.
Delete item from queue.
Defined in:
WAREHOUSE
Parameters:
#number qitemID
ID of queue item to be removed.
#table queue
The queue from which the item should be deleted.
Delete an asset item from stock.
Defined in:
WAREHOUSE
Parameter:
#WAREHOUSE.Assetitem stockitem
Asset item to delete from stock table.
Display stock items of warehouse.
Defined in:
WAREHOUSE
Parameter:
#table stock
Table holding all assets in stock of the warehouse. Each entry is of type WAREHOUSE.Assetitem.
Error message.
Message send to all (if duration > 0). Text self:E(text) added to DCS.log file.
Defined in:
WAREHOUSE
Parameters:
#string text
The text of the error message.
#number duration
Message display duration in seconds. Default 20 sec. If duration is zero, no message is displayed.
Filter stock assets by table entry.
Defined in:
WAREHOUSE
Parameters:
#table stock
Table holding all assets in stock of the warehouse. Each entry is of type WAREHOUSE.Assetitem.
#string descriptor
Descriptor describing the filtered assets.
attribute
Value of the descriptor.
#number nmax
(Optional) Maximum number of items that will be returned. Default nmax=nil is all matching items are returned.
#boolean mobile
(Optional) If true, filter only mobile assets.
Return values:
#table:
Filtered stock items table.
#number:
Total number of (requested) assets available.
#boolean:
If true, enough assets are available.
Seach unoccupied parking spots at the airbase for a list of assets.
For each asset group a list of parking spots is returned. During the search also the not yet spawned asset aircraft are considered. If not enough spots for all asset units could be found, the routine returns nil!
Defined in:
WAREHOUSE
Parameters:
Wrapper.Airbase#AIRBASE airbase
The airbase where we search for parking spots.
#table assets
A table of assets for which the parking spots are needed.
Return value:
#table:
Table of coordinates and terminal IDs of free parking spots. Each table entry has the elements .Coordinate and .TerminalID.
Get the generalized attribute of a group.
Note that for a heterogenious group, the attribute is determined from the attribute of the first unit!
Defined in:
WAREHOUSE
Parameter:
Wrapper.Group#GROUP group
MOOSE group object.
Return value:
Generalized attribute of the group.
Make a flight plan from a departure to a destination airport.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE.Assetitem asset
Wrapper.Airbase#AIRBASE departure
Departure airbase.
Wrapper.Airbase#AIRBASE destination
Destination airbase.
Return values:
#table:
Table of flightplan waypoints.
#table:
Table of flightplan coordinates.
Get warehouse id, asset id and request id from group name (alias).
Defined in:
WAREHOUSE
Parameter:
Wrapper.Group#GROUP group
The group from which the info is gathered.
Return values:
#number:
Warehouse ID.
#number:
Asset ID.
#number:
Request ID.
Get warehouse id, asset id and request id from group name (alias).
Defined in:
WAREHOUSE
Parameter:
#string groupname
Name of the group from which the info is gathered.
Return values:
#number:
Warehouse ID.
#number:
Asset ID.
#number:
Request ID.
Calculate the maximum height an aircraft can reach for the given parameters.
Defined in:
WAREHOUSE
Parameters:
#number D
Total distance in meters from Departure to holding point at destination.
#number alphaC
Climb angle in rad.
#number alphaD
Descent angle in rad.
#number Hdep
AGL altitude of departure point.
#number Hdest
AGL altitude of destination point.
#number Deltahhold
Relative altitude of holding point above destination.
Return value:
#number:
Maximum height the aircraft can reach.
Get group name without any spawn or cargo suffix #CARGO etc.
Defined in:
WAREHOUSE
Parameter:
Wrapper.Group#GROUP group
The group from which the info is gathered.
Return value:
#string:
Name of the object without trailing #...
Size of the bounding box of a DCS object derived from the DCS descriptor table.
If boundinb box is nil, a size of zero is returned.
Defined in:
WAREHOUSE
Parameter:
DCS#Object DCSobject
The DCS object for which the size is needed.
Return values:
#number:
Max size of object in meters (length (x) or width (z) components not including height (y)).
#number:
Length (x component) of size.
#number:
Height (y component) of size.
#number:
Width (z component) of size.
Get the request belonging to a group.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
The group from which the info is gathered.
#table queue
Queue holding all requests.
Return value:
The request belonging to this group.
Get text about warehouse stock.
Defined in:
WAREHOUSE
Parameter:
#boolean messagetoall
If true, send message to all.
Return value:
#string:
Text about warehouse stock
Get the proper terminal type based on generalized attribute of the group.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE.Attribute _attribute
Generlized attibute of unit.
#number _category
Airbase category.
Return value:
Terminal type for this group.
Get (optimized) transport carriers for the given assets to be transported.
Is the group a used as transporter for a given request?
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
The group from which the info is gathered.
#WAREHOUSE.Pendingitem request
Request.
Return value:
#boolean:
True if group is transport, false if group is cargo and nil otherwise.
Check if a group has a generalized attribute.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
MOOSE group object.
#WAREHOUSE.Attribute attribute
Attribute to check.
Return value:
#boolean:
True if group has the specified attribute.
Info Message.
Message send to coalition if reports or debug mode activated (and duration > 0). Text self:I(text) added to DCS.log file.
Defined in:
WAREHOUSE
Parameters:
#string text
The text of the error message.
#number duration
Message display duration in seconds. Default 20 sec. If duration is zero, no message is displayed.
Function that checks if a pending job is done and can be removed from queue.
Defined in:
WAREHOUSE
Create a new path from a template group.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
Group used for extracting the waypoints.
Core.Point#COORDINATE startcoord
First coordinate.
Core.Point#COORDINATE finalcoord
Final coordinate.
Return value:
#table:
Table with route points.
Arrived event if an air unit/group arrived at its destination.
This can be an engine shutdown or a landing event.
Warehouse event handling function.
Handles the case when the airbase associated with the warehous is captured.
Warehouse event function, handling the birth of a unit.
Warehouse event handling function.
Function handling the event when a (warehouse) unit shuts down its engines.
Function handling the event when a (warehouse) unit starts its engines.
Function handling the event when a (warehouse) unit lands.
Warehouse event handling function.
Handles the case when the mission is ended.
Function handling the event when a (warehouse) unit takes off.
Task function for when passing a waypoint.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
The group that arrived.
#number n
Waypoint passed.
#number N
Final waypoint.
Prints the queue to DCS.log file.
Defined in:
WAREHOUSE
Parameters:
#table queue
Queue to print.
#string name
Name of the queue for info reasons.
Relative to absolute quantity.
Defined in:
WAREHOUSE
Parameters:
#string relative
Relative number in terms of WAREHOUSE.Quantity.
#number ntot
Total number.
Return value:
#number:
Absolute number.
Register new asset in globase warehouse data base.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
The group that will be added to the warehouse stock.
#number ngroups
Number of groups to be added.
#string forceattribute
Forced generalized attribute.
#number forcecargobay
Cargo bay weight limit in kg.
#number forceweight
Weight of units in kg.
#number loadradius
Radius in meters when cargo is loaded into the carrier.
#table liveries
Table of liveries.
DCS#AI.Skill skill
Skill of AI.
#string assignment
Assignment attached to the asset item.
Return value:
#table:
A table containing all registered assets.
Route the airplane from one airbase another.
Activates uncontrolled aircraft and sets ROE/ROT for ferry flights. ROE is set to return fire and ROT to passive defence.
Route ground units to destination.
ROE is set to return fire and alarm state to green.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP group
The ground group to be routed
#WAREHOUSE.Queueitem request
The request for this group.
Route naval units along user defined shipping lanes to destination warehouse.
ROE is set to return fire.
Route trains to their destination - or at least to the closest point on rail of the desired final destination.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Group#GROUP Group
The train group.
Core.Point#COORDINATE Coordinate
of the destination. Tail will be routed to the closest point
#number Speed
Speed in km/h to drive to the destination coordinate. Default is 60% of max possible speed the unit can go.
Simple task function.
Can be used to call a function which has the warehouse and the executing group as parameters.
Defined in:
WAREHOUSE
Parameters:
#string Function
The name of the function to call passed as string.
Wrapper.Group#GROUP group
The group which is meant.
Simple task function.
Can be used to call a function which has the warehouse and the executing group as parameters.
Defined in:
WAREHOUSE
Parameters:
#string Function
The name of the function to call passed as string.
Wrapper.Group#GROUP group
The group which is meant.
#number n
Waypoint passed.
#number N
Final waypoint number.
Spawn an aircraft asset (plane or helo) at the airbase associated with the warehouse.
Defined in:
WAREHOUSE
Parameters:
#string alias
Alias name of the asset group.
#WAREHOUSE.Assetitem asset
Ground asset that will be spawned.
#WAREHOUSE.Queueitem request
Request belonging to this asset. Needed for the name/alias.
#table parking
Parking data for this asset.
#boolean uncontrolled
Spawn aircraft in uncontrolled state.
#boolean lateactivated
If true, groups are spawned late activated.
Return value:
The spawned group or nil if the group could not be spawned.
Spawn a ground or naval asset in the corresponding spawn zone of the warehouse.
Prepare a spawn template for the asset.
Deep copy of asset template, adjusting template and unit names, nillifying group and unit ids.
Defined in:
WAREHOUSE
Parameters:
#WAREHOUSE.Assetitem asset
Ground asset that will be spawned.
#string alias
Alias name of the group.
Return value:
#table:
Prepared new spawn template.
Spawns requested assets at warehouse or associated airbase.
A unit of a group just died.
Update group sets in request. This is important in order to determine if a job is done and can be removed from the (pending) queue.
Defined in:
WAREHOUSE
Parameters:
Wrapper.Unit#UNIT deadunit
Unit that died.
Wrapper.Group#GROUP deadgroup
Group of unit that died.
#WAREHOUSE.Pendingitem request
Request that needs to be updated.
Create or update mark text at warehouse, which is displayed in F10 map showing how many assets of each type are in stock.
Only the coalition of the warehouse owner is able to see it.
Defined in:
WAREHOUSE
Return value:
#string:
Text about warehouse stock
Trigger the FSM event "AddAsset" with a delay.
Add a group to the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
Wrapper.Group#GROUP group
Group to be added as new asset.
#number ngroups
(Optional) Number of groups to add to the warehouse stock. Default is 1.
#WAREHOUSE.Attribute forceattribute
(Optional) Explicitly force a generalized attribute for the asset. This has to be an WAREHOUSE.Attribute.
#number forcecargobay
(Optional) Explicitly force cargobay weight limit in kg for cargo carriers. This is for each unit of the group.
#number forceweight
(Optional) Explicitly force weight in kg of each unit in the group.
#number loadradius
(Optional) The distance in meters when the cargo is loaded into the carrier. Default is the bounding box size of the carrier.
DCS#AI.Skill skill
Skill of the asset.
#table liveries
Table of livery names. When the asset is spawned one livery is chosen randomly.
#string assignment
A free to choose string specifying an assignment for the asset. This can be used with the WAREHOUSE.OnAfterNewAsset function.
Triggers the FSM event "AddRequest" with a delay.
Add a request to the warehouse queue, which is processed when possible.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
#WAREHOUSE warehouse
The warehouse requesting supply.
#WAREHOUSE.Descriptor AssetDescriptor
Descriptor describing the asset that is requested.
AssetDescriptorValue
Value of the asset descriptor. Type depends on descriptor, i.e. could be a string, etc.
#number nAsset
Number of groups requested that match the asset specification.
#WAREHOUSE.TransportType TransportType
Type of transport.
#number nTransport
Number of transport units requested.
#number Prio
Priority of the request. Number ranging from 1=high to 100=low.
#string Assignment
A keyword or text that later be used to identify this request and postprocess the assets.
Triggers the FSM event "AirbaseCaptured" with a delay when the airbase of the warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
DCS#coalition.side Coalition
Coalition side which captured the airbase, i.e. a number of DCS#coalition.side enumerator.
Triggers the FSM event "AirbaseRecaptured" with a delay when the airbase of the warehouse has been re-captured from the other coalition.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
DCS#coalition.side Coalition
Coalition which re-captured the airbase, i.e. the same as the current warehouse owner coalition.
Triggers the FSM event "Arrived" after a delay when a group has arrived at the destination.
This function should always be called from the sending and not the receiving warehouse. If the group is a cargo asset, it is added to the receiving warehouse. If the group is a transporter it is added to the sending warehouse since carriers are supposed to return to their home warehouse once
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
Wrapper.Group#GROUP group
Group that has arrived.
Triggers the delayed FSM event "AssetDead" when an asset group has died.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
#WAREHOUSE.Assetitem asset
The asset that is dead.
#WAREHOUSE.Pendingitem request
The request of the dead asset.
Triggers the FSM event "AssetLowFuel" with a delay when an asset runs low on fuel.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
#WAREHOUSE.Assetitem asset
The asset that is low on fuel.
#WAREHOUSE.Pendingitem request
The request of the asset that is low on fuel.
Triggers the FSM event "AssetSpawned" with a delay when the warehouse has spawned an asset.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
Wrapper.Group#GROUP group
the group that was spawned.
#WAREHOUSE.Assetitem asset
The asset that was spawned.
#WAREHOUSE.Pendingitem request
The request of the spawned asset.
Triggers the FSM event "Attacked" with a delay when a warehouse is under attack by an another coalition.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
DCS#coalition.side Coalition
Coalition side which is attacking the warehouse, i.e. a number of DCS#coalition.side enumerator.
DCS#country.id Country
Country ID, which is attacking the warehouse, i.e. a number DCS#country.id enumerator.
Triggers the FSM event "Captured" with a delay when a warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
DCS#coalition.side Coalition
Coalition side which captured the warehouse.
DCS#country.id Country
Country id which has captured the warehouse.
Triggers the FSM event "ChangeCountry" after a delay so the warehouse is respawned with the new country.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
DCS#country.id Country
Country id which has captured the warehouse.
Triggers the FSM event "Defeated" with a delay when an attack from an enemy was defeated.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Delivered" after a delay.
A group has been delivered from the warehouse to another warehouse.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
#WAREHOUSE.Pendingitem request
Pending request that was now delivered.
Triggers the FSM event "Destroyed" with a delay when the warehouse was destroyed.
Services are stopped.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Load" with a delay when the warehouse assets are loaded from disk.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
#string path
Path where the file is located. Default is the DCS installation root directory.
#string filename
(Optional) File name. Default is WAREHOUSE-
Triggers the FSM delayed event "NewAsset" when a new asset has been added to the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
#WAREHOUSE.Assetitem asset
The new asset.
#string assignment
(Optional) Assignment text for the asset.
Triggers the FSM event "Pause" after a delay.
Pauses the warehouse. Assets can still be added and requests be made. However, requests are not processed.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Request" after a delay.
Executes a request from the queue if possible.
Defined in:
WAREHOUSE
Parameters:
#number Delay
Delay in seconds.
#WAREHOUSE.Queueitem Request
Information table of the request.
Triggers the FSM event "Respawn" after a delay.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Restart" after a delay.
Restarts the warehouse from stopped state by reactivating the event handlers only.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Save" with a delay when the warehouse assets are saved to a file.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
#string path
Path where the file is saved. Default is the DCS installation root directory.
#string filename
(Optional) File name. Default is WAREHOUSE-
Triggers the FSM event "SelfRequest" with a delay.
Request was initiated from the warehouse to itself. Groups are just spawned at the warehouse or the associated airbase. If the warehouse is currently under attack when the self request is made, the self request is added to the defending table. One the attack is defeated, this request is used to put the groups back into the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#number delay
Delay in seconds.
Core.Set#SET_GROUP groupset
The set of cargo groups that was delivered to the warehouse itself.
#WAREHOUSE.Pendingitem request
Pending self request.
Triggers the FSM event "Start" after a delay.
Starts the warehouse. Initializes parameters and starts event handlers.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Status" after a delay.
Queue is updated and requests are executed.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Stop" after a delay.
Stops the warehouse and all its event handlers. All waiting and pending queue items are deleted as well and all assets are removed from stock.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Unpause" after a delay.
Unpauses the warehouse. Processing of queued requests is resumed.
Defined in:
WAREHOUSE
Parameter:
#number delay
Delay in seconds.
On after "AddAsset" event.
Add a group to the warehouse stock. If the group is alive, it is destroyed.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Group#GROUP group
Group or template group to be added to the warehouse stock.
#number ngroups
Number of groups to add to the warehouse stock. Default is 1.
#WAREHOUSE.Attribute forceattribute
(Optional) Explicitly force a generalized attribute for the asset. This has to be an WAREHOUSE.Attribute.
#number forcecargobay
(Optional) Explicitly force cargobay weight limit in kg for cargo carriers. This is for each unit of the group.
#number forceweight
(Optional) Explicitly force weight in kg of each unit in the group.
#number loadradius
(Optional) Radius in meters when the cargo is loaded into the carrier.
DCS#AI.Skill skill
Skill of the asset.
#table liveries
Table of livery names. When the asset is spawned one livery is chosen randomly.
#string assignment
A free to choose string specifying an assignment for the asset. This can be used with the WAREHOUSE.OnAfterNewAsset function.
#table other
(Optional) Table of other useful data. Can be collected via WAREHOUSE.OnAfterNewAsset() function for example
On after "AddRequest" event.
Add a request to the warehouse queue, which is processed when possible.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE warehouse
The warehouse requesting supply.
#WAREHOUSE.Descriptor AssetDescriptor
Descriptor describing the asset that is requested.
AssetDescriptorValue
Value of the asset descriptor. Type depends on descriptor, i.e. could be a string, etc.
#number nAsset
Number of groups requested that match the asset specification.
#WAREHOUSE.TransportType TransportType
Type of transport.
#number nTransport
Number of transport units requested.
#number Prio
Priority of the request. Number ranging from 1=high to 100=low.
#string Assignment
A keyword or text that can later be used to identify this request and postprocess the assets.
On after "AirbaseCaptured" event.
Airbase of warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
which captured the warehouse.
On after "AirbaseRecaptured" event.
Airbase of warehouse has been re-captured from other coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
Coalition side which originally captured the warehouse.
On after "Arrived" event.
Triggered when a group has arrived at its destination warehouse. The routine should be called by the warehouse sending this asset and not by the receiving warehouse. It is checked if this asset is cargo (or self propelled) or transport. If it is cargo it is put into the stock of receiving warehouse. If it is a transporter it is put back into the sending warehouse since transports are supposed to return their home warehouse.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Group#GROUP group
The group that was delivered.
On after "AssetDead" event triggered when an asset group died.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Assetitem asset
The asset that is dead.
#WAREHOUSE.Pendingitem request
The request of the dead asset.
On after "AssetSpawned" event triggered when an asset group is spawned into the cruel world.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Group#GROUP group
The group spawned.
#WAREHOUSE.Assetitem asset
The asset that is dead.
#WAREHOUSE.Pendingitem request
The request of the dead asset.
On after "Attacked" event.
Warehouse is under attack by an another coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
which is attacking the warehouse.
DCS#country.id Country
which is attacking the warehouse.
On after "Captured" event.
Warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
which captured the warehouse.
DCS#country.id Country
which has captured the warehouse.
On after "ChangeCountry" event.
Warehouse is respawned with the specified country. All queued requests are deleted and the owned airbase is reset if the coalition is changed by changing the country.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#country.id Country
Country which has captured the warehouse.
On after "Defeated" event.
Warehouse defeated an attack by another coalition. Defender assets are added back to warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Delivered" event.
Triggered when all asset groups have reached their destination. Corresponding request is deleted from the pending queue.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Pendingitem request
The pending request that is finished and deleted from the pending queue.
On after "Destroyed" event.
Warehouse was destroyed. All services are stopped. Warehouse is going to "Stopped" state in one minute.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Load" event.
Warehouse assets are loaded from file on disk.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#string path
Path where the file is loaded from.
#string filename
(Optional) Name of the file containing the asset data.
On after "NewAsset" event.
A new asset has been added to the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Assetitem asset
The asset that has just been added.
#string assignment
The (optional) assignment for the asset.
On after "Pause" event.
Pauses the warehouse, i.e. no requests are processed. However, new requests and new assets can be added in this state.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Request" event.
Spawns the necessary cargo and transport assets.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Queueitem Request
Information table of the request.
On after "RequestSpawned" event.
Initiates the transport of the assets to the requesting warehouse.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Pendingitem Request
Information table of the request.
Core.Set#SET_GROUP CargoGroupSet
Set of cargo groups.
Core.Set#SET_GROUP TransportGroupSet
Set of transport groups if any.
Respawn warehouse.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Restart" event.
Restarts the warehouse when it was in stopped state by reactivating the event handlers only.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "RunwayDestroyed" event.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "RunwayRepaired" event.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Save" event.
Warehouse assets are saved to file on disk.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#string path
Path where the file is saved. If nil, file is saved in the DCS root installtion directory.
#string filename
(Optional) Name of the file containing the asset data.
On after "SelfRequest" event.
Request was initiated to the warehouse itself. Groups are just spawned at the warehouse or the associated airbase. If the warehouse is currently under attack when the self request is made, the self request is added to the defending table. One the attack is defeated, this request is used to put the groups back into the warehouse stock.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Core.Set#SET_GROUP groupset
The set of asset groups that was delivered to the warehouse itself.
#WAREHOUSE.Pendingitem request
Pending self request.
On after Start event.
Starts the warehouse. Adds event handlers and schedules status updates of reqests and queue.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after Status event.
Checks the queue and handles requests.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Stop" event.
Stops the warehouse, unhandles all events.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after "Unloaded" event.
Triggered when a group was unloaded from the carrier.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Group#GROUP group
The group that was delivered.
On after "Unpause" event.
Unpauses the warehouse, i.e. requests in queue are processed again.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On before "AddRequest" event.
Checks some basic properties of the given parameters.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE warehouse
The warehouse requesting supply.
#WAREHOUSE.Descriptor AssetDescriptor
Descriptor describing the asset that is requested.
AssetDescriptorValue
Value of the asset descriptor. Type depends on descriptor, i.e. could be a string, etc.
#number nAsset
Number of groups requested that match the asset specification.
#WAREHOUSE.TransportType TransportType
Type of transport.
#number nTransport
Number of transport units requested.
#number Prio
Priority of the request. Number ranging from 1=high to 100=low.
#string Assignment
A keyword or text that later be used to identify this request and postprocess the assets.
Return value:
#boolean:
If true, request is okay at first glance.
On before "Arrived" event.
Triggered when a group has arrived at its destination warehouse.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Group#GROUP group
The group that was delivered.
On before "Captured" event.
Warehouse has been captured by another coalition.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#coalition.side Coalition
which captured the warehouse.
DCS#country.id Country
which has captured the warehouse.
On before "ChangeCountry" event.
Checks whether a change of country is necessary by comparing the actual country to the the requested one.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
DCS#country.id Country
which has captured the warehouse.
On before "Load" event.
Checks if the file the warehouse data should be loaded from exists.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#string path
Path where the file is loaded from.
#string filename
(Optional) Name of the file containing the asset data.
On before "Request" event.
Checks if the request can be fulfilled.
Defined in:
WAREHOUSE
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#WAREHOUSE.Queueitem Request
Information table of the request.
Return value:
#boolean:
If true, request is granted.
Field(s)
Name of the class.
If true, send debug messages to all.
If true, send status messages to coalition.
Name of the airbase associated to the warehouse.
Alias of the warehouse. Name its called when sending messages.
When the warehouse is under attack, automatically spawn assets to defend the warehouse.
Automatically save assets to file when mission ends.
File name of the auto asset save file. Default is auto generated from warehouse id and name.
Path where the asset file is saved on auto save.
Coalition of the warehouse.
Country of the warehouse.
Time interval in seconds of updating the warehouse status and processing new events. Default 30 seconds.
Table holding all defending requests, i.e. self requests that were if the warehouse is under attack. Table elements are of type WAREHOUSE.Pendingitem.
Table holding all delivered requests. Table elements are #boolean. If true, all cargo has been delivered.
If true
, warehouse is represented by a ship unit.
If true
, warehouse is represented by a unit instead of a static.
Set some string id for output to DCS.log file.
Low fuel threshold. Triggers the event AssetLowFuel if for any unit fuel goes below this number.
If true, markers are displayed on the F10 map.
ID of the warehouse marker at the airbase.
Table holding user defined paths from one warehouse to another.
Table holding all pending requests, i.e. those that are currently in progress. Table elements are of type WAREHOUSE.Pendingitem.
Zone defining the port of a warehouse. This is where naval assets are spawned.
Table holding all queued requests. Table entries are of type WAREHOUSE.Queueitem.
Unit id of each request in the queue. Essentially a running number starting at one and incremented when a new request is added.
If true, warehouse is respawned after it was destroyed. Assets are kept.
Delay before respawn in seconds.
Time stamp timer.getAbsTime() when the runway was destroyed.
Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
If true, parking spots for aircraft are considered as occupied if e.g. a client aircraft is parked there. Default false.
Table holding the user defined shipping between warehouses.
Max distance between warehouse and spawn zone. Default 5000 meters.
Table holding all assets in stock. Table entries are of type WAREHOUSE.Assetitem.
Table holding assets currently transporting cargo assets.
Unique ID of the warehouse.
Verbosity level.
Warehouse class version.
Identifier of the warehouse printed before other output to DCS.log file.
Zone around the warehouse. If this zone is captured, the warehouse and all its assets goes to the capturing coalition.
Function(s)
Adds an End state.
Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
Core.Fsm#FSM_PROCESS Process
An sub-process FSM.
#table ReturnEvents
A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.
Return value:
The SubFSM.
Adds a score for the FSM to be achieved.
Defined in:
Parameters:
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Adds a score for the FSM_PROCESS to be achieved.
Defined in:
Parameters:
#string From
is the From State of the main process.
#string Event
is the Event of the main process.
#string State
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
#string ScoreText
is a text describing the score that is given according the status.
#number Score
is a number providing the score of the status.
Return value:
#FSM:
self
Add a new transition rule to the FSM.
A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.
Defined in:
Parameters:
#table From
Can contain a string indicating the From state or a table of strings containing multiple From states.
#string Event
The Event name.
#string To
The To state.
Get current state.
Returns the End states.
Returns a table of the SubFSM rules defined within the FSM.
Returns a table with the scores defined.
Returns the start state of the FSM.
Get current state.
Returns a table with the Subs defined.
Returns a table of the transition rules defined within the FSM.
Check if FSM is in state.
Defined in:
Parameter:
#string State
State name.
Return value:
#boolean:
If true, FSM is in this state.
Load call backs.
Sets the start state of the FSM.
Add to map.
Call handler.
Defined in:
Parameters:
#string step
Step "onafter", "onbefore", "onenter", "onleave".
#string trigger
Trigger.
#table params
Parameters.
#string EventName
Event name.
Return value:
Value.
Create transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Delayed transition.
Defined in:
Parameter:
#string EventName
Event name.
Return value:
#function:
Function.
Event map.
Go sub.
Defined in:
Parameters:
#string ParentFrom
Parent from state.
#string ParentEvent
Parent event name.
Return value:
#table:
Subs.
Handler.
Is end state.
Defined in:
Parameter:
#string Current
Current state name.
Return values:
#table:
FSM parent.
#string:
Event name.
Sub maps.
Check if can do an event.
Defined in:
Parameter:
#string e
Event name.
Return values:
#boolean:
If true, FSM can do the event.
#string:
To state.
Check if cannot do an event.
Defined in:
Parameter:
#string e
Event name.
Return value:
#boolean:
If true, FSM cannot do the event.
Check if FSM is in state.
Defined in:
Parameters:
#string State
State name.
state
Return value:
#boolean:
If true, FSM is in this state.
Field(s)
Name of the class.
If true, send debug messages to all.
If true, send status messages to coalition.
Name of the airbase associated to the warehouse.
Alias of the warehouse. Name its called when sending messages.
When the warehouse is under attack, automatically spawn assets to defend the warehouse.
Automatically save assets to file when mission ends.
File name of the auto asset save file. Default is auto generated from warehouse id and name.
Path where the asset file is saved on auto save.
Coalition of the warehouse.
Country of the warehouse.
Time interval in seconds of updating the warehouse status and processing new events. Default 30 seconds.
Table holding all defending requests, i.e. self requests that were if the warehouse is under attack. Table elements are of type WAREHOUSE.Pendingitem.
Table holding all delivered requests. Table elements are #boolean. If true, all cargo has been delivered.
If true
, warehouse is represented by a ship unit.
If true
, warehouse is represented by a unit instead of a static.
Set some string id for output to DCS.log file.
Low fuel threshold. Triggers the event AssetLowFuel if for any unit fuel goes below this number.
If true, markers are displayed on the F10 map.
ID of the warehouse marker at the airbase.
Table holding user defined paths from one warehouse to another.
Table holding all pending requests, i.e. those that are currently in progress. Table elements are of type WAREHOUSE.Pendingitem.
Zone defining the port of a warehouse. This is where naval assets are spawned.
Table holding all queued requests. Table entries are of type WAREHOUSE.Queueitem.
Unit id of each request in the queue. Essentially a running number starting at one and incremented when a new request is added.
If true, warehouse is respawned after it was destroyed. Assets are kept.
Delay before respawn in seconds.
Time stamp timer.getAbsTime() when the runway was destroyed.
Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
If true, parking spots for aircraft are considered as occupied if e.g. a client aircraft is parked there. Default false.
Table holding the user defined shipping between warehouses.
Max distance between warehouse and spawn zone. Default 5000 meters.
Table holding all assets in stock. Table entries are of type WAREHOUSE.Assetitem.
Table holding assets currently transporting cargo assets.
Unique ID of the warehouse.
Verbosity level.
Warehouse class version.
Identifier of the warehouse printed before other output to DCS.log file.
Zone around the warehouse. If this zone is captured, the warehouse and all its assets goes to the capturing coalition.
Function(s)
Clear the state of an object.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
StateName
The key that is should be cleared.
Creation of a Birth Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
#string IniUnitName
The initiating unit name.
place
subplace
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a Dead Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
IniObjectCategory
Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT
event.
Creation of a Remove Unit Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Takeoff Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Creation of a Crash Event.
Defined in:
Parameters:
DCS#Time EventTime
The time stamp of the event.
DCS#Object Initiator
The initiating object of the event.
Log an exception which will be traced always.
Can be anywhere within the function logic.
Returns the event dispatcher
Remove all subscribed events
Trace a function call.
Must be at the beginning of the function logic.
Trace a function call level 2.
Must be at the beginning of the function logic.
Trace a function call level 3.
Must be at the beginning of the function logic.
Get the ClassID of the class instance.
Get the ClassName of the class instance.
Get the ClassName + ClassID of the class instance.
The ClassName + ClassID is formatted as '%s#%09d'.
Get the Class Core.Event processing Priority.
The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.
This is the worker method to retrieve the Parent class.
Note that the Parent class must be passed to call the parent class method.
self:GetParent(self):ParentMethod()
Get a Value given a Key from the Object.
Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
Defined in:
Parameters:
Object
The object that holds the Value set by the Key.
Key
The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!
Return value:
The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.
Subscribe to a DCS Event.
Defined in:
Parameters:
Core.Event#EVENTS EventID
Event ID.
#function EventFunction
(optional) The function to be called when the event occurs for the unit.
Return value:
Log an information which will be traced always.
Can be anywhere within the function logic.
This is the worker method to inherit from a parent class.
Defined in:
Parameters:
Child
is the Child class that inherits.
#BASE Parent
is the Parent class that the Child inherits from.
Return value:
Child
This is the worker method to check if an object is an (sub)instance of a class.
Examples:
ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true
ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false
Defined in:
Parameter:
ClassName
is the name of the class or the class itself to run the check against
Return value:
#boolean:
Enquires if tracing is on (for the class).
BASE constructor.
This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
function EVENT:New()
local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
return self
end
Occurs when an Event for an object is triggered.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.
Occurs when a ground unit captures either an airbase or a farp.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
Occurs when any object is spawned into the mission.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned
Occurs when any aircraft crashes into the ground and is completely destroyed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed
Occurs when an object is dead.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.
Unknown precisely what creates this event, likely tied into newer damage model.
Will update this page when new information become available.
- initiator: The unit that had the failure.
Discard chair after ejection.
Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a dynamic cargo crate is removed.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.
initiator : The unit that has ejected
Occurs when any aircraft shuts down its engines.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.
Occurs when any aircraft starts its engines.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.
Occurs whenever an object is hit by a weapon.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.
Occurs when any system fails on a human controlled aircraft.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure
Occurs on the death of a unit.
Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: The unit that killed the target
- target: Target Object
- weapon: Weapon Object
Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.
initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.
Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
- place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
- subplace: is always 0 for unknown reasons.
Occurs when a new mark was added.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mark text was changed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mark was removed.
Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.
Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.
* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.
Weapon add.
Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when the pilot of an aircraft is killed.
Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.
Occurs when a player enters a slot and takes control of an aircraft.
Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.
Occurs when any player assumes direct control of a unit.
Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.
Occurs when any player relieves control of a unit to the AI.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.
Occurs when an aircraft connects with a tanker and begins taking on fuel.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.
Occurs when an aircraft is finished taking fuel.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.
Occurs when any modification to the "Score" as seen on the debrief menu would occur.
There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when any unit stops firing its weapon.
Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.
Occurs when any unit begins firing a weapon that has a high rate of fire.
Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.
Occurs whenever any unit in a mission fires a weapon.
But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.
Occurs when an aircraft takes off from an airbase, farp, or ship.
Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
Occurs when the game thinks an object is destroyed.
Have a look at the class Core.Event#EVENT as these are just the prototypes.
- initiator: The unit that is was destroyed.
Schedule a new time event.
Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.
Defined in:
Parameters:
#number Start
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
#function SchedulerFunction
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
#table ...
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
Return value:
#string:
The Schedule ID of the planned schedule.
Schedule a new time event.
Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.
Defined in:
Parameters:
#number Start
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
#number Repeat
Specifies the interval in seconds when the scheduler will call the event function.
#number RandomizeFactor
Specifies a randomization factor between 0 and 1 to randomize the Repeat.
#number Stop
Specifies the amount of seconds when the scheduler will be stopped.
#function SchedulerFunction
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
#table ...
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
Return value:
#string:
The Schedule ID of the planned schedule.
Stops the Schedule.
Defined in:
Parameter:
#string SchedulerID
(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.
Set the Class Core.Event processing Priority.
The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.
Set a state or property of the Object given a Key and a Value.
Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
Defined in:
Parameters:
Object
The object that will hold the Value set by the Key.
Key
The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
Value
The value to is stored in the object.
Return value:
The Value set.
Trace a function logic level 1.
Can be anywhere within the function logic.
Trace a function logic level 2.
Can be anywhere within the function logic.
Trace a function logic level 3.
Can be anywhere within the function logic.
Trace all methods in MOOSE
Set tracing for a class
Set tracing for a specific method of class
Set trace off.
Set trace on.
Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.
So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.
Defined in:
Parameter:
#boolean TraceOnOff
Switch the tracing on or off.
Usage:
-- Switch the tracing On
BASE:TraceOnOff( true )
-- Switch the tracing Off
BASE:TraceOnOff( false )
UnSubscribe to a DCS event.
Trace a function call.
This function is private.
Defined in:
Parameters:
Arguments
A #table or any field.
DebugInfoCurrentParam
DebugInfoFromParam
(Internal) Serialize arguments
Trace a function logic.
Defined in:
Parameters:
Arguments
A #table or any field.
DebugInfoCurrentParam
DebugInfoFromParam
The main event handling function...
This function captures all events generated for the class.
Item of the warehouse stock table.
Field(s)
Time stamp when asset returned to its legion (airwing, brigade).
If true, asset arrived at its destination.
Assignment of the asset. This could, e.g., be used in the @{#WAREHOUSE.OnAfterNewAsset) function.
Array of cargo bays of all units in an asset group.
Largest cargo bay of all units in the group.
Total weight in kg that fits in the cargo bay of all asset group units.
Damage of asset group in percent.
If true
, asset was reserved and cannot be selected by another request.
If true, asset is cargo. If false asset is transport. Nil if in stock.
Livery of the asset.
Distance when cargo is loaded into the carrier.
Number of units in the group.
Range of the unit in meters.
If true
, asset was requested and cannot be selected by another request.
Request ID of this asset (if any).
Maximum size in length and with of the asset in meters.
If true, asset was spawned into the cruel world. If false, it is still in stock.
Name of the spawned group.
Maximum speed in km/h the group can do.
Name of the squadron this asset belongs to.
The spawn template of the group.
Name of the template group.
Unique id of the asset.
Type of the first unit of the group as obtained by the Object.getTypeName() DCS API function.
The weight of the whole asset group in kilograms.
ID of the warehouse this asset belongs to.
Function(s)
Generalized asset attributes.
Can be used to request assets with certain general characteristics. See DCS attributes on hoggit.
Field(s)
Attack helicopter.
Airborne Early Warning and Control System.
Aircraft which can be used for strategic bombing.
Fighter, interceptor, ... airplane.
Any airborne unit that does not fall into any other airborne category.
Airplane which can refuel other aircraft.
Helicopter with transport capability. This can be used to transport other assets.
Airplane with transport capability. This can be used to transport other assets.
Unpiloted Aerial Vehicle, e.g. drones.
Anti-Aircraft Artillery.
Infantry carriers, in particular Amoured Personell Carrier. This can be used to transport other assets.
Artillery assets.
Early Warning Radar.
Ground infantry fighting vehicle.
Ground infantry assets.
Any ground unit that does not fall into any other ground category.
Surface-to-Air Missile system or components.
Tanks (modern or old).
Trains. Not that trains are not yet properly implemented in DCS and cannot be used currently.
Unarmed ground vehicles, which has the DCS "Truck" attribute.
Aircraft carrier.
Any armed ship that is not an aircraft carrier, a cruiser, destroyer, firgatte or corvette.
Any naval unit that does not fall into any other naval category.
Any unarmed naval vessel.
War ship, i.e. cruisers, destroyers, firgates and corvettes.
Anything that does not fall into any other category.
Function(s)
Descriptors enumerator describing the type of the asset.
Field(s)
List of specific assets gives as a table of assets. Mind the curly brackets {}.
Assignment of asset when it was added.
Generalized attribute WAREHOUSE.Attribute.
Asset category of type DCS#Group.Category, i.e. GROUND, AIRPLANE, HELICOPTER, SHIP, TRAIN.
Name of the asset template.
Typename of the DCS unit, e.g. "A-10C".
Function(s)
Item of the warehouse pending queue table.
Field(s)
Table with assets that might have problems (damage or stuck).
Table holding the cargo groups of each carrier unit.
If true, at least one asset group is low on fuel.
Number of groups delivered to destination.
Number of transports back home.
Absolute mission time in seconds when the request was processed.
Function(s)
Warehouse quantity enumerator for selecting number of assets, e.g.
all, half etc. of what is in stock rather than an absolute number.
Field(s)
All "all" assets currently in stock.
Half "1/2" of assets in stock.
One quarter "1/4" of assets in stock.
One third "1/3" of assets in stock.
Three quarters "3/4" of assets in stock.
Function(s)
Item of the warehouse queue table.
Field(s)
The airbase beloning to requesting warehouse if any.
Descriptor of the requested asset. Enumerator of type WAREHOUSE.Descriptor.
Init problem table.
Table of self propelled (or cargo) and transport assets. Each element of the table is a WAREHOUSE.Assetitem and can be accessed by their asset ID.
A keyword or text that later be used to identify this request and postprocess the assets.
Table of cargo (or self propelled) assets. Each element of the table is a WAREHOUSE.Assetitem.
Attribute of cargo assets of type WAREHOUSE.Attribute.
Category of cargo assets of type WAREHOUSE.Category.
Category of the requesting airbase, i.e. airdrome, helipad/farp or ship.
Assets are spawned in late activated state.
Number of asset groups requested.
Max. number of transport units requested.
Priority of the request. Number between 1 (high) and 100 (low).
Set time stamp.
Self request, i.e. warehouse requests assets from itself.
Table of transport carrier assets. Each element of the table is a WAREHOUSE.Assetitem.
Attribute of transport assets of type WAREHOUSE.Attribute.
Category of transport assets of type WAREHOUSE.Category.
Unique id of the queue item.
Function(s)
Cargo transport type.
Defines how assets are transported to their destination.
Field(s)
Transports are carried out by airplanes.
Transports are conducted by APCs.
Transports are carried out by helicopters.
Assets go to their destination by themselves. No transport carrier needed.
Transports are conducted by ships. Not implemented yet.
Transports are conducted by trains. Not implemented yet. Also trains are buggy in DCS.
Function(s)
Warehouse database.
Note that this is a global array to have easier exchange between warehouses.
Field(s)
Unique ID of each asset. This is a running number, which is increased each time a new asset is added.
Table holding registered assets, which are of type Functional.Warehouse#WAREHOUSE.Assetitem.#
Unique ID of the warehouse. Running number.
Table holding all defined #WAREHOUSE objects by their unique ids.