Updated Moose.lua

This commit is contained in:
funkyfranky
2022-10-11 19:30:16 +00:00
parent 192d4710a2
commit 9f91de26ca
982 changed files with 22665 additions and 22625 deletions

View File

@@ -1,181 +1,181 @@
---
-- GROUND Basic Transport
--
-- A group of two TPz Fuchs transports infantry groups from Zone Kobulety X to a nearby Zone Alpha.
--
-- Once all troops were delivered, the carrier returns to its original position.
--
-- This script also contains many FSM events that are triggered when a carrier loads/unloads cargo and when groups are being loaded/unloaded.
--
-- NOTE that:
-- - Troops to be transported MUST be in the pickup zone. If not, they will not be considered for transport until they enter the zone!
-- - If a group is too heavy for the assigned transports, it will not be transported. Each group must fit into one UNIT of the group.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneDeploy=ZONE:New("Zone Alpha"):DrawZone()
-- Carrier group.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Cargo group.
local infantry=ARMYGROUP:New("Infantry Platoon Alpha-1")
infantry:Activate()
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantry, zonePickup, zoneDeploy)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
---
-- FSM events of the OPSTRANSPORT
---
--- Function called when an OPSGROUP is loaded into a carrier.
function opstransport:OnAfterLoaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup, CarrierElement)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrier=CarrierElement --Ops.OpsGroup#OPSGROUP.Element
-- Info message.
local text=string.format("Transport UID=%d opsgroup %s loaded into carrier %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrier.name)
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when an OPSGROUP is unloaded from the carrier.
function opstransport:OnAfterUnloaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
-- Info message.
local text=string.format("Transport UID=%d unloaded opsgroup %s from carrier group %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrieropsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- OPSGROUP is ready for further actions. Put up green smoke.
cargoopsgroup:GetGroup():SmokeGreen()
end
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
-- Info Message
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
---
-- FSM events for carrier groups
---
--- Function called when a carrier has loaded a cargo group.
function carrier:OnAfterLoaded(From, Event, To, CargoGroup)
local cargogroup=CargoGroup --Ops.OpsGroup#OPSGROUP
-- Info Message
local text=string.format("Group %s loaded group %s", carrier:GetName(), cargogroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier has unloaded a cargo group.
function carrier:OnAfterUnloaded(From, Event, To, CargoGroup)
local cargogroup=CargoGroup --Ops.OpsGroup#OPSGROUP
-- Info Message
local text=string.format("Group %s unloaded group %s", carrier:GetName(), cargogroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when carrier goes to pickup cargo.
function carrier:OnAfterPickup(From,Event,To)
-- Info Message
local text=string.format("Group %s is picking up cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier is loading cargo.
function carrier:OnAfterLoading(From,Event,To)
-- Info Message
local text=string.format("Group %s is loading cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier has loaded all cargo.
function carrier:OnAfterLoadingDone(From, Event, To)
-- Info Message
local text=string.format("Group %s loaded all cargo", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when the carrier transports cargo from pickup to deploy zone.
function carrier:OnAfterTransport(From, Event, To)
-- Info Message
local text=string.format("Group %s is transporting cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier is unloading cargo.
function carrier:OnAfterUnLoading(From,Event,To)
-- Info Message
local text=string.format("Group %s is unloading cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier is done with onloading its cargo.
function carrier:OnAfterUnloadingDone(From, Event, To)
-- Info Message
local text=string.format("Group %s is finished unloading cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
---
-- FSM events for cargo groups
---
--- Function called when a cargo group is ordered to board a carrier.
function infantry:OnAfterBoard(From, Event, To, CarrierGroup, Carrier)
local carriergroup=CarrierGroup --Ops.OpsGroup#OPSGROUP
local carrier=Carrier --Ops.OpsGroup#OPSGROUP.Element
-- Info Message
local text=string.format("Group %s will board into carrier %s of group %s", infantry:GetName(), carrier.name, carriergroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when the group embarked a carrier.
function infantry:OnAfterEmbarked(From, Event, To, CarrierGroup, Carrier)
local carriergroup=CarrierGroup --Ops.OpsGroup#OPSGROUP
local carrier=Carrier --Ops.OpsGroup#OPSGROUP.Element)
-- Info Message
local text=string.format("Group %s embarked into carrier %s of group %s", infantry:GetName(), carrier.name, carriergroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when the group disembarked a carrier.
function infantry:OnAfterDisembarked(From, Event, To, CarrierGroup, Carrier)
local carriergroup=CarrierGroup --Ops.OpsGroup#OPSGROUP
local carrier=Carrier --Ops.OpsGroup#OPSGROUP.Element)
-- Info Message
local text=string.format("Group %s disembarked from carrier %s of group %s", infantry:GetName(), carrier.name, carriergroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
---
-- GROUND Basic Transport
--
-- A group of two TPz Fuchs transports infantry groups from Zone Kobulety X to a nearby Zone Alpha.
--
-- Once all troops were delivered, the carrier returns to its original position.
--
-- This script also contains many FSM events that are triggered when a carrier loads/unloads cargo and when groups are being loaded/unloaded.
--
-- NOTE that:
-- - Troops to be transported MUST be in the pickup zone. If not, they will not be considered for transport until they enter the zone!
-- - If a group is too heavy for the assigned transports, it will not be transported. Each group must fit into one UNIT of the group.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneDeploy=ZONE:New("Zone Alpha"):DrawZone()
-- Carrier group.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Cargo group.
local infantry=ARMYGROUP:New("Infantry Platoon Alpha-1")
infantry:Activate()
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantry, zonePickup, zoneDeploy)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
---
-- FSM events of the OPSTRANSPORT
---
--- Function called when an OPSGROUP is loaded into a carrier.
function opstransport:OnAfterLoaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup, CarrierElement)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrier=CarrierElement --Ops.OpsGroup#OPSGROUP.Element
-- Info message.
local text=string.format("Transport UID=%d opsgroup %s loaded into carrier %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrier.name)
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when an OPSGROUP is unloaded from the carrier.
function opstransport:OnAfterUnloaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
-- Info message.
local text=string.format("Transport UID=%d unloaded opsgroup %s from carrier group %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrieropsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- OPSGROUP is ready for further actions. Put up green smoke.
cargoopsgroup:GetGroup():SmokeGreen()
end
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
-- Info Message
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
---
-- FSM events for carrier groups
---
--- Function called when a carrier has loaded a cargo group.
function carrier:OnAfterLoaded(From, Event, To, CargoGroup)
local cargogroup=CargoGroup --Ops.OpsGroup#OPSGROUP
-- Info Message
local text=string.format("Group %s loaded group %s", carrier:GetName(), cargogroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier has unloaded a cargo group.
function carrier:OnAfterUnloaded(From, Event, To, CargoGroup)
local cargogroup=CargoGroup --Ops.OpsGroup#OPSGROUP
-- Info Message
local text=string.format("Group %s unloaded group %s", carrier:GetName(), cargogroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when carrier goes to pickup cargo.
function carrier:OnAfterPickup(From,Event,To)
-- Info Message
local text=string.format("Group %s is picking up cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier is loading cargo.
function carrier:OnAfterLoading(From,Event,To)
-- Info Message
local text=string.format("Group %s is loading cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier has loaded all cargo.
function carrier:OnAfterLoadingDone(From, Event, To)
-- Info Message
local text=string.format("Group %s loaded all cargo", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when the carrier transports cargo from pickup to deploy zone.
function carrier:OnAfterTransport(From, Event, To)
-- Info Message
local text=string.format("Group %s is transporting cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier is unloading cargo.
function carrier:OnAfterUnLoading(From,Event,To)
-- Info Message
local text=string.format("Group %s is unloading cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when a carrier is done with onloading its cargo.
function carrier:OnAfterUnloadingDone(From, Event, To)
-- Info Message
local text=string.format("Group %s is finished unloading cargo...", carrier:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
---
-- FSM events for cargo groups
---
--- Function called when a cargo group is ordered to board a carrier.
function infantry:OnAfterBoard(From, Event, To, CarrierGroup, Carrier)
local carriergroup=CarrierGroup --Ops.OpsGroup#OPSGROUP
local carrier=Carrier --Ops.OpsGroup#OPSGROUP.Element
-- Info Message
local text=string.format("Group %s will board into carrier %s of group %s", infantry:GetName(), carrier.name, carriergroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when the group disembarked a carrier.
function infantry:OnAfterEmbarked(From, Event, To, CarrierGroup, Carrier)
local carriergroup=CarrierGroup --Ops.OpsGroup#OPSGROUP
local carrier=Carrier --Ops.OpsGroup#OPSGROUP.Element)
-- Info Message
local text=string.format("Group %s embarked into carrier %s of group %s", infantry:GetName(), carrier.name, carriergroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when the group disembarked a carrier.
function infantry:OnAfterDisembarked(From, Event, To, CarrierGroup, Carrier)
local carriergroup=CarrierGroup --Ops.OpsGroup#OPSGROUP
local carrier=Carrier --Ops.OpsGroup#OPSGROUP.Element)
-- Info Message
local text=string.format("Group %s disembarked from carrier %s of group %s", infantry:GetName(), carrier.name, carriergroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end

View File

@@ -1,35 +1,35 @@
---
-- GROUND Transport Waiting
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
-- The infantry troops were just involved in a fire fight and are now returning to the briefed pickup zone.
-- Once the troops arrive in the pickup zone, the carrier will go there to pick them up.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneDeploy=ZONE:New("Zone Alpha"):DrawZone()
-- Carrier group.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Infantry group to be transported.
local infantry=ARMYGROUP:New("Infantry Platoon Bravo-1")
infantry:Activate()
-- Add waypoint to make the group move to the pickup zone.
infantry:AddWaypoint(zonePickup:GetRandomCoordinate())
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantry, zonePickup, zoneDeploy)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport.uid, opstransport.Ncargo, opstransport.Ndelivered)
MESSAGE:New(text, 60):ToAll()
env.info(text)
---
-- GROUND Transport Waiting
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
-- The infantry troops were just involved in a fire fight and are now returning to the briefed pickup zone.
-- Once the troops arrive in the pickup zone, the carrier will go there to pick them up.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneDeploy=ZONE:New("Zone Alpha"):DrawZone()
-- Carrier group.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Infantry group to be transported.
local infantry=ARMYGROUP:New("Infantry Platoon Bravo-1")
infantry:Activate()
-- Add waypoint to make the group move to the pickup zone.
infantry:AddWaypoint(zonePickup:GetRandomCoordinate())
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantry, zonePickup, zoneDeploy)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport.uid, opstransport.Ncargo, opstransport.Ndelivered)
MESSAGE:New(text, 60):ToAll()
env.info(text)
end

View File

@@ -1,46 +1,46 @@
---
-- GROUND Transport Chain
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
-- Another transport APC group of on M113 is ordered to transport the troops from Zone Alpha to Zone Bravo.
--
-- The second transport will start once the first has been delivered.
-- The M113 is not able to pickup all troops at once and has to go multiple times beteen pickup and deploy zone.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneAlpha=ZONE:New("Zone Alpha"):DrawZone()
local zoneBravo=ZONE:New("Zone Bravo"):DrawZone()
-- Carrier group A.
local carrierA=ARMYGROUP:New("TPz Fuchs Group")
carrierA:Activate()
-- Carrier group B.
local carrierB=ARMYGROUP:New("APC M113")
carrierB:Activate()
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment from pickup zone to zone Alpha.
local opstransportA=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
-- Assign transport A to carrier A.
carrierA:AddOpsTransport(opstransportA)
-- Cargo transport assignment from zone Alpha to zone Bravo.
local opstransportB=OPSTRANSPORT:New(infantryset, zoneAlpha, zoneBravo)
-- Add start condition that first transport was delivered.
opstransportB:AddConditionStart(function()
return (opstransportA:IsDelivered() and opstransportA:GetNcargoDelivered()>0)
end)
-- Assign transport B to carrier B.
---
-- GROUND Transport Chain
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
-- Another transport APC group of on M113 is ordered to transport the troops from Zone Alpha to Zone Bravo.
--
-- The second transport will start once the first has been delivered.
-- The M113 is not able to pickup all troops at once and has to go multiple times beteen pickup and deploy zone.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneAlpha=ZONE:New("Zone Alpha"):DrawZone()
local zoneBravo=ZONE:New("Zone Bravo"):DrawZone()
-- Carrier group A.
local carrierA=ARMYGROUP:New("TPz Fuchs Group")
carrierA:Activate()
-- Carrier group B.
local carrierB=ARMYGROUP:New("APC M113")
carrierB:Activate()
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment from pickup zone to zone Alpha.
local opstransportA=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
-- Assign transport A to carrier A.
carrierA:AddOpsTransport(opstransportA)
-- Cargo transport assignment from zone Alpha to zone Bravo.
local opstransportB=OPSTRANSPORT:New(infantryset, zoneAlpha, zoneBravo)
-- Add start condition that first transport was delivered.
opstransportB:AddConditionStart(function()
return (opstransportA:IsDelivered() and opstransportA:GetNcargoDelivered()>0)
end)
-- Assign transport B to carrier B.
carrierB:AddOpsTransport(opstransportB)

View File

@@ -1,42 +1,42 @@
---
-- GROUND Transport Direct
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
-- Another transport APC group of on M113 is ordered to transport the troops from Zone Alpha to Zone Bravo.
-- This mission is very similar to demo mission 012.
--
-- However, in this case the troops will not unboard the first carrier. They will remain "inside" the TPz Fuchs
-- and will be directly transferred to the M113.
--
-- This can be handy in situations where it is diffcult for troops to unboard.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneAlpha=ZONE:New("Zone Alpha"):DrawZone()
local zoneBravo=ZONE:New("Zone Bravo"):DrawZone()
-- First carrier group.
local carrier1=ARMYGROUP:New("TPz Fuchs Group")
carrier1:Activate()
-- Second carrier group.
local carrier2=ARMYGROUP:New("APC M113")
carrier2:Activate()
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment from pickup zone to zone Alpha.
local transport1=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
-- Directly load into another carrier.
transport1:SetDisembarkCarriers(carrier2)
-- Transport assignment from zone Alpha to zone Bravo.
local transport2=OPSTRANSPORT:New(infantryset, zoneAlpha, zoneBravo)
-- Assign transports to carriers.
carrier1:AddOpsTransport(transport1)
---
-- GROUND Transport Direct
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
-- Another transport APC group of on M113 is ordered to transport the troops from Zone Alpha to Zone Bravo.
-- This mission is very similar to demo mission 012.
--
-- However, in this case the troops will not unboard the first carrier. They will remain "inside" the TPz Fuchs
-- and will be directly transferred to the M113.
--
-- This can be handy in situations where it is diffcult for troops to unboard.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneAlpha=ZONE:New("Zone Alpha"):DrawZone()
local zoneBravo=ZONE:New("Zone Bravo"):DrawZone()
-- First carrier group.
local carrier1=ARMYGROUP:New("TPz Fuchs Group")
carrier1:Activate()
-- Second carrier group.
local carrier2=ARMYGROUP:New("APC M113")
carrier2:Activate()
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment from pickup zone to zone Alpha.
local transport1=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
-- Directly load into another carrier.
transport1:SetDisembarkCarriers(carrier2)
-- Transport assignment from zone Alpha to zone Bravo.
local transport2=OPSTRANSPORT:New(infantryset, zoneAlpha, zoneBravo)
-- Assign transports to carriers.
carrier1:AddOpsTransport(transport1)
carrier2:AddOpsTransport(transport2)

View File

@@ -1,41 +1,41 @@
---
-- GROUND Cargo Dead
--
-- A TPz Fuchs group is assigned to transport cargo.
-- While the carrier is on its way to pickup the cargo, all cargo is destroyed.
--
-- When the cargo is dead, the carrier will abort the transport and return to its initial position.
--
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneDeploy=ZONE:New("Zone Alpha")
-- Carrier.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Set of groups to transport.
local infantryset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Destroy all cargo after 60 seconds.
infantryset:ForEach(function(_opsgroup)
local opsgroup=_opsgroup --Ops.ArmyGroup#ARMYGROUP
opsgroup:SelfDestruction(60)
end
)
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantryset, zonePickup, zoneDeploy)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
---
-- GROUND Cargo Dead
--
-- A TPz Fuchs group is assigned to transport cargo.
-- While the carrier is on its way to pickup the cargo, all cargo is destroyed.
--
-- When the cargo is dead, the carrier will abort the transport and return to its initial position.
--
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneDeploy=ZONE:New("Zone Alpha")
-- Carrier.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Set of groups to transport.
local infantryset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Destroy all cargo after 60 seconds.
infantryset:ForEach(function(_opsgroup)
local opsgroup=_opsgroup --Ops.ArmyGroup#ARMYGROUP
opsgroup:SelfDestruction(60)
end
)
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantryset, zonePickup, zoneDeploy)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end

View File

@@ -1,71 +1,71 @@
---
-- GROUND Carrier Dead
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
--
-- Before the carrier can pickup the cargo, it is destroyed.
--
-- When the carrier is destroyed, it is respawned and the transport is assigned to the carrier again.
--
-- Once the carrier has loaded the cargo and starts its transport, it is destroyed again.
-- The loaded cargo is also destroyed.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneAlpha=ZONE:New("Zone Alpha")
-- Carrier group.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- After 30 seconds the carrier is destroyed.
carrier:SelfDestruction(30)
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
transport:SetVerbosity(3)
-- Assign transports to carriers.
function carrier:OnAfterSpawned(From,Event,To)
env.info("Carrier spawned!")
if transport and not transport:IsDelivered() then
env.info("Assigning transport to carrier...")
carrier:AddOpsTransport(transport)
end
end
--- Function called after a carrier group is dead.
function transport:OnAfterDeadCarrierGroup(From, Event, To, OpsGroup)
local opsgroup=OpsGroup --Ops.ArmyGroup#ARMYGROUP
local text=string.format("Carrier group %s is DEAD!", opsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- Respawn group after 60 seconds.
opsgroup:__Respawn(60)
end
--- Function called after all assigned carriers are dead.
function transport:OnAfterDeadCarrierAll(From, Event, To)
local text=string.format("All Carriers of transport UID=%d are DEAD!", transport:GetUID())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called after all cargo was delivered OR is dead!
function transport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d DELIVERED! Number of delivered cargo groups %d of %d", transport:GetUID(), transport:GetNcargoDelivered(), transport:GetNcargoTotal())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called after the carrier started transporting troops.
function carrier:OnAfterTransport(From,Event,To)
-- Destroy carrier. The loaded cargo is also destroyed.
carrier:SelfDestruction(60)
---
-- GROUND Carrier Dead
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
--
-- Before the carrier can pickup the cargo, it is destroyed.
--
-- When the carrier is destroyed, it is respawned and the transport is assigned to the carrier again.
--
-- Once the carrier has loaded the cargo and starts its transport, it is destroyed again.
-- The loaded cargo is also destroyed.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneAlpha=ZONE:New("Zone Alpha")
-- Carrier group.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- After 30 seconds the carrier is destroyed.
carrier:SelfDestruction(30)
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
transport:SetVerbosity(3)
-- Assign transports to carriers.
function carrier:OnAfterSpawned(From,Event,To)
env.info("FF carrier spawned")
if transport and not transport:IsDelivered() then
env.info("FF adding transport")
carrier:AddOpsTransport(transport)
end
end
--- Function called after a carrier group is dead.
function transport:OnAfterDeadCarrierGroup(From, Event, To, OpsGroup)
local opsgroup=OpsGroup --Ops.ArmyGroup#ARMYGROUP
local text=string.format("Carrier group %s is DEAD!", opsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- Respawn group after 60 seconds.
opsgroup:__Respawn(60)
end
--- Function called after all assigned carriers are dead.
function transport:OnAfterDeadCarrierAll(From, Event, To)
local text=string.format("All Carriers of transport UID=%d are DEAD!", transport:GetUID())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called after all cargo was delivered OR is dead!
function transport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d DELIVERED! Number of delivered cargo groups %d of %d", transport:GetUID(), transport:GetNcargoDelivered(), transport:GetNcargoTotal())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called after the carrier started transporting troops.
function carrier:OnAfterTransport(From,Event,To)
-- Destroy carrier. The loaded cargo is also destroyed.
carrier:SelfDestruction(60)
end

View File

@@ -1,34 +1,34 @@
---
-- GROUND Too many carriers
--
-- Two carriers are assigned to transport troops. The cargo already fits into one of the carriers.
--
-- Both carriers will drive to the pickup zone. All cargo will be loaded into one carrier.
-- The second carrier will wait at the pickup zone in case more cargo is added to the transport.
--
-- Once the first carrier has delivered all cargo, both carriers will return to their initial position.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Engage X")
local zoneAlpha=ZONE:New("Zone Kobuleti X")
-- First carrier.
local carrier1=ARMYGROUP:New("AAV-7-1")
carrier1:Activate()
-- Second carrier.
local carrier2=ARMYGROUP:New("AAV-7-2")
carrier2:Activate()
-- Set of groups to transport.
local infantryset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Echo"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
transport:SetVerbosity(3)
-- Assign transport to carriers.
carrier1:AddOpsTransport(transport)
---
-- GROUND Too many carriers
--
-- Two carriers are assigned to transport troops. The cargo already fits into one of the carriers.
--
-- Both carriers will drive to the pickup zone. All cargo will be loaded into one carrier.
-- The second carrier will wait at the pickup zone in case more cargo is added to the transport.
--
-- Once the first carrier has delivered all cargo, both carriers will return to their initial position.
-- -
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Engage X")
local zoneAlpha=ZONE:New("Zone Kobuleti X")
-- First carrier.
local carrier1=ARMYGROUP:New("AAV-7-1")
carrier1:Activate()
-- Second carrier.
local carrier2=ARMYGROUP:New("AAV-7-2")
carrier2:Activate()
-- Set of groups to transport.
local infantryset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Echo"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
transport:SetVerbosity(3)
-- Assign transport to carriers.
carrier1:AddOpsTransport(transport)
carrier2:AddOpsTransport(transport)

View File

@@ -1,43 +1,43 @@
---
-- GROUND Transport In Utero
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
--
-- Another group of one M-113 APC is ordered to pick up the troops at zone Alpha and transport them to zone Bravo.
-- The second transport is scheduled to start at 0915 hours.
--
-- When the troops are unloaded in zone Alpha, they are NOT spawned inside the deploy zone Alpha. Instead they remain "in utero".
-- This can be handy in cases where spawning groups is difficult. For example, ground groups cannot be spawned on ships or oil-rigs.
-- In DCS the groups would fall through the ship into the sea.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneAlpha=ZONE:New("Zone Alpha")
local zoneBravo=ZONE:New("Zone Bravo")
-- Carrier group.
local carrier1=ARMYGROUP:New("TPz Fuchs Group")
carrier1:Activate()
-- Carrier group.
local carrier2=ARMYGROUP:New("APC M113")
carrier2:Activate()
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local transport1=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
-- Troops are not spawned after disembarkment. They remain in state "InUtero".
transport1:SetDisembarkInUtero(true)
-- Second transport assignment. Scheduled for 0915 hours.
local transport2=OPSTRANSPORT:New(infantryset, zoneAlpha, zoneBravo)
transport2:SetTime("9:15")
-- Assign transports to carriers.
carrier1:AddOpsTransport(transport1)
---
-- GROUND Transport In Utero
--
-- A group of two TPz Fuchs is ordered to transport and infantry group from Zone Kobulety X to a nearby Zone Alpha.
--
-- Another group of one M-113 APC is ordered to pick up the troops at zone Alpha and transport them to zone Bravo.
-- The second transport is scheduled to start at 0915 hours.
--
-- When the troops are unloaded in zone Alpha, they are NOT spawned inside the deploy zone Alpha. Instead they remain "in utero".
-- This can be handy in cases where spawning groups is difficult. For example, ground groups cannot be spawned on ships or oil-rigs.
-- In DCS the groups would fall through the ship into the sea.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneAlpha=ZONE:New("Zone Alpha")
local zoneBravo=ZONE:New("Zone Bravo")
-- Carrier group.
local carrier1=ARMYGROUP:New("TPz Fuchs Group")
carrier1:Activate()
-- Carrier group.
local carrier2=ARMYGROUP:New("APC M113")
carrier2:Activate()
-- Set of groups to transport.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local transport1=OPSTRANSPORT:New(infantryset, zonePickup, zoneAlpha)
-- Troops are not spawned after disembarkment. They remain in state "InUtero".
transport1:SetDisembarkInUtero(true)
-- Second transport assignment. Scheduled for 0915 hours.
local transport2=OPSTRANSPORT:New(infantryset, zoneAlpha, zoneBravo)
transport2:SetTime("9:15")
-- Assign transports to carriers.
carrier1:AddOpsTransport(transport1)
carrier2:AddOpsTransport(transport2)

View File

@@ -1,73 +1,73 @@
---
-- GROUND Transport Zone Combos
--
-- A group of two TPz Fuchs transports infantry groups from Zone Kobulety X.
--
-- One infantry group should be delivered to zone Alpha, while the second group should be delivered to zone Bravo.
-- To achieve this, we use "Transport Zone Combos" (TPZ).
--
-- For the transport to zone Alpha, the carrier will drive on roads.
-- For the transport to zone Bravo, the carrier will drive off roads.
---
-- Pickup and deploy zones.
local PickupZone=ZONE:New("Zone Kobuleti X")
local DeployZoneAlpha=ZONE:New("Zone Alpha")
local DeployZoneBravo=ZONE:New("Zone Bravo")
-- Carrier.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Set of groups to transport.
local Infantry1=GROUP:FindByName("Infantry Platoon Alpha-1"):Activate()
local Infantry2=GROUP:FindByName("Infantry Platoon Alpha-2"):Activate()
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New()
-- Add TZCs.
local tpzAlpha=opstransport:AddTransportZoneCombo(Infantry1, PickupZone, DeployZoneAlpha)
local tpzBravo=opstransport:AddTransportZoneCombo(Infantry2, PickupZone, DeployZoneBravo)
-- Transport to zone Alpha will be on road.
opstransport:SetFormationPickup(ENUMS.Formation.Vehicle.OnRoad, tpzAlpha)
opstransport:SetFormationTransport(ENUMS.Formation.Vehicle.OnRoad, tpzAlpha)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
--- Function called when an OPSGROUP is loaded into a carrier.
function opstransport:OnAfterLoaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup, CarrierElement)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrier=CarrierElement --Ops.OpsGroup#OPSGROUP.Element
-- Info message.
local text=string.format("Transport UID=%d opsgroup %s loaded into carrier %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrier.name)
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when an OPSGROUP is unloaded from the carrier.
function opstransport:OnAfterUnloaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
-- Info message.
local text=string.format("Transport UID=%d unloaded opsgroup %s from carrier group %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrieropsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- OPSGROUP is ready for further actions. Put up green smoke.
cargoopsgroup:GetGroup():SmokeGreen()
end
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
---
-- GROUND Transport Zone Combos
--
-- A group of two TPz Fuchs transports infantry groups from Zone Kobulety X.
--
-- One infantry group should be delivered to zone Alpha, while the second group should be delivered to zone Bravo.
-- To achieve this, we use "Transport Zone Combos" (TPZ).
--
-- For the transport to zone Alpha, the carrier will drive on roads.
-- For the transport to zone Bravo, the carrier will drive off roads.
---
-- Pickup and deploy zones.
local PickupZone=ZONE:New("Zone Kobuleti X")
local DeployZoneAlpha=ZONE:New("Zone Alpha")
local DeployZoneBravo=ZONE:New("Zone Bravo")
-- Carrier.
local carrier=ARMYGROUP:New("TPz Fuchs Group")
carrier:Activate()
-- Set of groups to transport.
local Infantry1=GROUP:FindByName("Infantry Platoon Alpha-1"):Activate()
local Infantry2=GROUP:FindByName("Infantry Platoon Alpha-2"):Activate()
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New()
-- Add TZCs.
local tpzAlpha=opstransport:AddTransportZoneCombo(Infantry1, PickupZone, DeployZoneAlpha)
local tpzBravo=opstransport:AddTransportZoneCombo(Infantry2, PickupZone, DeployZoneBravo)
-- Transport to zone Alpha will be on road.
opstransport:SetFormationPickup(ENUMS.Formation.Vehicle.OnRoad, tpzAlpha)
opstransport:SetFormationTransport(ENUMS.Formation.Vehicle.OnRoad, tpzAlpha)
-- Assign transport to carrier.
carrier:AddOpsTransport(opstransport)
--- Function called when an OPSGROUP is loaded into a carrier.
function opstransport:OnAfterLoaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup, CarrierElement)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrier=CarrierElement --Ops.OpsGroup#OPSGROUP.Element
-- Info message.
local text=string.format("Transport UID=%d opsgroup %s loaded into carrier %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrier.name)
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when an OPSGROUP is unloaded from the carrier.
function opstransport:OnAfterUnloaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
-- Info message.
local text=string.format("Transport UID=%d unloaded opsgroup %s from carrier group %s", opstransport:GetUID(), cargoopsgroup:GetName(), carrieropsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- OPSGROUP is ready for further actions. Put up green smoke.
cargoopsgroup:GetGroup():SmokeGreen()
end
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end

View File

@@ -1,52 +1,52 @@
---
-- GROUND Transport with Mission
--
-- TPz Fuchs groups is assigned to transport an infantry group from Kobuleti Town to zone Alpha.
--
-- However, the carriers are currently on a mission to patrol zone Engage X. They will not conduct any transport
-- assignments until that mission is over. The patrol mission is scheduled to end at 0910 hours.
--
-- Also, the infantry is currently on a mission. It will not be transported until that mission is over.
-- The mission ends at 0920 hours.
--
-- The carriers are assigned to carry out another patrol mission in zone Kobuleti X. That mission starts at 0915 hours
-- and ends at 0940 hours. When the mission starts, the carriers are still busy with the transport. The mission will not
-- start until all cargo has been delivered.
--
-- Zones.
local zonePickup=ZONE:New("Zone Kobuleti Town"):DrawZone()
local zoneDeploy=ZONE:New("Zone Alpha"):DrawZone()
local zoneKobuletiX=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneEngageX=ZONE:New("Zone Engage X"):DrawZone()
-- Mission to patrol Zone Engage X until 0910 hours.
local missionPatrol1=AUFTRAG:NewPATROLZONE(zoneEngageX)
missionPatrol1:SetTime(nil, "9:10")
-- Mission to patrol Zone Kobuleti X form 0915 to 0940 hours.
local missionPatrol2=AUFTRAG:NewPATROLZONE(zoneKobuletiX)
missionPatrol2:SetTime("9:15", "9:40")
-- Mission to stand guard until 0920 hours.
local missionGuard=AUFTRAG:NewONGUARD(zonePickup:GetCoordinate())
missionGuard:SetTime(nil, "9:20")
-- Cargo group.
local infantry=ARMYGROUP:New("Infantry Platoon Bravo-1"):Activate()
-- Add mission to cargo group.
infantry:AddMission(missionGuard)
-- Carrier group.
local carrier=ARMYGROUP:New("AAV-7-1"):Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(infantry, zonePickup, zoneDeploy)
-- Add transport to carrier.
carrier:AddOpsTransport(transport)
-- Add patrol missions to carrier.
carrier:AddMission(missionPatrol1)
---
-- GROUND Transport with Mission
--
-- TPz Fuchs groups is assigned to transport an infantry group from Kobuleti Town to zone Alpha.
--
-- However, the carriers are currently on a mission to patrol zone Engage X. They will not conduct any transport
-- assignments until that mission is over. The patrol mission is scheduled to end at 0910 hours.
--
-- Also, the infantry is currently on a mission. It will not be transported until that mission is over.
-- The mission ends at 0920 hours.
--
-- The carriers are assigned to carry out another patrol mission in zone Kobuleti X. That mission starts at 0915 hours
-- and ends at 0940 hours. When the mission starts, the carriers are still busy with the transport. The mission will not
-- start until all cargo has been delivered.
--
-- Zones.
local zonePickup=ZONE:New("Zone Kobuleti Town"):DrawZone()
local zoneDeploy=ZONE:New("Zone Alpha"):DrawZone()
local zoneKobuletiX=ZONE:New("Zone Kobuleti X"):DrawZone()
local zoneEngageX=ZONE:New("Zone Engage X"):DrawZone()
-- Mission to patrol Zone Engage X until 0910 hours.
local missionPatrol1=AUFTRAG:NewPATROLZONE(zoneEngageX)
missionPatrol1:SetTime(nil, "9:10")
-- Mission to patrol Zone Kobuleti X form 0915 to 0940 hours.
local missionPatrol2=AUFTRAG:NewPATROLZONE(zoneKobuletiX)
missionPatrol2:SetTime("9:15", "9:40")
-- Mission to stand guard until 0920 hours.
local missionGuard=AUFTRAG:NewONGUARD(zonePickup:GetCoordinate())
missionGuard:SetTime(nil, "9:20")
-- Cargo group.
local infantry=ARMYGROUP:New("Infantry Platoon Bravo-1"):Activate()
-- Add mission to cargo group.
infantry:AddMission(missionGuard)
-- Carrier group.
local carrier=ARMYGROUP:New("AAV-7-1"):Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(infantry, zonePickup, zoneDeploy)
-- Add transport to carrier.
carrier:AddOpsTransport(transport)
-- Add patrol missions to carrier.
carrier:AddMission(missionPatrol1)
carrier:AddMission(missionPatrol2)

View File

@@ -1,31 +1,31 @@
---
-- HELO: Basic Transport
--
-- Two Huey groups are stationed at FARP Berlin. Both are assigned to pickup troops at zone Kobuleti X and deliver them to zone Bravo.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneDeploy=ZONE:New("Zone Bravo")
-- Cargo set.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantryset, zonePickup, zoneDeploy)
-- Huey Carrier.
local hueyAlpha1=FLIGHTGROUP:New("UH-1H Alpha-1")
hueyAlpha1:Activate()
-- Cargo transport assignment to first Huey group.
hueyAlpha1:AddOpsTransport(opstransport)
-- Huey Carrier.
local hueyAlpha2=FLIGHTGROUP:New("UH-1H Alpha-2")
hueyAlpha2:Activate()
-- Add transport to second Huey.
---
-- HELO: Basic Transport
--
-- Two Huey groups are stationed at FARP Berlin. Both are assigned to pickup troops at zone Kobuleti X and deliver them to zone Bravo.
---
-- Pickup and deploy zones.
local zonePickup=ZONE:New("Zone Kobuleti X")
local zoneDeploy=ZONE:New("Zone Bravo")
-- Cargo set.
local infantryset=SET_GROUP:New():FilterPrefixes("Infantry Platoon Alpha"):FilterOnce()
infantryset:Activate()
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(infantryset, zonePickup, zoneDeploy)
-- Huey Carrier.
local hueyAlpha1=FLIGHTGROUP:New("UH-1H Alpha-1")
hueyAlpha1:Activate()
-- Cargo transport assignment to first Huey group.
hueyAlpha1:AddOpsTransport(opstransport)
-- Huey Carrier.
local hueyAlpha2=FLIGHTGROUP:New("UH-1H Alpha-2")
hueyAlpha2:Activate()
-- Add transport to second Huey.
hueyAlpha2:AddOpsTransport(opstransport)

View File

@@ -1,29 +1,29 @@
---
-- HELO: Transport FARP to FARP
--
-- A Huey group is stationed at Farp Berlin.
-- It is assigned to transport Infantry groups from Farp Berlin to Farp London.
--
-- *** IMPORTANT ***
--
-- Note that both the pickup and the deploy zones are ZONE_AIRBASE type objects here!
-- If a pickup or deploy zone is a ZONE_AIRBASE instead of a ZONE, aircraft will land
-- at the airbase parkings for pickup or deployment of cargo.
---
-- Carrier group.
local huey=FLIGHTGROUP:New("UH-1H Alpha-1")
-- Pickup and deploy zones. Both are ZONE_AIRBASES so the helo lands at the airbase.
local zonePickup=ZONE_AIRBASE:New("Farp Berlin")
local zoneDeploy=ZONE_AIRBASE:New("Farp London")
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Charlie"):FilterOnce() --Core.Set#SET_OPSGROUP
cargoset:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Assign transport to Huey.
---
-- HELO: Transport FARP to FARP
--
-- A Huey group is stationed at Farp Berlin.
-- It is assigned to transport Infantry groups from Farp Berlin to Farp London.
--
-- *** IMPORTANT ***
--
-- Note that both the pickup and the deploy zones are ZONE_AIRBASE type objects here!
-- If a pickup or deploy zone is a ZONE_AIRBASE instead of a ZONE, aircraft will land
-- at the airbase parkings for pickup or deployment of cargo.
---
-- Carrier group.
local huey=FLIGHTGROUP:New("UH-1H Alpha-1")
-- Pickup and deploy zones. Both are ZONE_AIRBASES so the helo lands at the airbase.
local zonePickup=ZONE_AIRBASE:New("Farp Berlin")
local zoneDeploy=ZONE_AIRBASE:New("Farp London")
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Charlie"):FilterOnce() --Core.Set#SET_OPSGROUP
cargoset:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Assign transport to Huey.
huey:AddOpsTransport(transport)

View File

@@ -1,33 +1,33 @@
---
-- HELO: FARP to Ship
--
-- A Huey group is ordered to transport troops from Farp Berlin to the USS Shiloh.
--
-- As ground groups can "stand" on ships in DCS, the troops are directly loaded into
-- the cargo bay of the ship.
--
-- NOTE that the deploy zone of the ship is a ZONE_AIRBASE object.
-- Only if it is a ZONE_AIRBASE the helo will land on the landing platform of the ship.
---
-- Carrier.
local huey=FLIGHTGROUP:New("UH-1H Alpha-1")
huey:Activate(1)
-- Destination.
local ship=NAVYGROUP:New("Ticonderoga Alpha")
ship:Activate()
-- Pickup and deploy zones. Must be ZONE_AIRBASEs!
local zonePickup=ZONE_AIRBASE:New("Farp Berlin")
local zoneDeploy=ZONE_AIRBASE:New("USS Shiloh")
-- Cargo set.
local infset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Charlie"):FilterOnce()
infset:Activate()
-- Create a transport assignment from FARP to Ship. The cargo is directly transferred into the carrier!
local transport=OPSTRANSPORT:New(infset, zonePickup, zoneDeploy)
-- Assign transport to Huey.
---
-- HELO: FARP to Ship
--
-- A Huey group is ordered to transport troops from Farp Berlin to the USS Shiloh.
--
-- As ground groups can "stand" on ships in DCS, the troops are directly loaded into
-- the cargo bay of the ship.
--
-- NOTE that the deploy zone of the ship is a ZONE_AIRBASE object.
-- Only if it is a ZONE_AIRBASE the helo will land on the landing platform of the ship.
---
-- Carrier.
local huey=FLIGHTGROUP:New("UH-1H Alpha-1")
huey:Activate(1)
-- Destination.
local ship=NAVYGROUP:New("Ticonderoga Alpha")
ship:Activate()
-- Pickup and deploy zones. Must be ZONE_AIRBASEs!
local zonePickup=ZONE_AIRBASE:New("Farp Berlin")
local zoneDeploy=ZONE_AIRBASE:New("USS Shiloh")
-- Cargo set.
local infset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Charlie"):FilterOnce()
infset:Activate()
-- Create a transport assignment from FARP to Ship. The cargo is directly transferred into the carrier!
local transport=OPSTRANSPORT:New(infset, zonePickup, zoneDeploy)
-- Assign transport to Huey.
huey:AddOpsTransport(transport)

View File

@@ -1,54 +1,53 @@
---
-- HELO: Respawn after Destroyed
--
-- Huey is ordered to transport infantry.
--
-- Before the cargo can be loaded, the enemy destroys the Huey.
-- The group is then respawned and the transport is newly assigned.
--
-- The respawned huey is really unlucky and gets destroyed again
-- 60 seconds after taking off. This also destroys the loaded cargo groups.
-- However, it seems to have seven lives and gets respawned again.
-- The remaining infantry group is loaded and safely delivered to the deploy zone.
---
-- Carrier group.
local huey=FLIGHTGROUP:New("UH-1H Alpha-1")
-- Pickup and deploy zones. Both are ZONE_AIRBASES so the helo lands at the airbase.
local zonePickup=ZONE_AIRBASE:New("Farp Berlin")
local zoneDeploy=ZONE_AIRBASE:New("Farp London")
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Charlie"):FilterOnce() --Core.Set#SET_OPSGROUP
cargoset:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Assign transport to Huey.
huey:AddOpsTransport(transport)
-- Destroy the helo group.
huey:SelfDestruction(90)
--- Function called after the helo is destroyed.
function huey:OnAfterDestroyed(From, Event, To)
huey:__Respawn(-1)
end
--- Also destroy the huey once when airborne.
local destroymeonce=true
function huey:OnAfterAirborne()
if destroymeonce then
huey:SelfDestruction(60)
destroymeonce=false
end
end
--- Function called when the carrier group is dead.
function transport:OnAfterDeadCarrierGroup(From, Event, To, OpsGroup)
local flightgroup=OpsGroup --Ops.OpsGroup#OPSGROUP
flightgroup:AddOpsTransport(transport)
---
-- HELO: Respawn after Destroyed
--
-- Huey is ordered to transport infantry.
--
-- Before the cargo can be loaded, the enemy destroyes the Huey.
-- The group is then respawned and the transport is newly assigned.
--
-- The respawned huey is really unlucky and gets destroyed again
-- 60 seconds after taking off. This also destroyes the loaded cargo groups.
-- However, it seems to have seven lifes and gets respawned again.
-- The remaining infantry group is loaded and safely delivered to the deploy zone.
---
-- Carrier group.
local huey=FLIGHTGROUP:New("UH-1H Alpha-1")
-- Pickup and deploy zones. Both are ZONE_AIRBASES so the helo lands at the airbase.
local zonePickup=ZONE_AIRBASE:New("Farp Berlin")
local zoneDeploy=ZONE_AIRBASE:New("Farp London")
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Charlie"):FilterOnce() --Core.Set#SET_OPSGROUP
cargoset:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Assign transport to Huey.
huey:AddOpsTransport(transport)
-- Destroy the helo group.
huey:SelfDestruction(90)
--- Function called after the helo is destroyed.
function huey:OnAfterDestroyed(From, Event, To)
huey:__Respawn(-1)
end
--- Also destroy the huey once when airborne.
local destroymeonce=true
function huey:OnAfterAirborne()
if destroymeonce then
huey:SelfDestruction(60)
destroymeonce=false
end
end
--- Function called when the carrier group is dead.
function transport:OnAfterDeadCarrierGroup(From, Event, To, OpsGroup)
local flightgroup=OpsGroup --Ops.OpsGroup#OPSGROUP
flightgroup:AddOpsTransport(transport)
end

View File

@@ -1,78 +1,78 @@
---
-- AIRPLANE: Basic Transport
--
-- A C-130 Hercules (spawned in air) is assigned to pick up heavy cargo (tanks) at Kobuleti and deliver them to Gudauta.
--
-- The homebase of the Hercules is Batumi. Once the cargo has been delivered, the plane will go there.
--
-- *** IMPORTANT ***
--
-- Note the the pickup and depoly zones have to be ZONE_AIRBASE objects as airplanes can only land at airbases.
---
-- Carrier group.
local c130=FLIGHTGROUP:New("C-130 Alpha")
c130:Activate(1)
-- Define area where troops are unloaded relative to the aircraft.
c130:SetCarrierUnloaderBack(50, 20)
-- The default cruise altitude of aircraft is 10,000 ft. Here we set it to 12,000 ft.
c130:SetDefaultAltitude(12000)
-- Air start (i.e. no home or destination base). Set homebase to Batumi. Once the transport is finished, the aircarft will RTB to Batumi.
c130:SetHomebase(AIRBASE:FindByName("Batumi"))
-- Pickup and deploy base. NOTE that we use ZONE_AIRBASE here, which is important for aircraft as they can only land there.
local zonePickup=ZONE_AIRBASE:New("Kobuleti", 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
-- Cargo set.
local cargoset=SET_GROUP:New():FilterPrefixes("Tank Platoon Kobuleti Alpha"):FilterOnce()
cargoset:Activate()
-- Ops transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Assign transport to C-130.
c130:AddOpsTransport(transport)
---
-- FSM events of the OPSTRANSPORT
---
--- Function called when an OPSGROUP is loaded into a carrier.
function transport:OnAfterLoaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup, CarrierElement)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrier=CarrierElement --Ops.OpsGroup#OPSGROUP.Element
-- Info message.
local text=string.format("Transport UID=%d opsgroup %s loaded into carrier %s", transport:GetUID(), cargoopsgroup:GetName(), carrier.name)
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when an OPSGROUP is unloaded from the carrier.
function transport:OnAfterUnloaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
-- Info message.
local text=string.format("Transport UID=%d unloaded opsgroup %s from carrier group %s", transport:GetUID(), cargoopsgroup:GetName(), carrieropsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- OPSGROUP is ready for further actions. Put up green smoke.
cargoopsgroup:GetGroup():SmokeGreen()
end
--- Function called when transport was delivered or everyone (remaining) is dead.
function transport:OnAfterDelivered(From, Event, To)
-- Info Message
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", transport:GetUID(), transport:GetNcargoTotal(), transport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
---
-- AIRPLANE: Basic Transport
--
-- A C-130 Hercules (spawned in air) is assigned to pick up heavy cargo (tanks) at Kobuleti and deliver them to Gudauta.
--
-- The homebase of the Hercules is Batumi. Once the cargo has been delivered, the plane will go there.
--
-- *** IMPORTANT ***
--
-- Note the the pickup and depoly zones have to be ZONE_AIRBASE objects as airplanes can only land at airbases.
---
-- Carrier group.
local c130=FLIGHTGROUP:New("C-130 Alpha")
c130:Activate(1)
-- Define area where troops are unloaded relative to the aircraft.
c130:SetCarrierUnloaderBack(50, 20)
-- The default cruise altitude of aircraft is 10,000 ft. Here we set it to 12,000 ft.
c130:SetDefaultAltitude(12000)
-- Air start (i.e. no home or destination base). Set homebase to Batumi. Once the transport is finished, the aircarft will RTB to Batumi.
c130:SetHomebase(AIRBASE:FindByName("Batumi"))
-- Pickup and deploy base. NOTE that we use ZONE_AIRBASE here, which is important for aircraft as they can only land there.
local zonePickup=ZONE_AIRBASE:New("Kobuleti", 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
-- Cargo set.
local cargoset=SET_GROUP:New():FilterPrefixes("Tank Platoon Kobuleti Alpha"):FilterOnce()
cargoset:Activate()
-- Ops transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Assign transport to C-130.
c130:AddOpsTransport(transport)
---
-- FSM events of the OPSTRANSPORT
---
--- Function called when an OPSGROUP is loaded into a carrier.
function transport:OnAfterLoaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup, CarrierElement)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrier=CarrierElement --Ops.OpsGroup#OPSGROUP.Element
-- Info message.
local text=string.format("Transport UID=%d opsgroup %s loaded into carrier %s", transport:GetUID(), cargoopsgroup:GetName(), carrier.name)
MESSAGE:New(text, 60):ToAll()
env.info(text)
end
--- Function called when an OPSGROUP is unloaded from the carrier.
function transport:OnAfterUnloaded(From, Event, To, CargoOpsGroup, CarrierOpsGroup)
local cargoopsgroup=CargoOpsGroup --Ops.ArmyGroup#ARMYGROUP
local carrieropsgroup=CarrierOpsGroup --Ops.ArmyGroup#ARMYGROUP
-- Info message.
local text=string.format("Transport UID=%d unloaded opsgroup %s from carrier group %s", transport:GetUID(), cargoopsgroup:GetName(), carrieropsgroup:GetName())
MESSAGE:New(text, 60):ToAll()
env.info(text)
-- OPSGROUP is ready for further actions. Put up green smoke.
cargoopsgroup:GetGroup():SmokeGreen()
end
--- Function called when transport was delivered or everyone (remaining) is dead.
function transport:OnAfterDelivered(From, Event, To)
-- Info Message
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", transport:GetUID(), transport:GetNcargoTotal(), transport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end

View File

@@ -1,26 +1,27 @@
---
-- AIRPLANE: Transport Base to Base
--
-- A C-130 is stationed at Kobuleti. It is assigned to transport cargo to Gudauta.
---
-- Hercules
local c130=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130:Activate(1)
-- Define area where troops are unloaded.
c130:SetCarrierUnloaderBack(50, 20)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New("Kobuleti", 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Kobuleti Alpha"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Add cargo transport.
---
-- AIRPLANE: Transport Base to Base
--
-- A C-130 is stationed at Kobuleti. It is assigned to transport cargo to Gudauta.
---
-- Hercules
local c130=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130:Activate(1)
-- Define area where troops are unloaded.
c130:SetCarrierUnloaderBack(50, 20)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New("Kobuleti", 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Kobuleti Alpha"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
transport:SetVerbosity(3)
-- Add cargo transport.
c130:AddOpsTransport(transport)

View File

@@ -1,38 +1,38 @@
---
-- AIRPLANE: Heavy Lift
--
-- A C-17 is stationed at Kobuleti. It is assigned to transport cargo to Gudauta.
--
-- The cargo consists of
--
-- * 2 M2 Bradley (total weight 42,600 kg)
-- * 3 M1126 Stryker (total weight 51711 kg)
-- * 1 M1 Abrams (total weight 57154 kg)
--
-- Note that the cargo capacity of the C-17 heavily depends on its internal fuel.
-- When full, its interal fuel ways 132,000 kg.
-- If fully loaded, it can only carry 7,300 kg payload.
-- If fuel is only half full, it can carry 73,000 kg payload.
---
-- Hercules
local c17=FLIGHTGROUP:New("C-17A Kobuleti Alpha")
c17:Activate(1)
-- Define area where troops are unloaded.
c17:SetCarrierUnloaderBack(50, 20)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New("Kobuleti", 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Kobuleti Delta"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
transport:SetVerbosity(3)
-- Add cargo transport.
---
-- AIRPLANE: Heavy Lift
--
-- A C-17 is stationed at Kobuleti. It is assigned to transport cargo to Gudauta.
--
-- The cargo consists of
--
-- * 2 M2 Bradley (total weight 42,600 kg)
-- * 3 M1126 Stryker (total weight 51711 kg)
-- * 1 M1 Abrams (total weight 57154 kg)
--
-- Note that the cargo capacity of the C-17 heavily depends on its internal fuel.
-- When full, its interal fuel ways 132,000 kg.
-- If fully loaded, it can only carry 7,300 kg payload.
-- If fuel is only half full, it can carry 73,000 kg payload.
---
-- Hercules
local c17=FLIGHTGROUP:New("C-17A Kobuleti Alpha")
c17:Activate(1)
-- Define area where troops are unloaded.
c17:SetCarrierUnloaderBack(50, 20)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New("Kobuleti", 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Kobuleti Delta"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
transport:SetVerbosity(3)
-- Add cargo transport.
c17:AddOpsTransport(transport)

View File

@@ -1,31 +1,31 @@
---
-- AIRPLANE: Realistic Weight-Realistic Problems
--
-- When cargo is loaded into an aircraft, the weight of the carrier
-- is increased via the trigger.action.setUnitInternalCargo() function.
--
-- This can lead to "problems" as it affects the flight characteristings.
--
-- To demonstrate this effect, we add 100 tons of cargo to a C-130 and
-- let it take off.
--
-- With the additional weight, the takeoff length increases significantly.
-- The runway at Kobuleti is too short and the aircraft will crash at the
-- end of the runway.
--
-- For comparison, a second C-130 without additional cargo takes off with
-- no problems.
---
-- C-130 without cargo.
local c130bravo=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130bravo:Activate()
c130bravo:StartUncontrolled(1)
-- C-130 with 100,0000 kg (artificial) cargo loaded.
local c130charlie=FLIGHTGROUP:New("C-130 Kobuleti Charlie")
c130charlie:Activate()
c130charlie:StartUncontrolled(1)
-- Add cargo weight.
---
-- AIRPLANE: Realistic Weight-Realistic Problems
--
-- When cargo is loaded into an aircraft, the weight of the carrier
-- is increased via the trigger.action.setUnitInternalCargo() function.
--
-- This can lead to "problems" as it affects the flight characteristings.
--
-- To demonstrate this effect, we add 100 tons of cargo to a C-130 and
-- let it take off.
--
-- With the additional weight, the takeoff length increases significantly.
-- The runway at Kobuleti is too short and the aircraft will crash at the
-- end of the runway.
--
-- For comparison, a second C-130 without additional cargo takes off with
-- no problems.
---
-- C-130 without cargo.
local c130bravo=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130bravo:Activate()
c130bravo:StartUncontrolled(1)
-- C-130 with 100,0000 kg (artificial) cargo loaded.
local c130charlie=FLIGHTGROUP:New("C-130 Kobuleti Charlie")
c130charlie:Activate()
c130charlie:StartUncontrolled(1)
-- Add cargo weight.
c130charlie:AddWeightCargo("C-130 Kobuleti Charlie-1", 100*1000)

View File

@@ -1,36 +1,36 @@
---
-- AIRPLANE: Cancel Transport for Flight
--
-- Two Hercules stationed at Kobuleti are assigned to transport cargo from Gudauta to Senaki.
--
-- After 10 min there is a change of plan and one of the C-130s cancels the transport.
-- It will then RTB, while the other C-130 carries out the transport.
---
-- Hercules at Kobuleti.
local c130bravo=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130bravo:SetCarrierUnloaderBack(50, 20)
c130bravo:Activate(1)
-- Hercules at Gudauta.
local c130charlie=FLIGHTGROUP:New("C-130 Kobuleti Charlie")
c130charlie:SetCarrierUnloaderBack(50, 20)
c130charlie:Activate(1)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Senaki_Kolkhi, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Gudauta Alpha"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Add cargo transport.
c130bravo:AddOpsTransport(transport)
c130charlie:AddOpsTransport(transport)
-- Hercules bravo cancels the transport.
---
-- AIRPLANE: Cancel Transport for Flight
--
-- Two Hercules stationed at Kobuleti are assigned to transport cargo from Gudauta to Senaki.
--
-- After 10 min there is a change of plan and one of the C-130s cancels the transport.
-- It will then RTB, while the other C-130 carries out the transport.
---
-- Hercules at Kobuleti.
local c130bravo=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130bravo:SetCarrierUnloaderBack(50, 20)
c130bravo:Activate(1)
-- Hercules at Gudauta.
local c130charlie=FLIGHTGROUP:New("C-130 Kobuleti Charlie")
c130charlie:SetCarrierUnloaderBack(50, 20)
c130charlie:Activate(1)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Senaki_Kolkhi, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Gudauta Alpha"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Add cargo transport.
c130bravo:AddOpsTransport(transport)
c130charlie:AddOpsTransport(transport)
-- Hercules bravo cancels the transport.
c130bravo:__TransportCancel(10*60, transport)

View File

@@ -1,36 +1,36 @@
---
-- AIRPLANE: Cancel Transport for All
--
-- Two Hercules stationed at Kobuleti are assigned to transport cargo from Gudauta to Senaki.
--
-- After 10 min there is a change of plan the transport is cancelled.
-- All assigned carriers will RTB to their home base.
---
-- Hercules at Kobuleti.
local c130bravo=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130bravo:SetCarrierUnloaderBack(50, 20)
c130bravo:Activate(1)
-- Hercules at Kobuleti.
local c130charlie=FLIGHTGROUP:New("C-130 Kobuleti Charlie")
c130charlie:SetCarrierUnloaderBack(50, 20)
c130charlie:Activate(1)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Senaki_Kolkhi, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Gudauta Alpha"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Add cargo transport.
c130bravo:AddOpsTransport(transport)
c130charlie:AddOpsTransport(transport)
-- Cancel the transport
transport:__Cancel(10*60)
---
-- AIRPLANE: Cancel Transport for Flight
--
-- Two Hercules stationed at Kobuleti are assigned to transport cargo from Gudauta to Senaki.
--
-- After 10 min there is a change of plan and one of the C-130s cancels the transport.
-- It will then RTB, while the other C-130 carries out the transport.
---
-- Hercules at Kobuleti.
local c130bravo=FLIGHTGROUP:New("C-130 Kobuleti Bravo")
c130bravo:SetCarrierUnloaderBack(50, 20)
c130bravo:Activate(1)
-- Hercules at Gudauta.
local c130charlie=FLIGHTGROUP:New("C-130 Kobuleti Charlie")
c130charlie:SetCarrierUnloaderBack(50, 20)
c130charlie:Activate(1)
-- Pickup and deploy zones.
local zonePickup=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gudauta, 5000)
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Senaki_Kolkhi, 5000)
-- Cargo set.
local cargoset=SET_OPSGROUP:New():FilterPrefixes("Tank Platoon Gudauta Alpha"):FilterOnce()
cargoset:Activate()
-- Cargo transport assignment.
local transport=OPSTRANSPORT:New(cargoset, zonePickup, zoneDeploy)
-- Add cargo transport.
c130bravo:AddOpsTransport(transport)
c130charlie:AddOpsTransport(transport)
-- Hercules bravo cancels the transport.
c130bravo:__TransportCancel(10*60, transport)

View File

@@ -1,40 +1,40 @@
---
-- NAVAL Basic Transport
--
-- The USS Shiloh is ordered to transport infantry from Zone Shore Alpha to Zone Shore Bravo.
--
-- Firstly, we need the usual pickup and deloy zones. These are the zones where the ship will go.
--
-- As ships obviously cannot pickup troops on land and ground groups are not good at swimming.
-- Therefore, we define embark and disembark zones. These are the zones where the troops are
-- supposed to wait for their transport.
--
-- If embark and/or disembark zones are defined, the troops need to be in these zones rather than
-- the pickup and deploy zones to be considered for transport.
--
-- Note that embark and disembark zones can also be used for ARMY- and FLIGHTGROUP carriers.
---
-- Zones.
local zonePickup=ZONE:New("Zone Sea Alpha"):DrawZone()
local zoneDeploy=ZONE:New("Zone Sea Bravo"):DrawZone()
local zoneEmbark=ZONE:New("Zone Shore Alpha"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Bravo"):DrawZone()
-- Carrier group.
local carrier=NAVYGROUP:New("Ticonderoga Alpha")
carrier:Activate()
-- Infantry cargo group.
local CargoGroup=GROUP:FindByName("Infantry Platoon Delta-1")
CargoGroup:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroup, zonePickup, zoneDeploy)
-- Set embark and disembark zone. These are the zones where the troops are supposed to be.
transport:SetEmbarkZone(zoneEmbark)
transport:SetDisembarkZone(zoneDisembark)
-- Assign transport to carrier.
---
-- NAVAL Basic Transport
--
-- The USS Shiloh is ordered to transport infantry from Zone Shore Alpha to Zone Shore Bravo.
--
-- Firstly, we need the usual pickup and deloy zones. These are the zones where the ship will go.
--
-- As ships obviously cannot pickup troops on land and ground groups are not good at swimming.
-- Therefore, we define embark and disembark zones. These are the zones where the troops are
-- supposed to wait for their transport.
--
-- If embark and/or disembark zones are defined, the troops need to be in these zones rather than
-- the pickup and deploy zones to be considered for transport.
--
-- Note that embark and disembark zones can also be used for ARMY- and FLIGHTGROUP carriers.
---
-- Zones.
local zonePickup=ZONE:New("Zone Sea Alpha"):DrawZone()
local zoneDeploy=ZONE:New("Zone Sea Bravo"):DrawZone()
local zoneEmbark=ZONE:New("Zone Shore Alpha"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Bravo"):DrawZone()
-- Carrier group.
local carrier=NAVYGROUP:New("Ticonderoga Alpha")
carrier:Activate()
-- Infantry cargo group.
local CargoGroup=GROUP:FindByName("Infantry Platoon Delta-1")
CargoGroup:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroup, zonePickup, zoneDeploy)
-- Set embark and disembark zone. These are the zones where the troops are supposed to be.
transport:SetEmbarkZone(zoneEmbark)
transport:SetDisembarkZone(zoneDisembark)
-- Assign transport to carrier.
carrier:AddOpsTransport(transport)

View File

@@ -1,57 +1,57 @@
---
-- NAVAL: Transport Ship-to-Ship
--
-- A speed boat is used to transfer troops from the beach to the bigger transport ship.
-- The speed boat needs to go two times to deliver all troops.
--
-- Once the speed boat has finished its transport assignment, the Handy Wind will transport
-- the troops to another deploy zone.
---
-- Zones.
local zonePickup=ZONE:New("Zone Sea Alpha"):DrawZone()
local zoneDeploy=ZONE:New("Zone Sea Bravo"):DrawZone()
local zoneSurf=ZONE:New("Zone Surf Alpha"):DrawZone()
local zoneEmbark=ZONE:New("Zone Shore Alpha"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Bravo"):DrawZone()
-- Carrier group.
local speedboat=NAVYGROUP:New("Speed Boat Alpha-1")
speedboat:Activate()
-- Carrier group.
local handywind=NAVYGROUP:New("Handy Wind")
handywind:Activate()
-- Infantry cargo group.
local CargoGroup=SET_GROUP:New():FilterPrefixes("Infantry Platoon Delta"):FilterOnce()
CargoGroup:Activate()
-- Transport assignment to deliver
local transfer=OPSTRANSPORT:New(CargoGroup, zoneSurf, zonePickup)
-- Set embark and disembark zone. These are the zones where the troops are supposed to be.
transfer:SetEmbarkZone(zoneEmbark)
-- Direct disembark to Handy Wind. The Handy wind has to be in the pickup zone for the
-- cargo groups to be transferred from the speed boats.
transfer:SetDisembarkCarriers(handywind)
-- Assign transport to carrier.
speedboat:AddOpsTransport(transfer)
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroup, zonePickup, zoneDeploy)
-- Set disembark zone.
transport:SetDisembarkZone(zoneDisembark)
-- Set required cargos. These group(s) need to be loaded before the _first_ transport starts.
-- Here this is advisable because the speed boats cannot transport all infantry in one go.
-- If this is not set, the Hany wind would already start the transport when the first
-- batch of cargo has been loaded.
transport:SetRequiredCargos(CargoGroup)
-- Assign transport to carrier.
---
-- NAVAL: Transport Ship-to-Ship
--
-- A speed boat is used to transfer troops from the beach to the bigger transport ship.
-- The speed boat needs to go two times to deliver all troops.
--
-- Once the speed boat has finished its transport assignment, the Handy Wind will transport
-- the troops to another deploy zone.
---
-- Zones.
local zonePickup=ZONE:New("Zone Sea Alpha"):DrawZone()
local zoneDeploy=ZONE:New("Zone Sea Bravo"):DrawZone()
local zoneSurf=ZONE:New("Zone Surf Alpha"):DrawZone()
local zoneEmbark=ZONE:New("Zone Shore Alpha"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Bravo"):DrawZone()
-- Carrier group.
local speedboat=NAVYGROUP:New("Speed Boat Alpha-1")
speedboat:Activate()
-- Carrier group.
local handywind=NAVYGROUP:New("Handy Wind")
handywind:Activate()
-- Infantry cargo group.
local CargoGroup=SET_GROUP:New():FilterPrefixes("Infantry Platoon Delta"):FilterOnce()
CargoGroup:Activate()
-- Transport assignment to deliver
local transfer=OPSTRANSPORT:New(CargoGroup, zoneSurf, zonePickup)
-- Set embark and disembark zone. These are the zones where the troops are supposed to be.
transfer:SetEmbarkZone(zoneEmbark)
-- Direct disembark to Handy Wind. The Handy wind has to be in the pickup zone for the
-- cargo groups to be transferred from the speed boats.
transfer:SetDisembarkCarriers(handywind)
-- Assign transport to carrier.
speedboat:AddOpsTransport(transfer)
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroup, zonePickup, zoneDeploy)
-- Set disembark zone.
transport:SetDisembarkZone(zoneDisembark)
-- Set required cargos. These group(s) need to be loaded before the _first_ transport starts.
-- Here this is advisable because the speed boats cannot transport all infantry in one go.
-- If this is not set, the Hany wind would already start the transport when the first
-- batch of cargo has been loaded.
transport:SetRequiredCargos(CargoGroup)
-- Assign transport to carrier.
handywind:AddOpsTransport(transport)

View File

@@ -1,103 +1,95 @@
---
-- NAVAL: Transport Ship-to-Ship but ferry ships are transported as well.
--
-- Three speed boats are used to transfer troops from the beach to a bigger transport ship.
-- Only one is actually needed to transport all troops.
--
-- Once the speed boat has finished its transport assignment, all three speed boats are
-- loaded into the Handy Wind as well.
--
-- All cargo is then transported to the deploy zone.
--
-- At the deploy zone, the speed boats will then transfer the troops from the Handy Wind
-- to the shore.
---
-- Zones.
local zonePickup=ZONE:New("Zone Sea Alpha"):DrawZone()
local zoneDeploy=ZONE:New("Zone Sea Bravo"):DrawZone()
-- Surf zones near the shores. This is where the speed boats will go to pickup and deploy the infantry groops.
local zoneSurfA=ZONE:New("Zone Surf Alpha"):DrawZone()
local zoneSurfB=ZONE:New("Zone Surf Bravo"):DrawZone()
-- Embark and disembark zones for infantry.
local zoneEmbark=ZONE:New("Zone Shore Alpha"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Bravo"):DrawZone()
-- Carrier group.
local handywind=NAVYGROUP:New("Handy Wind")
handywind:Activate()
-- Infantry group set.
local InfantrySet=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Delta-1"):FilterOnce()
InfantrySet:Activate()
-- Speed boat group set.
local SpeedboatSet=SET_OPSGROUP:New():FilterPrefixes("Speed Boat Alpha"):FilterOnce()
SpeedboatSet:Activate()
-- All cargo groups of the main transport.
local AllCargo=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Delta-1"):FilterPrefixes("Speed Boat Alpha"):FilterOnce()
---
-- Transfer from Shore Alpha to Pickup zone
---
-- Transport assignment for Speedboat: Pickup Infantry and deliver to pick up zone of Handy wind.
local transfer1=OPSTRANSPORT:New(InfantrySet, zoneSurfA, zonePickup)
-- Set embark and disembark zone. These are the zones where the troops are supposed to be.
transfer1:SetEmbarkZone(zoneEmbark)
-- Direct disembark to Handy Wind.
transfer1:SetDisembarkCarriers(handywind)
--- Function called when all cargo groups have beed delivered.
function transfer1:OnAfterDelivered()
-- Ensure that all carriers are inside the pickup zone.
local carriers=transfer1:GetCarriers()
for _,_carrier in pairs(carriers) do
local carrier=_carrier --Ops.NavyGroup#NAVYGROUP
if not carrier:IsInZone(zonePickup) then
carrier:AddWaypoint(zonePickup:GetRandomCoordinate())
end
end
end
---
-- Transport from Pickup to Deploy zone
---
-- Transport assignment.
local transport=OPSTRANSPORT:New(SpeedboatSet, zonePickup, zoneDeploy)
-- We add the Infantry troops as well, but set them to be unloaded in late activated state so they dont float on the water.
transport:AddCargoGroups(InfantrySet, nil, false)
-- Set that all cargo is required before transport of the FIRST batch starts. Handy Wind is large enough to carry everything in one go.
transport:SetRequiredCargos(AllCargo)
---
-- Transfer from Deploy zone zo Shore Bravo
---
-- Transport assignment.
local transfer2=OPSTRANSPORT:New(InfantrySet, zoneDeploy, zoneSurfB)
transfer2:SetDisembarkZone(zoneDisembark)
transfer2:SetRequiredCargos(InfantrySet)
transfer2:AddConditionStart(
function()
return (transport:IsDelivered() and transport:GetNcargoDelivered()>0)
end)
-- Assign transport to carrier.
SpeedboatSet:ForEach(
function(speedboat)
speedboat:AddOpsTransport(transfer1)
speedboat:AddOpsTransport(transfer2)
end)
-- Assign transport to carrier.
---
-- NAVAL: Transport Ship-to-Ship but ferry ships are transported as well.
--
-- A speed boat is used to transfer troops from the beach to the bigger transport ship.
-- The speed boat needs to go two times to deliver all troops.
--
-- Once the speed boat has finished its transport assignment, the Handy Wind will transport
-- the troops to another deploy zone.
---
-- Zones.
local zonePickup=ZONE:New("Zone Sea Alpha"):DrawZone()
local zoneDeploy=ZONE:New("Zone Sea Bravo"):DrawZone()
-- Surf zones near the shores. This is where the speed boats will go to pickup and deploy the infantry groops.
local zoneSurfA=ZONE:New("Zone Surf Alpha"):DrawZone()
local zoneSurfB=ZONE:New("Zone Surf Bravo"):DrawZone()
-- Embark and disembark zones for infantry.
local zoneEmbark=ZONE:New("Zone Shore Alpha"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Bravo"):DrawZone()
-- Carrier group.
local handywind=NAVYGROUP:New("Handy Wind")
handywind:Activate()
-- Infantry group set.
local InfantrySet=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Delta-1"):FilterOnce()
InfantrySet:Activate()
-- Speed boat group set.
local SpeedboatSet=SET_OPSGROUP:New():FilterPrefixes("Speed Boat Alpha"):FilterOnce()
SpeedboatSet:Activate()
-- All cargo groups of the main transport.
local AllCargo=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Delta-1"):FilterPrefixes("Speed Boat Alpha"):FilterOnce()
---
-- Transfer from Shore Alpha to Pickup zone
---
-- Transport assignment for Speedboat: Pickup Infantry and deliver to pick up zone of Handy wind.
local transfer1=OPSTRANSPORT:New(InfantrySet, zoneSurfA, zonePickup)
-- Set embark and disembark zone. These are the zones where the troops are supposed to be.
transfer1:SetEmbarkZone(zoneEmbark)
-- Direct disembark to Handy Wind.
transfer1:SetDisembarkCarriers(handywind)
--- Function called when all cargo groups have beed delivered.
function transfer1:OnAfterDelivered()
-- Ensure that all carriers are inside the pickup zone.
local carriers=transfer1:GetCarriers()
for _,_carrier in pairs(carriers) do
local carrier=_carrier --Ops.NavyGroup#NAVYGROUP
if not carrier:IsInZone(zonePickup) then
env.info("FF carrier not in pickup zone "..carrier:GetName())
carrier:AddWaypoint(zonePickup:GetRandomCoordinate())
end
end
end
---
-- Transport from Pickup to Deploy zone
---
-- Transport assignment.
local transport=OPSTRANSPORT:New(SpeedboatSet, zonePickup, zoneDeploy)
transport:AddCargoGroups(InfantrySet, nil, false)
transport:SetRequiredCargos(AllCargo)
---
-- Transfer from Deploy zone zo Shore Bravo
---
-- Transport assignment.
local transfer2=OPSTRANSPORT:New(InfantrySet, zoneDeploy, zoneSurfB)
transfer2:SetDisembarkZone(zoneDisembark)
transfer2:SetRequiredCargos(InfantrySet)
transfer2:AddConditionStart(
function()
return (transport:IsDelivered() and transport:GetNcargoDelivered()>0)
end)
-- Assign transport to carrier.
SpeedboatSet:ForEach(
function(speedboat)
speedboat:AddOpsTransport(transfer1)
speedboat:AddOpsTransport(transfer2)
end)
-- Assign transport to carrier.
handywind:AddOpsTransport(transport)

View File

@@ -1,52 +1,52 @@
---
-- NAVAL: Direct Load
--
-- The Seawise Giant is coming from far, far away and delivers cargo toops to an oil rig.
--
-- For lack of time, we do not want to simulate the whole transport process. So the cargo groups are placed
-- anywhere on the map and directly loaded into the Seawise, which is already close to its destination.
--
-- As ground troops cannot stand on oil rigs, the disembarkment happens "in utero", i.e. troops are not spawned.
-- But they could be picked up later by a helo, for instance, and be delivered to another destination.
---
-- Zones.
local zoneSeawise=ZONE_GROUP:New("Seawise", GROUP:FindByName("Seawise Giant"), 1000)
local zoneShell=ZONE:New("Zone Shell"):DrawZone()
-- Carrier group.
local seawise=NAVYGROUP:New("Seawise Giant")
seawise:Activate()
seawise:SetVerbosity(2)
-- Infantry cargo group.
local CargoGroup=SET_GROUP:New():FilterPrefixes("Infantry Platoon Delta"):FilterOnce()
CargoGroup:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroup, zoneSeawise, zoneShell)
transport:SetVerbosity(3)
transport:SetDisembarkInUtero()
-- Add transport assignment.
seawise:AddOpsTransport(transport)
-- Load all defined cargo.
for _,_opsgroup in pairs(transport:GetCargoOpsGroups(false)) do
seawise:__Load(30, _opsgroup)
end
--- Function called when carrier loaded all cargo.
function seawise:OnAfterLoaded(From, Event, To, OpsGroupCargo)
local opsgroup=OpsGroupCargo --Ops.OpsGroup#OPSGROUP
env.info(string.format("Loaded opsgroup %s", opsgroup:GetName()))
end
--- Function called when carrier unloaded a cargo group.
function seawise:OnAfterUnloaded(From, Event, To, OpsGroupCargo)
local opsgroup=OpsGroupCargo --Ops.OpsGroup#OPSGROUP
local text=string.format("Unloaded opsgroup %s", opsgroup:GetName())
env.info(text)
opsgroup:GetCoordinate():MarkToAll(text)
---
-- NAVAL: Direct Load
--
-- The Seawise Giant is coming from far, far away and delivers cargo toops to an oil rig.
--
-- For lack of time, we do not want to simulate the whole transport process. So the cargo groups are placed
-- anywhere on the map and directly loaded into the Seawise, which is already close to its destination.
--
-- As ground troops cannot stand on oil rigs, the disembarkment happens "in utero", i.e. troops are not spawned.
-- But they could be picked up later by a helo, for instance, and be delivered to another destination.
---
-- Zones.
local zoneSeawise=ZONE_GROUP:New("Seawise", GROUP:FindByName("Seawise Giant"), 1000)
local zoneShell=ZONE:New("Zone Shell"):DrawZone()
-- Carrier group.
local seawise=NAVYGROUP:New("Seawise Giant")
seawise:Activate()
seawise:SetVerbosity(2)
-- Infantry cargo group.
local CargoGroup=SET_GROUP:New():FilterPrefixes("Infantry Platoon Delta"):FilterOnce()
CargoGroup:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroup, zoneSeawise, zoneShell)
transport:SetVerbosity(3)
transport:SetDisembarkInUtero()
-- Add transport assignment.
seawise:AddOpsTransport(transport)
-- Load all defined cargo.
for _,_opsgroup in pairs(transport:GetCargoOpsGroups(false)) do
seawise:__Load(30, _opsgroup)
end
--- Function called when carrier loaded all cargo.
function seawise:OnAfterLoaded(From, Event, To, OpsGroupCargo)
local opsgroup=OpsGroupCargo --Ops.OpsGroup#OPSGROUP
env.info(string.format("Loaded opsgroup %s", opsgroup:GetName()))
end
--- Function called when carrier unloaded a cargo group.
function seawise:OnAfterUnloaded(From, Event, To, OpsGroupCargo)
local opsgroup=OpsGroupCargo --Ops.OpsGroup#OPSGROUP
local text=string.format("Unloaded opsgroup %s", opsgroup:GetName())
env.info(text)
opsgroup:GetCoordinate():MarkToAll(text)
end

View File

@@ -1,84 +1,84 @@
---
-- NAVAL: Amphibious Landing
--
-- LHA Tarawa has loaded amphibious APCs. These are transported to a surf zone and unloaded
-- into the water. From there they drive to the beach.
--
-- The APCs itself have infantry troops loaded. Once the APCs reach their waypoint at the beach,
-- they will unload the troops, which will then go on a patrol zone mission.
--
---
-- Zones.
local zoneTarawa=ZONE_GROUP:New("LHA-1 Tarawa", GROUP:FindByName("LHA-1 Tarawa"), 1000)
local zoneDeploy=ZONE:New("Zone Surf Bravo"):DrawZone()
local zoneBravo=ZONE:New("Zone Shore Bravo"):DrawZone()
-- USS Tarawa carrier.
local tarawa=NAVYGROUP:New("LHA-1 Tarawa")
tarawa:SetPatrolAdInfinitum(false)
tarawa:SetCarrierUnloaderBack(50, 40)
tarawa:Activate()
-- Tansport assignment. The cargo groups are added later when we spawn them.
local transport=OPSTRANSPORT:New(nil, zoneTarawa, zoneDeploy)
-- Assign transport to Tarawa.
tarawa:AddOpsTransport(transport)
-- Create a SPAWN object that will spawn late activated AAV-7, which are amphibious.
local spawnAPC=SPAWN:New("APC AAV-7 Alpha-1"):InitLateActivated(true)
-- Create a SPAWN object that will spawn late activated Infantry.
local spawnInf=SPAWN:New("Infantry M4 Template"):InitLateActivated(true)
-- Spawn 5 APCs, create ARMYGROUPs, add each as cargo and load directly into the Tarawa.
for i=1,5 do
-- Create ARMYGROUP from spawned APC, add as cargo and load directly into the Tarawa.
local apc=ARMYGROUP:New(spawnAPC:Spawn())
transport:AddCargoGroups(apc)
tarawa:Load(apc)
-- Create ARMYGROUP from spawned APC and load directly into the APC.
local infgroup=ARMYGROUP:New(spawnInf:Spawn())
apc:Load(infgroup)
end
-- Mission to patrol zone bravo.
local mission=AUFTRAG:NewPATROLZONE(zoneBravo)
--- Function called when a cargo group is unloaded from a carrier.
function transport:OnAfterUnloaded(From, Event, To, OpsGroupCargo, OpsGroupCarrier)
local apc=OpsGroupCargo --Ops.ArmyGroup#ARMYGROUP
-- Add random waypoint in zone Bravo.
local wp1=apc:AddWaypoint(zoneBravo:GetRandomCoordinate())
-- Give cruise command.
apc:__Cruise(5)
--- Function called when the group passed a waypoint.
function apc:OnAfterPassingWaypoint(From, Event, To, Waypoint)
local waypoint=Waypoint --Ops.OpsGroup#OPSGROUP.Waypoint
if waypoint.uid==wp1.uid then
-- Get all cargo groups.
local cargos=apc:GetCargoOpsGroups()
for _,_infantrygroup in pairs(cargos) do
local infantrygroup=_infantrygroup --Ops.ArmyGroup#ARMYGROUP
-- Unload infantry near the carrier
local Coordinate=apc:GetCoordinate():Translate(math.random(50, 100), math.random(0,360))
apc:Unload(infantrygroup, Coordinate, true)
-- Assign patrol mission to infantry group.
infantrygroup:AddMission(mission)
end
end
end
---
-- NAVAL: Amphibious Landing
--
-- LHA Tarawa has loaded amphibious APCs. These are transported to a surf zone and unloaded
-- into the water. From there they drive to the beach.
--
-- The APCs itself have infantry troops loaded. Once the APCs reach their waypoint at the beach,
-- they will unload the troops, which will then go on a patrol zone mission.
--
---
-- Zones.
local zoneTarawa=ZONE_GROUP:New("LHA-1 Tarawa", GROUP:FindByName("LHA-1 Tarawa"), 1000)
local zoneDeploy=ZONE:New("Zone Surf Bravo"):DrawZone()
local zoneBravo=ZONE:New("Zone Shore Bravo"):DrawZone()
-- USS Tarawa carrier.
local tarawa=NAVYGROUP:New("LHA-1 Tarawa")
tarawa:SetPatrolAdInfinitum(false)
tarawa:SetCarrierUnloaderBack(50, 40)
tarawa:Activate()
-- Tansport assignment. The cargo groups are added later when we spawn them.
local transport=OPSTRANSPORT:New(nil, zoneTarawa, zoneDeploy)
-- Assign transport to Tarawa.
tarawa:AddOpsTransport(transport)
-- Create a SPAWN object that will spawn late activated AAV-7, which are amphibious.
local spawnAPC=SPAWN:New("APC AAV-7 Alpha-1"):InitLateActivated(true)
-- Create a SPAWN object that will spawn late activated Infantry.
local spawnInf=SPAWN:New("Infantry M4 Template"):InitLateActivated(true)
-- Spawn 5 APCs, create ARMYGROUPs, add each as cargo and load directly into the Tarawa.
for i=1,5 do
-- Create ARMYGROUP from spawned APC, add as cargo and load directly into the Tarawa.
local apc=ARMYGROUP:New(spawnAPC:Spawn())
transport:AddCargoGroups(apc)
tarawa:Load(apc)
-- Create ARMYGROUP from spawned APC and load directly into the APC.
local infgroup=ARMYGROUP:New(spawnInf:Spawn())
apc:Load(infgroup)
end
-- Mission to patrol zone bravo.
local mission=AUFTRAG:NewPATROLZONE(zoneBravo)
--- Function called when a cargo group is unloaded from a carrier.
function transport:OnAfterUnloaded(From, Event, To, OpsGroupCargo, OpsGroupCarrier)
local apc=OpsGroupCargo --Ops.ArmyGroup#ARMYGROUP
-- Add random waypoint in zone Bravo.
local wp1=apc:AddWaypoint(zoneBravo:GetRandomCoordinate())
-- Give cruise command.
apc:__Cruise(5)
--- Function called when the group passed a waypoint.
function apc:OnAfterPassingWaypoint(From, Event, To, Waypoint)
local waypoint=Waypoint --Ops.OpsGroup#OPSGROUP.Waypoint
if waypoint.uid==wp1.uid then
-- Get all cargo groups.
local cargos=apc:GetCargoOpsGroups()
for _,_infantrygroup in pairs(cargos) do
local infantrygroup=_infantrygroup --Ops.ArmyGroup#ARMYGROUP
-- Unload infantry near the carrier
local Coordinate=apc:GetCoordinate():Translate(math.random(50, 100), math.random(0,360))
apc:Unload(infantrygroup, Coordinate, true)
-- Assign patrol mission to infantry group.
infantrygroup:AddMission(mission)
end
end
end
end

View File

@@ -1,90 +1,90 @@
---
-- NAVAL: A Spy named Pikey
--
-- A submarine is used to transport a spy, callsign Pikey, to a strategically important bridge.
-- Pikey's assigment is to place 100 kg TNT at the bridge to destroy it.
--
-- Pikey will be picked up by the sub and dropped off near the bridge.
--
-- As Pikey is a nice guy, we won't leave him behind (which was the initial plan). The sub will
-- wait until he returns and bring him back to safe ground.
---
-- Zones.
local zonePickup=ZONE:New("Zone Surf Bravo"):DrawZone()
local zoneDeploy=ZONE:New("Zone Surf Spy"):DrawZone()
local zoneEmbark=ZONE:New("Zone Shore Bravo"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Spy"):DrawZone()
local zoneBridge=ZONE:New("Ludendorff Bridge"):DrawZone()
-- Carrier group.
local uboot=NAVYGROUP:New("U-93")
uboot:SetPatrolAdInfinitum(false)
uboot:SetDefaultAltitude(-30)
uboot:Activate()
-- Infantry cargo group.
local pikey=ARMYGROUP:New("Spy")
-- Transport assignment to bring Pikey to the deploy zone near the bridge.
local transport1=OPSTRANSPORT:New(pikey, zonePickup, zoneDeploy)
-- Set embark zone. This is the zone where the spy needs to be for loading.
transport1:SetEmbarkZone(zoneEmbark)
-- Set disembark zone. This is the zone, where Pikey will by spawned.
transport1:SetDisembarkZone(zoneDisembark)
-- Transport assignment to bring Pikey back. Pickup/deploy and embark/disembark zones are switched wrt to the first transport.
local transport2=OPSTRANSPORT:New(nil, zoneDeploy, zonePickup)
transport2:SetEmbarkZone(zoneDisembark)
transport2:SetDisembarkZone(zoneEmbark)
-- Assign transports to carrier.
uboot:AddOpsTransport(transport1)
uboot:AddOpsTransport(transport2)
--- Function called when transport was delivered.
function uboot:OnAfterDelivered(From, Event, To, Transport)
local transport=Transport --Ops.OpsTransport#OPSTRANSPORT
env.info("Transport delivered UID="..tostring(transport.uid))
if transport.uid==transport1.uid then
-- U-boot will stop once Pikey was delivered to the deploy zone. We need to delay the call a bit for this to work as internal functions would make the sub go back.
uboot:__FullStop(1)
end
end
--- Function called when the spy is disembarked from the carrier.
function pikey:OnAfterDisembarked()
if pikey:IsInZone(zoneDisembark) then
-- Debug info.
env.info("Pikey disembarked near the bridge!")
-- Coordinate of the bridge.
local CoordBridge=zoneBridge:GetCoordinate()
local CoordDisembark=zoneDisembark:GetCoordinate()
-- Add waypoints.
local wpBridge=pikey:AddWaypoint(CoordBridge, UTILS.KmphToKnots(pikey.speedMax), nil, ENUMS.Formation.Vehicle.OnRoad, false)
local wpEmbark=pikey:AddWaypoint(CoordDisembark, UTILS.KmphToKnots(pikey.speedMax), wpBridge.uid, ENUMS.Formation.Vehicle.OnRoad, false)
-- Give the cruise command in 10 seconds.
pikey:__Cruise(10)
--- Function called when the Spy passes a waypoint.
function pikey:OnAfterPassingWaypoint(From, Event, To, Waypoint)
local wp=Waypoint --Ops.OpsGroup#OPSGROUP.Waypoint
if wp.uid==wpBridge.uid then
-- Pikey has reached the bridge and place TNT.
CoordBridge:SetAltitude(20, true):Explosion(1000, 360)
elseif wp.uid==wpEmbark.uid then
-- Once Pikey finished his mission, he is added as cargo.
transport2:AddCargoGroups(pikey)
end
end
end
---
-- NAVAL: A Spy named Pikey
--
-- A submarine is used to transport a spy, callsign Pikey, to a strategically important bridge.
-- Pikey's assigment is to place 100 kg TNT at the bridge to destroy it.
--
-- Pikey will be picked up by the sub and dropped off near the bridge.
--
-- As Pikey is a nice guy, we won't leave him behind (which was the initial plan). The sub will
-- wait until he returns and bring him back to safe ground.
---
-- Zones.
local zonePickup=ZONE:New("Zone Surf Bravo"):DrawZone()
local zoneDeploy=ZONE:New("Zone Surf Spy"):DrawZone()
local zoneEmbark=ZONE:New("Zone Shore Bravo"):DrawZone()
local zoneDisembark=ZONE:New("Zone Shore Spy"):DrawZone()
local zoneBridge=ZONE:New("Ludendorff Bridge"):DrawZone()
-- Carrier group.
local uboot=NAVYGROUP:New("U-93")
uboot:SetPatrolAdInfinitum(false)
uboot:SetDefaultAltitude(-30)
uboot:Activate()
-- Infantry cargo group.
local pikey=ARMYGROUP:New("Spy")
-- Transport assignment to bring Pikey to the deploy zone near the bridge.
local transport1=OPSTRANSPORT:New(pikey, zonePickup, zoneDeploy)
-- Set embark zone. This is the zone where the spy needs to be for loading.
transport1:SetEmbarkZone(zoneEmbark)
-- Set disembark zone. This is the zone, where Pikey will by spawned.
transport1:SetDisembarkZone(zoneDisembark)
-- Transport assignment to bring Pikey back. Pickup/deploy and embark/disembark zones are switched wrt to the first transport.
local transport2=OPSTRANSPORT:New(nil, zoneDeploy, zonePickup)
transport2:SetEmbarkZone(zoneDisembark)
transport2:SetDisembarkZone(zoneEmbark)
-- Assign transports to carrier.
uboot:AddOpsTransport(transport1)
uboot:AddOpsTransport(transport2)
--- Function called when transport was delivered.
function uboot:OnAfterDelivered(From, Event, To, Transport)
local transport=Transport --Ops.OpsTransport#OPSTRANSPORT
env.info("Transport delivered UID="..tostring(transport.uid))
if transport.uid==transport1.uid then
-- U-boot will stop once Pikey was delivered to the deploy zone. We need to delay the call a bit for this to work as internal functions would make the sub go back.
uboot:__FullStop(1)
end
end
--- Function called when the spy is disembarked from the carrier.
function pikey:OnAfterDisembarked()
if pikey:IsInZone(zoneDisembark) then
-- Debug info.
env.info("Pikey disembarked near the bridge!")
-- Coordinate of the bridge.
local CoordBridge=zoneBridge:GetCoordinate()
local CoordDisembark=zoneDisembark:GetCoordinate()
-- Add waypoints.
local wpBridge=pikey:AddWaypoint(CoordBridge, UTILS.KmphToKnots(pikey.speedMax), nil, ENUMS.Formation.Vehicle.OnRoad, false)
local wpEmbark=pikey:AddWaypoint(CoordDisembark, UTILS.KmphToKnots(pikey.speedMax), wpBridge.uid, ENUMS.Formation.Vehicle.OnRoad, false)
-- Give the cruise command in 10 seconds.
pikey:__Cruise(10)
--- Function called when the Spy passes a waypoint.
function pikey:OnAfterPassingWaypoint(From, Event, To, Waypoint)
local wp=Waypoint --Ops.OpsGroup#OPSGROUP.Waypoint
if wp.uid==wpBridge.uid then
-- Pikey has reached the bridge and place TNT.
CoordBridge:SetAltitude(20, true):Explosion(1000, 360)
elseif wp.uid==wpEmbark.uid then
-- Once Pikey finished his mission, he is added as cargo.
transport2:AddCargoGroups(pikey)
end
end
end
end

View File

@@ -1,45 +1,45 @@
---
-- COMBINED FORCES: Helo Pickup from Ship
--
-- Seawise Giant has infantry loaded. A Mi-8 is assigned to pickup the troops
-- and transport them to a nearby oil rig.
--
-- When unloaded, the troops are spawned in late activated state because they
-- cannot stand on the oil rig. They could be picked up later by another transport.
---
-- Zones.
local zoneSeawise=ZONE_AIRBASE:New("Seawise Giant")
local zoneRigShell=ZONE_AIRBASE:New("Oil Rig Shell")
-- Mi-8 carrier group.
local mi8shell=FLIGHTGROUP:New("Mi-8 Shell")
mi8shell:Activate()
-- Seawise carrier group.
local seawise=NAVYGROUP:New("Seawise Giant")
-- Infantry cargo group.
local CargoGroupSet=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Delta"):FilterOnce()
CargoGroupSet:Activate()
-- Load all groups into the Seawise Giant
CargoGroupSet:ForEach(function(opsgroup)
seawise:__Load(5, opsgroup)
end )
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroupSet, zoneSeawise, zoneRigShell)
-- When disembared, the groups remain inactive since ground groups cannot "stand" on an oil rig. They would fall into the water.
transport:SetDisembarkActivation(false)
-- Add transport assignment.
mi8shell:AddOpsTransport(transport)
--- Function called when a group has been unloaded.
function transport:OnAfterUnloaded(From, Event, To, OpsGroupCargo, OpsGroupCarrier)
local opsgroup=OpsGroupCargo --Ops.OpsGroup#OPSGROUP
opsgroup:GetCoordinate():MarkToAll(string.format("Unloaded group %s", opsgroup:GetName()))
---
-- COMBINED FORCES: Helo Pickup from Ship
--
-- Seawise Giant has infantry loaded. A Mi-8 is assigned to pickup the troops
-- and transport them to a nearby oil rig.
--
-- When unloaded, the troops are spawned in late activated state because they
-- cannot stand on the oil rig. They could be picked up later by another transport.
---
-- Zones.
local zoneSeawise=ZONE_AIRBASE:New("Seawise Giant")
local zoneRigShell=ZONE_AIRBASE:New("Oil Rig Shell")
-- Mi-8 carrier group.
local mi8shell=FLIGHTGROUP:New("Mi-8 Shell")
mi8shell:Activate()
-- Seawise carrier group.
local seawise=NAVYGROUP:New("Seawise Giant")
-- Infantry cargo group.
local CargoGroupSet=SET_OPSGROUP:New():FilterPrefixes("Infantry Platoon Delta"):FilterOnce()
CargoGroupSet:Activate()
-- Load all groups into the Seawise Giant
CargoGroupSet:ForEach(function(opsgroup)
seawise:__Load(5, opsgroup)
end )
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoGroupSet, zoneSeawise, zoneRigShell)
-- When disembared, the groups remain inactive since ground groups cannot "stand" on an oil rig. They would fall into the water.
transport:SetDisembarkActivation(false)
-- Add transport assignment.
mi8shell:AddOpsTransport(transport)
--- Function called when a group has been unloaded.
function transport:OnAfterUnloaded(From, Event, To, OpsGroupCargo, OpsGroupCarrier)
local opsgroup=OpsGroupCargo --Ops.OpsGroup#OPSGROUP
opsgroup:GetCoordinate():MarkToAll(string.format("Unloaded group %s", opsgroup:GetName()))
end

View File

@@ -1,60 +1,60 @@
---
-- COMBINED FORCES: By All Means
--
-- A large amount of troops need to be transported from Novorossiysk to Gelendzhik.
-- The cargo includes a T-90 tank, two Akatsia Howitzas, several UAZ-469 trucks and infantry.
--
-- We use an An-30 plane, a Mi-26 helicopter, a BTR-90 APC and to carry out the
-- transport as quickly as possibe.
---
-- Zones.
local zonePickup=ZONE_AIRBASE:New(AIRBASE.Caucasus.Novorossiysk, 3000):DrawZone()
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gelendzhik, 3000):DrawZone()
local zoneDisembark=ZONE:New("Zone Gelendzhik Disembark"):DrawZone()
-- Define Cargo.
local CargoSet=SET_OPSGROUP:New()
CargoSet:FilterPrefixes("Infantry AK-74 Alpha"):FilterPrefixes("Infantry AK-74 Bravo")
CargoSet:FilterPrefixes("UAZ-469 Alpha"):FilterPrefixes("UAZ-469 Bravo")
CargoSet:FilterPrefixes("T-90 Bravo")
CargoSet:FilterPrefixes("Akatsia Bravo")
CargoSet:FilterOnce()
CargoSet:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoSet, zonePickup, zoneDeploy)
-- Set disembark zone.
transport:SetDisembarkZone(zoneDisembark)
-- Add a transport path for ground carriers. Waypoints are taken from the late activated template group.
transport:AddPathTransport(GROUP:FindByName("Path Novorossiysk-Gelendzhik Ground"))
-- Add a transport path for naval carriers. Waypoints are taken from the late activated template group.
transport:AddPathTransport(GROUP:FindByName("Path Novorossiysk-Gelendzhik Naval"))
-- Add a transport path for airplane carriers. Waypoints are taken from the late activated template group.
transport:AddPathTransport(GROUP:FindByName("Path Novorossiysk-Gelendzhik Airplane"))
-- Carrier airplane.
local An30=FLIGHTGROUP:New("An-30M Alpha-1")
An30:Activate()
-- Carrier ground.
local BTR80=ARMYGROUP:New("BTR-Alpha-1")
BTR80:Activate()
-- Carrier helicopter.
local Mi26=FLIGHTGROUP:New("Mi-26 Alpha-1")
Mi26:Activate()
-- Carrier ship.
local Ivanov=NAVYGROUP:New("Cargo Ivanov")
Ivanov:Activate()
-- Assign transport to carriers.
An30:AddOpsTransport(transport)
Mi26:AddOpsTransport(transport)
BTR80:AddOpsTransport(transport)
---
-- COMBINED FORCES: By All Means
--
-- A large amount of troops need to be transported from Novorossiysk to Gelendzhik.
-- The cargo includes a T-90 tank, two Akatsia Howitzas, several UAZ-469 trucks and infantry.
--
-- We use an An-30 plane, a Mi-26 helicopter, a BTR-90 APC and to carry out the
-- transport as quickly as possibe.
---
-- Zones.
local zonePickup=ZONE_AIRBASE:New(AIRBASE.Caucasus.Novorossiysk, 3000):DrawZone()
local zoneDeploy=ZONE_AIRBASE:New(AIRBASE.Caucasus.Gelendzhik, 3000):DrawZone()
local zoneDisembark=ZONE:New("Zone Gelendzhik Disembark"):DrawZone()
-- Define Cargo.
local CargoSet=SET_OPSGROUP:New()
CargoSet:FilterPrefixes("Infantry AK-74 Alpha"):FilterPrefixes("Infantry AK-74 Bravo")
CargoSet:FilterPrefixes("UAZ-469 Alpha"):FilterPrefixes("UAZ-469 Bravo")
CargoSet:FilterPrefixes("T-90 Bravo")
CargoSet:FilterPrefixes("Akatsia Bravo")
CargoSet:FilterOnce()
CargoSet:Activate()
-- Transport assignment.
local transport=OPSTRANSPORT:New(CargoSet, zonePickup, zoneDeploy)
-- Set disembark zone.
transport:SetDisembarkZone(zoneDisembark)
-- Add a transport path for ground carriers. Waypoints are taken from the late activated template group.
transport:AddPathTransport(GROUP:FindByName("Path Novorossiysk-Gelendzhik Ground"))
-- Add a transport path for naval carriers. Waypoints are taken from the late activated template group.
transport:AddPathTransport(GROUP:FindByName("Path Novorossiysk-Gelendzhik Naval"))
-- Add a transport path for airplane carriers. Waypoints are taken from the late activated template group.
transport:AddPathTransport(GROUP:FindByName("Path Novorossiysk-Gelendzhik Airplane"))
-- Carrier airplane.
local An30=FLIGHTGROUP:New("An-30M Alpha-1")
An30:Activate()
-- Carrier ground.
local BTR80=ARMYGROUP:New("BTR-Alpha-1")
BTR80:Activate()
-- Carrier helicopter.
local Mi26=FLIGHTGROUP:New("Mi-26 Alpha-1")
Mi26:Activate()
-- Carrier ship.
local Ivanov=NAVYGROUP:New("Cargo Ivanov")
Ivanov:Activate()
-- Assign transport to carriers.
An30:AddOpsTransport(transport)
Mi26:AddOpsTransport(transport)
BTR80:AddOpsTransport(transport)
Ivanov:AddOpsTransport(transport)

View File

@@ -1,44 +1,44 @@
---
-- TPZ: Ground
--
-- A BTR-80 is assigned to transport infantry troops.
-- The troops are supposed to be picked up in two different areas.
--
-- To this end, we use "Transport Zone Combos" (TZC), which allow to
-- specify different pickup and/or deploy zones within the transport assignment.
---
-- Pickup and deploy zones.
local zonePickupAlpha=ZONE:New("Zone Novorossiysk Alpha"):DrawZone()
local zonePickupBravo=ZONE:New("Zone Novorossiysk Bravo"):DrawZone()
local zoneDeploy=ZONE:New("Zone Delta"):DrawZone()
-- Carrier.
local carrier1=ARMYGROUP:New("BTR-Alpha-1")
carrier1:Activate()
-- Set of groups to transport.
local infantrysetAlpha=SET_OPSGROUP:New():FilterPrefixes("Infantry AK-74 Alpha"):FilterOnce()
infantrysetAlpha:Activate()
-- Set of groups to transport.
local infantrysetBravo=SET_OPSGROUP:New():FilterPrefixes("Infantry AK-74 Bravo"):FilterOnce()
infantrysetBravo:Activate()
-- Cargo transport assignment to transport troops from pickup Alpha to the deploy zone.
local opstransport=OPSTRANSPORT:New(infantrysetAlpha, zonePickupAlpha, zoneDeploy)
-- Add a Transport Zone Combo (TZC) to transport troops from pickup zone Bravo.
local tpz1=opstransport:AddTransportZoneCombo(infantrysetBravo, zonePickupBravo, zoneDeploy)
-- Assign transport to carrier.
carrier1:AddOpsTransport(opstransport)
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
---
-- TPZ: Ground
--
-- A BTR-80 is assigned to transport infantry troops.
-- The troops are supposed to be picked up in two different areas.
--
-- To this end, we use "Transport Zone Combos" (TZC), which allow to
-- specify different pickup and/or deploy zones within the transport assignment.
---
-- Pickup and deploy zones.
local zonePickupAlpha=ZONE:New("Zone Novorossiysk Alpha"):DrawZone()
local zonePickupBravo=ZONE:New("Zone Novorossiysk Bravo"):DrawZone()
local zoneDeploy=ZONE:New("Zone Delta"):DrawZone()
-- Carrier.
local carrier1=ARMYGROUP:New("BTR-Alpha-1")
carrier1:Activate()
-- Set of groups to transport.
local infantrysetAlpha=SET_OPSGROUP:New():FilterPrefixes("Infantry AK-74 Alpha"):FilterOnce()
infantrysetAlpha:Activate()
-- Set of groups to transport.
local infantrysetBravo=SET_OPSGROUP:New():FilterPrefixes("Infantry AK-74 Bravo"):FilterOnce()
infantrysetBravo:Activate()
-- Cargo transport assignment to transport troops from pickup Alpha to the deploy zone.
local opstransport=OPSTRANSPORT:New(infantrysetAlpha, zonePickupAlpha, zoneDeploy)
-- Add a Transport Zone Combo (TZC) to transport troops from pickup zone Bravo.
local tpz1=opstransport:AddTransportZoneCombo(infantrysetBravo, zonePickupBravo, zoneDeploy)
-- Assign transport to carrier.
carrier1:AddOpsTransport(opstransport)
--- Function called when transport was delivered or everyone (remaining) is dead.
function opstransport:OnAfterDelivered(From, Event, To)
local text=string.format("Transport UID=%d was delivered. Ncargo=%d Ndelivered=%d", opstransport:GetUID(), opstransport:GetNcargoTotal(), opstransport:GetNcargoDelivered())
MESSAGE:New(text, 60):ToAll()
env.info(text)
end

View File

@@ -1,131 +1,131 @@
---
-- The Seawise Giant has loaded troops from far away.
-- Six infantry groups need to be transported across the Mariana Islands.
--
-- In the first step, Speed boats pick up the troops from the Seawise Giant
-- and transport them to the harbour near Piti on Guam.
--
-- A UH-60A is then taking off from Antonio B. Won Pat Intl. Airport to pick them
-- up and bring them to Andersen Airbase.
--
-- At Andersen there is a C-130 Hercules waiting to further transport the troops
-- to Saipan Intl. Airport.
--
-- Once arrived at Saipan, the troops are added to the local warehouse.
--
-- Zones.
local zoneSeawise=ZONE_UNIT:New("Seawise", UNIT:FindByName("Seawise Giant"), 300)
local zoneDeepWater=ZONE:New("Zone Deep Water"):DrawZone()
local zoneHarbourAlpha=ZONE:New("Zone Harbour Alpha"):DrawZone()
local zonePort=ZONE:New("Zone Port"):DrawZone()
local zoneAndersen=ZONE_AIRBASE:New(AIRBASE.MarianaIslands.Andersen_AFB)
local zoneSaipan=ZONE_AIRBASE:New(AIRBASE.MarianaIslands.Saipan_Intl)
-- Cargo group set.
local cargo=SET_OPSGROUP:New()
-- Spawn some infantry groups in late activated state.
local spawnInfantry=SPAWN:New("Infantry Platoon"):InitLateActivated(true)
for i=1,6 do
local group=spawnInfantry:SpawnInZone(zoneSeawise)
cargo:AddGroup(group)
end
-- Warehouse Saipan
local warehauseSaipan=WAREHOUSE:New("Warehouse Saipan")
warehauseSaipan:Start()
---
-- Seawise transporting cargo from distant lands near to Guam.
---
-- Seawise Giant carrier.
local seawise=NAVYGROUP:New("Seawise Giant")
seawise:Activate()
-- Transport troops to a zone near Guam.
local transportSeawise=OPSTRANSPORT:New(cargo, zoneSeawise, zoneDeepWater)
transportSeawise:SetDisembarkCarriers(SET_GROUP:New():FilterPrefixes("Speed Boat"):FilterOnce())
-- Add transport to Seawise.
seawise:AddOpsTransport(transportSeawise)
-- Load all defined cargo directly.
for _,_opsgroup in pairs(transportSeawise:GetCargoOpsGroups(false)) do
seawise:Load(_opsgroup)
end
---
-- Speed boats transporting infantry from Seawise to the port.
---
-- Speed boats.
local speedboat1=NAVYGROUP:New("Speed Boat-1")
--speedboat1:SetPathfindingOff()
speedboat1:Activate()
-- Assignment to transport the troops from the Seawise to the harbour near Piti, Guam.
local transportSpeedboat=OPSTRANSPORT:New(cargo, zoneDeepWater, zoneHarbourAlpha)
-- We add a transport path so that the boats do not get stuck at the harbour entry.
transportSpeedboat:AddPathTransport(GROUP:FindByName("Path Alpha"))
-- Troops are disembarked on the peninsula, where the helo can land.
transportSpeedboat:SetDisembarkZone(zonePort)
-- Add transport assignment to speed boat group.
speedboat1:AddOpsTransport(transportSpeedboat)
---
-- UH-60A transports infantry from port zone to Andersen AFB
---
-- Helo carrier.
local uh60a=FLIGHTGROUP:New("UH-60A-1")
uh60a:Activate()
-- Transport assignment to pickup the troops at Piti harbour and bring them to Andersen Airbase.
local transportUH60A=OPSTRANSPORT:New(cargo, zonePort, zoneAndersen)
-- Transport is started once the speed boats have delivered the cargo.
transportUH60A:AddConditionStart(function()
return transportSpeedboat:IsDelivered()
end)
-- Add transport assignment.
uh60a:AddOpsTransport(transportUH60A)
---
-- C-130 transports infantry from Andersen AFB to Saipan Intl
---
-- Hercules carrier.
local c130=FLIGHTGROUP:New("C-130")
c130:Activate()
-- Define transport from Andersen AFB to Saipan Intl.
local transportC130=OPSTRANSPORT:New(cargo, zoneAndersen, zoneSaipan)
transportC130:AddConditionStart(function()
return transportUH60A:IsDelivered()
end)
-- Assign transport to C130.
c130:AddOpsTransport(transportC130)
--- When the cargo is delivered, it is added to the warehouse.
function transportC130:OnAfterDelivered(From,Event,To)
-- Get all DELIVERED ops groups.
local opsgroups=transportC130:GetCargoOpsGroups(true)
-- Add all groups to Warehouse for further tasking.
for _,_opsgroup in pairs(opsgroups) do
local opsgroup=_opsgroup --Ops.OpsGroup#OPSGROUP
local group=opsgroup:GetGroup()
warehauseSaipan:AddAsset(group)
end
---
-- The Seawise Giant has loaded troops from far away.
-- Six infantry groups need to be transported across the Mariana Islands.
--
-- In the first step, Speed boats pick up the troops from the Seawise Giant
-- and transport them to the harbour near Piti on Guam.
--
-- A UH-60A is then taking off from Antonio B. Won Pat Intl. Airport to pick them
-- up and bring them to Andersen Airbase.
--
-- At Andersen there is a C-130 Hercules waiting to further transport the troops
-- to Saipan Intl. Airport.
--
-- Once arrived at Saipan, the troops are added to the local warehouse.
--
-- Zones.
local zoneSeawise=ZONE_UNIT:New("Seawise", UNIT:FindByName("Seawise Giant"), 300)
local zoneDeepWater=ZONE:New("Zone Deep Water"):DrawZone()
local zoneHarbourAlpha=ZONE:New("Zone Harbour Alpha"):DrawZone()
local zonePort=ZONE:New("Zone Port"):DrawZone()
local zoneAndersen=ZONE_AIRBASE:New(AIRBASE.MarianaIslands.Andersen_AFB)
local zoneSaipan=ZONE_AIRBASE:New(AIRBASE.MarianaIslands.Saipan_Intl)
-- Cargo group set.
local cargo=SET_OPSGROUP:New()
-- Spawn some infantry groups in late activated state.
local spawnInfantry=SPAWN:New("Infantry Platoon"):InitLateActivated(true)
for i=1,6 do
local group=spawnInfantry:SpawnInZone(zoneSeawise)
cargo:AddGroup(group)
end
-- Warehouse Saipan
local warehauseSaipan=WAREHOUSE:New("Warehouse Saipan")
warehauseSaipan:Start()
---
-- Seawise transporting cargo from distant lands near to Guam.
---
-- Seawise Giant carrier.
local seawise=NAVYGROUP:New("Seawise Giant")
seawise:Activate()
-- Transport troops to a zone near Guam.
local transportSeawise=OPSTRANSPORT:New(cargo, zoneSeawise, zoneDeepWater)
transportSeawise:SetDisembarkCarriers(SET_GROUP:New():FilterPrefixes("Speed Boat"):FilterOnce())
-- Add transport to Seawise.
seawise:AddOpsTransport(transportSeawise)
-- Load all defined cargo directly.
for _,_opsgroup in pairs(transportSeawise:GetCargoOpsGroups(false)) do
seawise:Load(_opsgroup)
end
---
-- Speed boats transporting infantry from Seawise to the port.
---
-- Speed boats.
local speedboat1=NAVYGROUP:New("Speed Boat-1")
--speedboat1:SetPathfindingOff()
speedboat1:Activate()
-- Assignment to transport the troops from the Seawise to the harbour near Piti, Guam.
local transportSpeedboat=OPSTRANSPORT:New(cargo, zoneDeepWater, zoneHarbourAlpha)
-- We add a transport path so that the boats do not get stuck at the harbour entry.
transportSpeedboat:AddPathTransport(GROUP:FindByName("Path Alpha"))
-- Troops are disembarked on the peninsula, where the helo can land.
transportSpeedboat:SetDisembarkZone(zonePort)
-- Add transport assignment to speed boat group.
speedboat1:AddOpsTransport(transportSpeedboat)
---
-- UH-60A transports infantry from port zone to Andersen AFB
---
-- Helo carrier.
local uh60a=FLIGHTGROUP:New("UH-60A-1")
uh60a:Activate()
-- Transport assignment to pickup the troops at Piti harbour and bring them to Andersen Airbase.
local transportUH60A=OPSTRANSPORT:New(cargo, zonePort, zoneAndersen)
-- Transport is started once the speed boats have delivered the cargo.
transportUH60A:AddConditionStart(function()
return transportSpeedboat:IsDelivered()
end)
-- Add transport assignment.
uh60a:AddOpsTransport(transportUH60A)
---
-- C-130 transports infantry from Andersen AFB to Saipan Intl
---
-- Hercules carrier.
local c130=FLIGHTGROUP:New("C-130")
c130:Activate()
-- Define transport from Andersen AFB to Saipan Intl.
local transportC130=OPSTRANSPORT:New(cargo, zoneAndersen, zoneSaipan)
transportC130:AddConditionStart(function()
return transportUH60A:IsDelivered()
end)
-- Assign transport to C130.
c130:AddOpsTransport(transportC130)
--- When the cargo is delivered, it is added to the warehouse.
function transportC130:OnAfterDelivered(From,Event,To)
-- Get all DELIVERED ops groups.
local opsgroups=transportC130:GetCargoOpsGroups(true)
-- Add all groups to Warehouse for further tasking.
for _,_opsgroup in pairs(opsgroups) do
local opsgroup=_opsgroup --Ops.OpsGroup#OPSGROUP
local group=opsgroup:GetGroup()
warehauseSaipan:AddAsset(group)
end
end