mirror of
https://github.com/FlightControl-Master/MOOSE_Demos.git
synced 2025-08-15 10:37:47 +00:00
Updated Moose.lua
This commit is contained in:
parent
37709df11d
commit
6ee157d018
@ -1,46 +1,46 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 22.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Beacon.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This test mission demonstrates the BEACON class.
|
||||
-- The goal is to activate 2 types of beacons:
|
||||
-- - One TACAN beacon attach to an aircraft.
|
||||
-- - And one generic radio beacon attach to a ground UNIT (ADF).
|
||||
--
|
||||
-- The player aircraft needs to be ASM and TACAN compatible.
|
||||
-- Please replace the A-10CII by an aircraft you own and that is able receive TACAN signals.
|
||||
--
|
||||
-- Please note that we added the Morse.ogg file with a SOUND TO COUNTRY action and the first MISSION START trigger.
|
||||
-- Because there is no unit from Bulgaria in the mission, nobody will hear the sound. But ths way the file is part of
|
||||
-- the mission file and we can use it with MOOSE.
|
||||
|
||||
-- # Guide:
|
||||
-- 1. Enter A-10CII.
|
||||
-- 2. Tune in 252 on UHF radio. You will hear the morse code.
|
||||
-- 2. Switch UHF mode to ADF
|
||||
-- 3. Needle 1 will move to ~ 150° on HSI.
|
||||
-- 4. Switch back to BOTH and frequency 252 to avoid the beacon sound.
|
||||
-- 5. Set TACAN to A/A REC and channel to 4Y.
|
||||
-- 6. On NMSP activate TCN.
|
||||
-- 7. HSI should point to the moving aircraft.
|
||||
|
||||
-- Create our UNIT objects on which we'll attach a BEACON.
|
||||
local Aircraft = UNIT:FindByName("Unit1")
|
||||
local LandUnit = UNIT:FindByName("Unit2")
|
||||
|
||||
-- Now, let's start with the TACAN Beacon.
|
||||
-- This particular TACAN can be homed on.
|
||||
local BeaconAircraft = Aircraft:GetBeacon()
|
||||
BeaconAircraft:ActivateTACAN(4, "Y", "UNIT1", true)
|
||||
|
||||
-- And let's setup the ground based radio beacon (ADF).
|
||||
-- Notice how this beacon will stop in 320 sec (last parameter).
|
||||
local BeaconLand = LandUnit:GetBeacon()
|
||||
BeaconLand:RadioBeacon("Morse.ogg", 252, radio.modulation.AM, 100, 320) -- File, frequency, modulation, power, timeout
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 22.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Beacon.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This test mission demonstrates the BEACON class.
|
||||
-- The goal is to activate 2 types of beacons:
|
||||
-- - One TACAN beacon attach to an aircraft.
|
||||
-- - And one generic radio beacon attach to a ground UNIT (ADF).
|
||||
--
|
||||
-- The player aircraft needs to be ASM and TACAN compatible.
|
||||
-- Please replace the A-10CII by an aircraft you own and that is able receive TACAN signals.
|
||||
--
|
||||
-- Please note that we added the Morse.ogg file with a SOUND TO COUNTRY action and the first MISSION START trigger.
|
||||
-- Because there is no unit from Bulgaria in the mission, nobody will hear the sound. But ths way the file is part of
|
||||
-- the mission file and we can use it with MOOSE.
|
||||
|
||||
-- # Guide:
|
||||
-- 1. Enter A-10CII.
|
||||
-- 2. Tune in 252 on UHF radio. You will hear the morse code.
|
||||
-- 2. Switch UHF mode to ADF
|
||||
-- 3. Needle 1 will move to ~ 150° on HSI.
|
||||
-- 4. Switch back to BOTH and frequency 252 to avoid the beacon sound.
|
||||
-- 5. Set TACAN to A/A REC and channel to 4Y.
|
||||
-- 6. On NMSP activate TCN.
|
||||
-- 7. HSI should point to the moving aircraft.
|
||||
|
||||
-- Create our UNIT objects on which we'll attach a BEACON.
|
||||
local Aircraft = UNIT:FindByName("Unit1")
|
||||
local LandUnit = UNIT:FindByName("Unit2")
|
||||
|
||||
-- Now, let's start with the TACAN Beacon.
|
||||
-- This particular TACAN can be homed on.
|
||||
local BeaconAircraft = Aircraft:GetBeacon()
|
||||
BeaconAircraft:ActivateTACAN(4, "Y", "UNIT1", true)
|
||||
|
||||
-- And let's setup the ground based radio beacon (ADF).
|
||||
-- Notice how this beacon will stop in 320 sec (last parameter).
|
||||
local BeaconLand = LandUnit:GetBeacon()
|
||||
BeaconLand:RadioBeacon("Morse.ogg", 252, radio.modulation.AM, 100, 320) -- File, frequency, modulation, power, timeout
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,39 +1,39 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.05.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE has been defined in mission editor. It's boundaries are marked with white smoke.
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving within the zone, a red smoke is placed at the vehicle location.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission.
|
||||
-- 2. Observe the zone perimeter. It should be marked with white smoke.
|
||||
-- 3. Observe the vehicle. It should place red smoke when driving through the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Now I can find the zone instead of doing ZONE:New, because the ZONE object is already in MOOSE.
|
||||
ZoneA = ZONE:FindByName( "Zone" )
|
||||
ZoneA:SmokeZone( SMOKECOLOR.White, 30 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.05.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE has been defined in mission editor. It's boundaries are marked with white smoke.
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving within the zone, a red smoke is placed at the vehicle location.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission.
|
||||
-- 2. Observe the zone perimeter. It should be marked with white smoke.
|
||||
-- 3. Observe the vehicle. It should place red smoke when driving through the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Now I can find the zone instead of doing ZONE:New, because the ZONE object is already in MOOSE.
|
||||
ZoneA = ZONE:FindByName( "Zone" )
|
||||
ZoneA:SmokeZone( SMOKECOLOR.White, 30 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,33 +1,33 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 08.10.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This test mission demonstrates how to get all SCENERY objects within a given zone.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the messages with the informations of the found objects.
|
||||
--
|
||||
-- Note: You can resice and move the zone in mission editor to inspect different locations.
|
||||
-- Important: IDs of SCENERY objects often change on terrain updates!
|
||||
|
||||
ZoneToScan = ZONE:New( "Zone" )
|
||||
ZoneToScan:DrawZone() -- Show the zone in F10 map, so it is easy to see.
|
||||
|
||||
-- Scan for all objects which are of category SCENERY
|
||||
ZoneToScan:Scan( Object.Category.SCENERY )
|
||||
|
||||
-- Process the result of the scan and print a message for each object.
|
||||
for SceneryTypeName, SceneryData in pairs( ZoneToScan:GetScannedScenery() ) do
|
||||
for SceneryName, SceneryObject in pairs( SceneryData ) do
|
||||
local SceneryObject = SceneryObject -- Wrapper.Scenery#SCENERY
|
||||
MESSAGE:NewType( "Scenery: " .. SceneryObject:GetTypeName() .. ", Coord LL DMS: " .. SceneryObject:GetCoordinate():ToStringLLDMS(), MESSAGE.Type.Information ):ToAll()
|
||||
end
|
||||
end
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 08.10.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This test mission demonstrates how to get all SCENERY objects within a given zone.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the messages with the informations of the found objects.
|
||||
--
|
||||
-- Note: You can resice and move the zone in mission editor to inspect different locations.
|
||||
-- Important: IDs of SCENERY objects often change on terrain updates!
|
||||
|
||||
ZoneToScan = ZONE:New( "Zone" )
|
||||
ZoneToScan:DrawZone() -- Show the zone in F10 map, so it is easy to see.
|
||||
|
||||
-- Scan for all objects which are of category SCENERY
|
||||
ZoneToScan:Scan( Object.Category.SCENERY )
|
||||
|
||||
-- Process the result of the scan and print a message for each object.
|
||||
for SceneryTypeName, SceneryData in pairs( ZoneToScan:GetScannedScenery() ) do
|
||||
for SceneryName, SceneryObject in pairs( SceneryData ) do
|
||||
local SceneryObject = SceneryObject -- Wrapper.Scenery#SCENERY
|
||||
MESSAGE:NewType( "Scenery: " .. SceneryObject:GetTypeName() .. ", Coord LL DMS: " .. SceneryObject:GetCoordinate():ToStringLLDMS(), MESSAGE.Type.Information ):ToAll()
|
||||
end
|
||||
end
|
||||
|
||||
Binary file not shown.
@ -1,51 +1,51 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A group of trucks will move straigth into one direction.
|
||||
-- We define a ZONE_GROUP which is a round zone around a group. It will move with the group leader.
|
||||
-- To make the zone visible in the mission we use FlareZone.
|
||||
--
|
||||
-- An APC is driving zigzags through the terrain. If it is within the moving zone red smoke will be deployed.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the moving truck convoy.
|
||||
-- 2. See the recurring deployed flare to get an idea of the actual zone bounderies.
|
||||
-- 3. Watch the APC driving trough the zone, a red smoke will be deployed.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of moving truck convoi.
|
||||
GroupTrucks = GROUP:FindByName( "Trucks" )
|
||||
|
||||
-- Get a zone attached to the group.
|
||||
ZoneA = ZONE_GROUP:New( "ZoneA", GroupTrucks, 100 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
-- Start a scheduler to deploy a flare every 5 seconds to give you an idea of the actual zone bounderies.
|
||||
TrucksZoneColoring = SCHEDULER:New( nil,
|
||||
function()
|
||||
ZoneA:FlareZone( FLARECOLOR.White, 90, 60 )
|
||||
end,
|
||||
{}, 0, 5
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A group of trucks will move straigth into one direction.
|
||||
-- We define a ZONE_GROUP which is a round zone around a group. It will move with the group leader.
|
||||
-- To make the zone visible in the mission we use FlareZone.
|
||||
--
|
||||
-- An APC is driving zigzags through the terrain. If it is within the moving zone red smoke will be deployed.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the moving truck convoy.
|
||||
-- 2. See the recurring deployed flare to get an idea of the actual zone bounderies.
|
||||
-- 3. Watch the APC driving trough the zone, a red smoke will be deployed.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of moving truck convoi.
|
||||
GroupTrucks = GROUP:FindByName( "Trucks" )
|
||||
|
||||
-- Get a zone attached to the group.
|
||||
ZoneA = ZONE_GROUP:New( "ZoneA", GroupTrucks, 100 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
-- Start a scheduler to deploy a flare every 5 seconds to give you an idea of the actual zone bounderies.
|
||||
TrucksZoneColoring = SCHEDULER:New( nil,
|
||||
function()
|
||||
ZoneA:FlareZone( FLARECOLOR.White, 90, 60 )
|
||||
end,
|
||||
{}, 0, 5
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,52 +1,52 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three groups of firefighters are placed.
|
||||
-- We define a ZONE_GROUP for each group, mark the border with white smoke and place 15 smokes inside of each zone.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three ZONE_GROUPs:
|
||||
Zone1 = ZONE_GROUP:New( "Zone 1", GROUP:FindByName( "Zone 1" ), 300 )
|
||||
Zone2 = ZONE_GROUP:New( "Zone 2", GROUP:FindByName( "Zone 2" ), 300 )
|
||||
Zone3 = ZONE_GROUP:New( "Zone 3", GROUP:FindByName( "Zone 3" ), 300 )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three groups of firefighters are placed.
|
||||
-- We define a ZONE_GROUP for each group, mark the border with white smoke and place 15 smokes inside of each zone.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three ZONE_GROUPs:
|
||||
Zone1 = ZONE_GROUP:New( "Zone 1", GROUP:FindByName( "Zone 1" ), 300 )
|
||||
Zone2 = ZONE_GROUP:New( "Zone 2", GROUP:FindByName( "Zone 2" ), 300 )
|
||||
Zone3 = ZONE_GROUP:New( "Zone 3", GROUP:FindByName( "Zone 3" ), 300 )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
|
||||
Binary file not shown.
@ -1,51 +1,51 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A single truck will move straigth into one direction.
|
||||
-- We define a ZONE_UNIT which is a round zone around a unit. It will move with the unit.
|
||||
-- To make the zone visible in the mission we use FlareZone.
|
||||
--
|
||||
-- An APC is driving zigzags through the terrain. If it is within the moving zone red smoke will be deployed.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the moving truck.
|
||||
-- 2. See the recurring deployed flare to get an idea of the actual zone bounderies.
|
||||
-- 3. Watch the APC driving trough the zone, a red smoke will be deployed.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of moving truck.
|
||||
Truck = UNIT:FindByName( "Truck" )
|
||||
|
||||
-- Get a zone attached to the unit.
|
||||
ZoneA = ZONE_UNIT:New( "Zone A", Truck, 100 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
-- Start a scheduler to deploy a flare every 5 seconds to give you an idea of the actual zone bounderies.
|
||||
TankZoneColoring = SCHEDULER:New( nil,
|
||||
function()
|
||||
ZoneA:FlareZone( FLARECOLOR.White, 90, 60 )
|
||||
end,
|
||||
{}, 0, 5
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A single truck will move straigth into one direction.
|
||||
-- We define a ZONE_UNIT which is a round zone around a unit. It will move with the unit.
|
||||
-- To make the zone visible in the mission we use FlareZone.
|
||||
--
|
||||
-- An APC is driving zigzags through the terrain. If it is within the moving zone red smoke will be deployed.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the moving truck.
|
||||
-- 2. See the recurring deployed flare to get an idea of the actual zone bounderies.
|
||||
-- 3. Watch the APC driving trough the zone, a red smoke will be deployed.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of moving truck.
|
||||
Truck = UNIT:FindByName( "Truck" )
|
||||
|
||||
-- Get a zone attached to the unit.
|
||||
ZoneA = ZONE_UNIT:New( "Zone A", Truck, 100 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
-- Start a scheduler to deploy a flare every 5 seconds to give you an idea of the actual zone bounderies.
|
||||
TankZoneColoring = SCHEDULER:New( nil,
|
||||
function()
|
||||
ZoneA:FlareZone( FLARECOLOR.White, 90, 60 )
|
||||
end,
|
||||
{}, 0, 5
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,52 +1,52 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three firefighters are placed.
|
||||
-- We define a ZONE_UNIT for each firefighter, mark the border with white smoke and place 15 smokes inside of each zone.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three ZONE_UNITs:
|
||||
Zone1 = ZONE_UNIT:New( "Zone 1", UNIT:FindByName( "Unit1" ), 300 )
|
||||
Zone2 = ZONE_UNIT:New( "Zone 2", UNIT:FindByName( "Unit2" ), 300 )
|
||||
Zone3 = ZONE_UNIT:New( "Zone 3", UNIT:FindByName( "Unit3" ), 300 )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three firefighters are placed.
|
||||
-- We define a ZONE_UNIT for each firefighter, mark the border with white smoke and place 15 smokes inside of each zone.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three ZONE_UNITs:
|
||||
Zone1 = ZONE_UNIT:New( "Zone 1", UNIT:FindByName( "Unit1" ), 300 )
|
||||
Zone2 = ZONE_UNIT:New( "Zone 2", UNIT:FindByName( "Unit2" ), 300 )
|
||||
Zone3 = ZONE_UNIT:New( "Zone 3", UNIT:FindByName( "Unit3" ), 300 )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
|
||||
Binary file not shown.
@ -1,41 +1,41 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_RADIUS has been defined. It's boundaries are marked with white smoke.
|
||||
-- Center of the zone is placed on the postion of a bunker.
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving inside of the zone, a red smoke is placed on the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Watch the APC driving trough the zone, a red smoke will be deployed.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of the bunker.
|
||||
Bunker = STATIC:FindByName( "Bunker" )
|
||||
|
||||
-- Get a zone around the bunker object and mark it with smoke.
|
||||
ZoneA = ZONE_RADIUS:New( "Zone A", Bunker:GetVec2(), 300 )
|
||||
ZoneA:SmokeZone( SMOKECOLOR.White, 90 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_RADIUS has been defined. It's boundaries are marked with white smoke.
|
||||
-- Center of the zone is placed on the postion of a bunker.
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving inside of the zone, a red smoke is placed on the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Watch the APC driving trough the zone, a red smoke will be deployed.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of the bunker.
|
||||
Bunker = STATIC:FindByName( "Bunker" )
|
||||
|
||||
-- Get a zone around the bunker object and mark it with smoke.
|
||||
ZoneA = ZONE_RADIUS:New( "Zone A", Bunker:GetVec2(), 300 )
|
||||
ZoneA:SmokeZone( SMOKECOLOR.White, 90 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( ZoneA ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,58 +1,58 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three firefighters are placed.
|
||||
-- We define a ZONE_RADIUS and use the position of the units (GetVec2) as center.
|
||||
-- We mark the border of each zone with white smoke and place 15 smokes inside of each zone.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three UNITs:
|
||||
Unit1 = UNIT:FindByName( "Unit1" )
|
||||
Unit2 = UNIT:FindByName( "Unit2" )
|
||||
Unit3 = UNIT:FindByName( "Unit3" )
|
||||
|
||||
-- Get all three ZONE_RADIUS on unit positions:
|
||||
Zone1 = ZONE_RADIUS:New( "Zone 1", Unit1:GetVec2(), 300 )
|
||||
Zone2 = ZONE_RADIUS:New( "Zone 2", Unit2:GetVec2(), 300 )
|
||||
Zone3 = ZONE_RADIUS:New( "Zone 3", Unit3:GetVec2(), 300 )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three firefighters are placed.
|
||||
-- We define a ZONE_RADIUS and use the position of the units (GetVec2) as center.
|
||||
-- We mark the border of each zone with white smoke and place 15 smokes inside of each zone.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three UNITs:
|
||||
Unit1 = UNIT:FindByName( "Unit1" )
|
||||
Unit2 = UNIT:FindByName( "Unit2" )
|
||||
Unit3 = UNIT:FindByName( "Unit3" )
|
||||
|
||||
-- Get all three ZONE_RADIUS on unit positions:
|
||||
Zone1 = ZONE_RADIUS:New( "Zone 1", Unit1:GetVec2(), 300 )
|
||||
Zone2 = ZONE_RADIUS:New( "Zone 2", Unit2:GetVec2(), 300 )
|
||||
Zone3 = ZONE_RADIUS:New( "Zone 3", Unit3:GetVec2(), 300 )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 18 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
|
||||
Binary file not shown.
@ -1,42 +1,42 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_POLYGON has been defined, which boundaries are smoking.
|
||||
-- The polygon is defined by the waypoint of a BTR-80, whith activated 'LATE ACTIVATION'
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of the unit with waypoints.
|
||||
GroupPolygon = GROUP:FindByName( "Polygon" )
|
||||
|
||||
-- Get a polygon zone and smoke the borders.
|
||||
PolygonZone = ZONE_POLYGON:New( "Polygon A", GroupPolygon )
|
||||
PolygonZone:SmokeZone( SMOKECOLOR.White, 20 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( PolygonZone ) ) and "Inside Polygon A" or "Outside Polygon A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( PolygonZone ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_POLYGON has been defined, which boundaries are smoking.
|
||||
-- The polygon is defined by the waypoint of a BTR-80, whith activated 'LATE ACTIVATION'
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of the unit with waypoints.
|
||||
GroupPolygon = GROUP:FindByName( "Polygon" )
|
||||
|
||||
-- Get a polygon zone and smoke the borders.
|
||||
PolygonZone = ZONE_POLYGON:New( "Polygon A", GroupPolygon )
|
||||
PolygonZone:SmokeZone( SMOKECOLOR.White, 20 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( PolygonZone ) ) and "Inside Polygon A" or "Outside Polygon A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( PolygonZone ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,52 +1,52 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three firefighters are placed.
|
||||
-- We define a ZONE_POLYGON for each and use the waypoints as the shape.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three ZONE_POLYGON from the groups:
|
||||
Zone1 = ZONE_POLYGON:New( "Zone 1", GROUP:FindByName( "GroupA" ) )
|
||||
Zone2 = ZONE_POLYGON:New( "Zone 2", GROUP:FindByName( "GroupB" ) )
|
||||
Zone3 = ZONE_POLYGON:New( "Zone 3", GROUP:FindByName( "GroupC" ) )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 4 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 4 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 4 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Three firefighters are placed.
|
||||
-- We define a ZONE_POLYGON for each and use the waypoints as the shape.
|
||||
-- We use different methods to choose a random point:
|
||||
-- - The first 15 points are blue smoked using the GetRandomVec2() API.
|
||||
-- - The second 15 points are orange smoked using the GetRandomPointVec2() API.
|
||||
-- - The third 15 points are red smoked using the GetRandomPointVec3() API.
|
||||
--
|
||||
-- Note: At each zone an vehicle is placed, so you can view the smoking in external view (F7).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission. Zoom out and switch position with F7.
|
||||
-- 2. Observe smoking of Blue smoke in Zone 1.
|
||||
-- 3. Observe smoking of Orange smoke in Zone 2.
|
||||
-- 4. Observe smoking of Red smoke in Zone 3.
|
||||
|
||||
-- Get all three ZONE_POLYGON from the groups:
|
||||
Zone1 = ZONE_POLYGON:New( "Zone 1", GROUP:FindByName( "GroupA" ) )
|
||||
Zone2 = ZONE_POLYGON:New( "Zone 2", GROUP:FindByName( "GroupB" ) )
|
||||
Zone3 = ZONE_POLYGON:New( "Zone 3", GROUP:FindByName( "GroupC" ) )
|
||||
|
||||
-- Add white smoke to the borders of the zones:
|
||||
Zone1:SmokeZone( SMOKECOLOR.White, 4 )
|
||||
Zone2:SmokeZone( SMOKECOLOR.White, 4 )
|
||||
Zone3:SmokeZone( SMOKECOLOR.White, 4 )
|
||||
|
||||
-- Mark 15 random points with smock inside each zone.
|
||||
for i = 1, 15 do
|
||||
-- Zone 1
|
||||
local Vec2 = Zone1:GetRandomVec2()
|
||||
local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 )
|
||||
PointVec2:SmokeBlue()
|
||||
|
||||
-- Zone 2
|
||||
local PointVec2 = Zone2:GetRandomPointVec2()
|
||||
PointVec2:SmokeOrange()
|
||||
|
||||
-- Zone 3
|
||||
local PointVec3 = Zone3:GetRandomPointVec3()
|
||||
PointVec3:SmokeRed()
|
||||
end
|
||||
|
||||
Binary file not shown.
@ -1,42 +1,42 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_POLYGON has been defined, which boundaries are marked with tires.
|
||||
-- The polygon is defined by the waypoint of a BTR-80, whith activated 'LATE ACTIVATION'
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of the unit with waypoints.
|
||||
GroupPolygon = GROUP:FindByName( "Polygon" )
|
||||
|
||||
-- Get a polygon zone and mark the with tires (see F10 map).
|
||||
PolygonZone = ZONE_POLYGON:New( "Polygon A", GroupPolygon )
|
||||
PolygonZone:BoundZone()
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( PolygonZone ) ) and "Inside Polygon A" or "Outside Polygon A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( PolygonZone ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 18.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_POLYGON has been defined, which boundaries are marked with tires.
|
||||
-- The polygon is defined by the waypoint of a BTR-80, whith activated 'LATE ACTIVATION'
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get object of the unit with waypoints.
|
||||
GroupPolygon = GROUP:FindByName( "Polygon" )
|
||||
|
||||
-- Get a polygon zone and mark the with tires (see F10 map).
|
||||
PolygonZone = ZONE_POLYGON:New( "Polygon A", GroupPolygon )
|
||||
PolygonZone:BoundZone()
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( PolygonZone ) ) and "Inside Polygon A" or "Outside Polygon A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( PolygonZone ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,39 +1,39 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.05.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_POLYGON has been defined, which boundaries are smoking.
|
||||
-- The polygon is defined by the waypoints of a BTR-80, whith activated 'LATE ACTIVATION'
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get a polygon zone and smoke the borders. This time with function FindByName!
|
||||
PolygonZone = ZONE_POLYGON:FindByName( "Polygon A" )
|
||||
PolygonZone:SmokeZone( SMOKECOLOR.White, 10 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( PolygonZone ) ) and "Inside Polygon A" or "Outside Polygon A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( PolygonZone ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.05.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ZONE_POLYGON has been defined, which boundaries are smoking.
|
||||
-- The polygon is defined by the waypoints of a BTR-80, whith activated 'LATE ACTIVATION'
|
||||
-- A vehicle is driving through the zone perimeters.
|
||||
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get object for APC.
|
||||
GroupApc = GROUP:FindByName( "APC" )
|
||||
|
||||
-- Get a polygon zone and smoke the borders. This time with function FindByName!
|
||||
PolygonZone = ZONE_POLYGON:FindByName( "Polygon A" )
|
||||
PolygonZone:SmokeZone( SMOKECOLOR.White, 10 )
|
||||
|
||||
-- Start a scheduler to test every second if the APC is inside of the zone.
|
||||
-- Post a message with the result and deploy smoke if APC is within the zone.
|
||||
Messager = SCHEDULER:New( nil,
|
||||
function()
|
||||
GroupApc:MessageToAll( ( GroupApc:IsCompletelyInZone( PolygonZone ) ) and "Inside Polygon A" or "Outside Polygon A", 1 )
|
||||
if GroupApc:IsCompletelyInZone( PolygonZone ) then
|
||||
GroupApc:GetUnit(1):SmokeRed()
|
||||
end
|
||||
end,
|
||||
{}, 0, 1
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,70 +1,70 @@
|
||||
---
|
||||
-- Author: Applevangelist
|
||||
-- Created: 13.05.2021
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Point.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This demo mission illustrates how to draw zones (circular and polygon) defined in the Mission Editor on the F10 map.
|
||||
-- Furthermore, it shows how to create cicles, rectangled, lines, arrows and text at arbitrary coordinates on the F10 map.
|
||||
--
|
||||
-- # Guide:
|
||||
-- 1. Start the mission and join as Observer.
|
||||
-- 2. Zoom out and find all the different drawings.
|
||||
|
||||
-- Circular zone defined in the ME.
|
||||
local circzone=ZONE:New("Circular Zone")
|
||||
|
||||
-- Draw the zone on the F10 map. Colors are taken from the ME settings.
|
||||
circzone:DrawZone()
|
||||
|
||||
-- Quad-point zone defined in the ME.
|
||||
local quadzone=ZONE:New("Quad Zone") --Core.Zone#ZONE_POLYGON_BASE
|
||||
|
||||
-- Draw the zone on the F10 map. Colors are taken from the ME settings.
|
||||
quadzone:DrawZone()
|
||||
|
||||
-- After 500 seconds, the drawing is removed.
|
||||
quadzone:UndrawZone(500)
|
||||
|
||||
|
||||
-- Polygon zone defined by waypoints of the group "Rotary-1". This surrounds a lake near Poti.
|
||||
local polyzone=ZONE_POLYGON:NewFromGroupName("Rotary-1")
|
||||
|
||||
-- Draw the zone. Line color is green, fill color is turquoise with 50% alpha. Line type is dashed.
|
||||
polyzone:DrawZone(-1, {0,1,0}, 1.0, {0,1,1}, 0.5, 2)
|
||||
|
||||
|
||||
-- Get coordinates of some airbases of the map.
|
||||
local coordBatumi=AIRBASE:FindByName("Batumi"):GetCoordinate()
|
||||
local coordKobuleti=AIRBASE:FindByName("Kobuleti"):GetCoordinate()
|
||||
local coordGudauta=AIRBASE:FindByName(AIRBASE.Caucasus.Gudauta):GetCoordinate()
|
||||
local coordKrymsk=AIRBASE:FindByName(AIRBASE.Caucasus.Krymsk):GetCoordinate()
|
||||
local coordBeslan=AIRBASE:FindByName(AIRBASE.Caucasus.Beslan):GetCoordinate()
|
||||
local coordNalchik=AIRBASE:FindByName(AIRBASE.Caucasus.Nalchik):GetCoordinate()
|
||||
local coordMinVody=AIRBASE:FindByName(AIRBASE.Caucasus.Mineralnye_Vody):GetCoordinate()
|
||||
local coordMozdok=AIRBASE:FindByName(AIRBASE.Caucasus.Mozdok):GetCoordinate()
|
||||
|
||||
|
||||
-- Draw a circle with 15 km radius around Krymsk Airbase.
|
||||
coordKrymsk:CircleToAll(15000)
|
||||
|
||||
-- Draw a rectancle. First corner is Gudauta. Opposite corner is 30000 meters in heading 135 degrees.
|
||||
coordGudauta:RectToAll(coordGudauta:Translate(30000, 135))
|
||||
|
||||
-- Draw a quad-point shape. Corners are defined by the airbases.
|
||||
coordBeslan:QuadToAll(coordNalchik, coordMinVody, coordMozdok, nil, {1,0,1}, nil, {0,1,0}, 0.8, 4)
|
||||
|
||||
-- Draw a blue line from Mozdok to Krymsk.
|
||||
coordMozdok:LineToAll(coordKrymsk, nil, {0,0,1})
|
||||
|
||||
-- Draw a green arrow from Batumi to a ship group called "Naval-1". This arrow is only visible to the blue coalition.
|
||||
coordBatumi:ArrowToAll(GROUP:FindByName("Naval-1"):GetCoordinate(), 2, {0,1,0})
|
||||
|
||||
-- Write text "Target Warehouse" at position of a static warehouse.
|
||||
STATIC:FindByName("Static Warehouse-1"):GetCoordinate():TextToAll("Target Warehouse")
|
||||
---
|
||||
-- Author: Applevangelist
|
||||
-- Created: 13.05.2021
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Point.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This demo mission illustrates how to draw zones (circular and polygon) defined in the Mission Editor on the F10 map.
|
||||
-- Furthermore, it shows how to create cicles, rectangled, lines, arrows and text at arbitrary coordinates on the F10 map.
|
||||
--
|
||||
-- # Guide:
|
||||
-- 1. Start the mission and join as Observer.
|
||||
-- 2. Zoom out and find all the different drawings.
|
||||
|
||||
-- Circular zone defined in the ME.
|
||||
local circzone=ZONE:New("Circular Zone")
|
||||
|
||||
-- Draw the zone on the F10 map. Colors are taken from the ME settings.
|
||||
circzone:DrawZone()
|
||||
|
||||
-- Quad-point zone defined in the ME.
|
||||
local quadzone=ZONE:New("Quad Zone") --Core.Zone#ZONE_POLYGON_BASE
|
||||
|
||||
-- Draw the zone on the F10 map. Colors are taken from the ME settings.
|
||||
quadzone:DrawZone()
|
||||
|
||||
-- After 500 seconds, the drawing is removed.
|
||||
quadzone:UndrawZone(500)
|
||||
|
||||
|
||||
-- Polygon zone defined by waypoints of the group "Rotary-1". This surrounds a lake near Poti.
|
||||
local polyzone=ZONE_POLYGON:NewFromGroupName("Rotary-1")
|
||||
|
||||
-- Draw the zone. Line color is green, fill color is turquoise with 50% alpha. Line type is dashed.
|
||||
polyzone:DrawZone(-1, {0,1,0}, 1.0, {0,1,1}, 0.5, 2)
|
||||
|
||||
|
||||
-- Get coordinates of some airbases of the map.
|
||||
local coordBatumi=AIRBASE:FindByName("Batumi"):GetCoordinate()
|
||||
local coordKobuleti=AIRBASE:FindByName("Kobuleti"):GetCoordinate()
|
||||
local coordGudauta=AIRBASE:FindByName(AIRBASE.Caucasus.Gudauta):GetCoordinate()
|
||||
local coordKrymsk=AIRBASE:FindByName(AIRBASE.Caucasus.Krymsk):GetCoordinate()
|
||||
local coordBeslan=AIRBASE:FindByName(AIRBASE.Caucasus.Beslan):GetCoordinate()
|
||||
local coordNalchik=AIRBASE:FindByName(AIRBASE.Caucasus.Nalchik):GetCoordinate()
|
||||
local coordMinVody=AIRBASE:FindByName(AIRBASE.Caucasus.Mineralnye_Vody):GetCoordinate()
|
||||
local coordMozdok=AIRBASE:FindByName(AIRBASE.Caucasus.Mozdok):GetCoordinate()
|
||||
|
||||
|
||||
-- Draw a circle with 15 km radius around Krymsk Airbase.
|
||||
coordKrymsk:CircleToAll(15000)
|
||||
|
||||
-- Draw a rectancle. First corner is Gudauta. Opposite corner is 30000 meters in heading 135 degrees.
|
||||
coordGudauta:RectToAll(coordGudauta:Translate(30000, 135))
|
||||
|
||||
-- Draw a quad-point shape. Corners are defined by the airbases.
|
||||
coordBeslan:QuadToAll(coordNalchik, coordMinVody, coordMozdok, nil, {1,0,1}, nil, {0,1,0}, 0.8, 4)
|
||||
|
||||
-- Draw a blue line from Mozdok to Krymsk.
|
||||
coordMozdok:LineToAll(coordKrymsk, nil, {0,0,1})
|
||||
|
||||
-- Draw a green arrow from Batumi to a ship group called "Naval-1". This arrow is only visible to the blue coalition.
|
||||
coordBatumi:ArrowToAll(GROUP:FindByName("Naval-1"):GetCoordinate(), 2, {0,1,0})
|
||||
|
||||
-- Write text "Target Warehouse" at position of a static warehouse.
|
||||
STATIC:FindByName("Static Warehouse-1"):GetCoordinate():TextToAll("Target Warehouse")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,33 +1,33 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this demo mission we will show how to use the method IsAlive() on group level.
|
||||
-- Two ground forces GROUPS are shooting each other (T-80 vs M2A2).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Run the mission and check the messages.
|
||||
-- 2. If a unit is dead the returned value will be nil
|
||||
|
||||
-- Create Spawn Groups:
|
||||
local GroupBlue = GROUP:FindByName( "Blue" )
|
||||
local GroupRed = GROUP:FindByName( "Red" )
|
||||
local GroupObserver = GROUP:FindByName( "Observer" )
|
||||
|
||||
-- Start a scheduler to test every second if the groups are alive and post a status message.
|
||||
local Schedule, ScheduleID = SCHEDULER:New( nil,
|
||||
function( GroupBlue, GroupRed )
|
||||
local IsAliveBlue = GroupBlue:IsAlive()
|
||||
local IsAliveRed = GroupRed:IsAlive()
|
||||
|
||||
GroupObserver:MessageToAll( "IsAliveBlue=" .. tostring(IsAliveBlue) .. " ----- IsAliveRed=" .. tostring(IsAliveRed), 1 )
|
||||
end, { GroupBlue, GroupRed }, 1, 1
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 21.02.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 23.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this demo mission we will show how to use the method IsAlive() on group level.
|
||||
-- Two ground forces GROUPS are shooting each other (T-80 vs M2A2).
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Run the mission and check the messages.
|
||||
-- 2. If a unit is dead the returned value will be nil
|
||||
|
||||
-- Create Spawn Groups:
|
||||
local GroupBlue = GROUP:FindByName( "Blue" )
|
||||
local GroupRed = GROUP:FindByName( "Red" )
|
||||
local GroupObserver = GROUP:FindByName( "Observer" )
|
||||
|
||||
-- Start a scheduler to test every second if the groups are alive and post a status message.
|
||||
local Schedule, ScheduleID = SCHEDULER:New( nil,
|
||||
function( GroupBlue, GroupRed )
|
||||
local IsAliveBlue = GroupBlue:IsAlive()
|
||||
local IsAliveRed = GroupRed:IsAlive()
|
||||
|
||||
GroupObserver:MessageToAll( "IsAliveBlue=" .. tostring(IsAliveBlue) .. " ----- IsAliveRed=" .. tostring(IsAliveRed), 1 )
|
||||
end, { GroupBlue, GroupRed }, 1, 1
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,51 +1,51 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this mission one Ka-50 (HeliGroup) will attack a group of trucks.
|
||||
-- As you can see below the code to accomplish this is not trivial.
|
||||
-- But it is good way to understand the details of task assignment in DCS.
|
||||
-- A better way is to use new new Ops.Auftrag class.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get objects of the groups we need:
|
||||
local HeliGroup = GROUP:FindByName( "Helicopter" )
|
||||
local TargetGroup = GROUP:FindByName( "Targets" )
|
||||
|
||||
-- Get all units of the target group
|
||||
local TargetUnits = TargetGroup:GetUnits()
|
||||
|
||||
-- Create an empty list of tasks for the HeliGroup.
|
||||
local HeliTasks = {}
|
||||
|
||||
-- Loop through all units of TargetGroup.
|
||||
-- #TargetUnits is the number of elements of TargetUnits.
|
||||
for i = 1, #TargetUnits do
|
||||
local TargetUnit = TargetGroup:GetUnit( i )
|
||||
-- Add an attack task to the HeliTasks table for each target unit.
|
||||
HeliTasks[#HeliTasks+1] = HeliGroup:TaskAttackUnit( TargetUnit )
|
||||
end
|
||||
|
||||
-- As the last task add a function
|
||||
HeliTasks[#HeliTasks+1] = HeliGroup:TaskFunction( "_Resume", { "''" } )
|
||||
|
||||
-- This is a very simple function, which only prints only a message.
|
||||
-- But you can do very complex things in such a method.
|
||||
-- @param Wrapper.Group#GROUP HeliGroup
|
||||
function _Resume( HeliGroup )
|
||||
HeliGroup:MessageToAll( "All tasks completed.", 10, "Info") -- Show an info message for 10 seconds.
|
||||
end
|
||||
|
||||
-- Push the list with all tasks to the HeliGroup with a delay of 10 seconds.
|
||||
HeliGroup:PushTask( HeliGroup:TaskCombo( HeliTasks ), 10 )
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this mission one Ka-50 (HeliGroup) will attack a group of trucks.
|
||||
-- As you can see below the code to accomplish this is not trivial.
|
||||
-- But it is good way to understand the details of task assignment in DCS.
|
||||
-- A better way is to use new new Ops.Auftrag class.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Start the mission and watch the APC driving trough the zone.
|
||||
-- 2. A red smoke will be deployed within the zone.
|
||||
|
||||
-- Get objects of the groups we need:
|
||||
local HeliGroup = GROUP:FindByName( "Helicopter" )
|
||||
local TargetGroup = GROUP:FindByName( "Targets" )
|
||||
|
||||
-- Get all units of the target group
|
||||
local TargetUnits = TargetGroup:GetUnits()
|
||||
|
||||
-- Create an empty list of tasks for the HeliGroup.
|
||||
local HeliTasks = {}
|
||||
|
||||
-- Loop through all units of TargetGroup.
|
||||
-- #TargetUnits is the number of elements of TargetUnits.
|
||||
for i = 1, #TargetUnits do
|
||||
local TargetUnit = TargetGroup:GetUnit( i )
|
||||
-- Add an attack task to the HeliTasks table for each target unit.
|
||||
HeliTasks[#HeliTasks+1] = HeliGroup:TaskAttackUnit( TargetUnit )
|
||||
end
|
||||
|
||||
-- As the last task add a function
|
||||
HeliTasks[#HeliTasks+1] = HeliGroup:TaskFunction( "_Resume", { "''" } )
|
||||
|
||||
-- This is a very simple function, which only prints only a message.
|
||||
-- But you can do very complex things in such a method.
|
||||
-- @param Wrapper.Group#GROUP HeliGroup
|
||||
function _Resume( HeliGroup )
|
||||
HeliGroup:MessageToAll( "All tasks completed.", 10, "Info") -- Show an info message for 10 seconds.
|
||||
end
|
||||
|
||||
-- Push the list with all tasks to the HeliGroup with a delay of 10 seconds.
|
||||
HeliGroup:PushTask( HeliGroup:TaskCombo( HeliTasks ), 10 )
|
||||
|
||||
Binary file not shown.
@ -1,36 +1,36 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Point.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this two planes will be spawned.
|
||||
-- The second one will follow the first one.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the planes moving.
|
||||
|
||||
-- Create spawn objects from groups:
|
||||
local SpawnPlane1 = SPAWN:New("Plane 1")
|
||||
local SpawnPlane2 = SPAWN:New("Plane 2")
|
||||
|
||||
-- Spawn the groups into the world:
|
||||
local GroupPlane1 = SpawnPlane1:Spawn()
|
||||
local GroupPlane2 = SpawnPlane2:Spawn()
|
||||
|
||||
--Create a task for Plane 2 (follow GroupPlane1 at Vec3 offset):
|
||||
local PointVec3 = POINT_VEC3:New( 100, 0, -100 ) -- This is a Vec3 class.
|
||||
local FollowDCSTask = GroupPlane2:TaskFollow( GroupPlane1, PointVec3:GetVec3() )
|
||||
|
||||
-- Activate Task with SetTask.
|
||||
-- PushTask will push a task on the execution queue of the group.
|
||||
-- SetTask will delete all tasks from the current group queue and executes this task.
|
||||
-- We use SetTask this time:
|
||||
GroupPlane2:SetTask( FollowDCSTask, 1 )
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Point.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this two planes will be spawned.
|
||||
-- The second one will follow the first one.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the planes moving.
|
||||
|
||||
-- Create spawn objects from groups:
|
||||
local SpawnPlane1 = SPAWN:New("Plane 1")
|
||||
local SpawnPlane2 = SPAWN:New("Plane 2")
|
||||
|
||||
-- Spawn the groups into the world:
|
||||
local GroupPlane1 = SpawnPlane1:Spawn()
|
||||
local GroupPlane2 = SpawnPlane2:Spawn()
|
||||
|
||||
--Create a task for Plane 2 (follow GroupPlane1 at Vec3 offset):
|
||||
local PointVec3 = POINT_VEC3:New( 100, 0, -100 ) -- This is a Vec3 class.
|
||||
local FollowDCSTask = GroupPlane2:TaskFollow( GroupPlane1, PointVec3:GetVec3() )
|
||||
|
||||
-- Activate Task with SetTask.
|
||||
-- PushTask will push a task on the execution queue of the group.
|
||||
-- SetTask will delete all tasks from the current group queue and executes this task.
|
||||
-- We use SetTask this time:
|
||||
GroupPlane2:SetTask( FollowDCSTask, 1 )
|
||||
|
||||
Binary file not shown.
@ -1,33 +1,33 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this mission one Ka-50 (HeliGroup) will start from a FARP.
|
||||
-- Normally it would fly a big polygon shaped patrol around the FARP.
|
||||
-- At the end it will land back on the FARP.
|
||||
-- But in the code below we change the route dynamically.
|
||||
-- So instead of flying to waypoint 2, it will fly to the last waypoint 7.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the Ka-50 flying around.
|
||||
|
||||
-- Get a group object of the Ka-50:
|
||||
HeliGroup = GROUP:FindByName( "Helicopter" )
|
||||
|
||||
-- Route it back to the FARP after 60 seconds.
|
||||
-- We use the SCHEDULER class to do this.
|
||||
SCHEDULER:New( nil,
|
||||
function( HeliGroup )
|
||||
local CommandRTB = HeliGroup:CommandSwitchWayPoint( 2, 7 )
|
||||
HeliGroup:SetCommand( CommandRTB )
|
||||
HeliGroup:MessageToAll("We lose fuel: RTB.", 20)
|
||||
end, { HeliGroup }, 60
|
||||
)
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- In this mission one Ka-50 (HeliGroup) will start from a FARP.
|
||||
-- Normally it would fly a big polygon shaped patrol around the FARP.
|
||||
-- At the end it will land back on the FARP.
|
||||
-- But in the code below we change the route dynamically.
|
||||
-- So instead of flying to waypoint 2, it will fly to the last waypoint 7.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and watch the Ka-50 flying around.
|
||||
|
||||
-- Get a group object of the Ka-50:
|
||||
HeliGroup = GROUP:FindByName( "Helicopter" )
|
||||
|
||||
-- Route it back to the FARP after 60 seconds.
|
||||
-- We use the SCHEDULER class to do this.
|
||||
SCHEDULER:New( nil,
|
||||
function( HeliGroup )
|
||||
local CommandRTB = HeliGroup:CommandSwitchWayPoint( 2, 7 )
|
||||
HeliGroup:SetCommand( CommandRTB )
|
||||
HeliGroup:MessageToAll("We lose fuel: RTB.", 20)
|
||||
end, { HeliGroup }, 60
|
||||
)
|
||||
|
||||
Binary file not shown.
@ -1,46 +1,46 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 25.03.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Scheduler.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ground unit is moving.
|
||||
-- Using the command CommandStopRoute it will be stopped and starts moving again.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission
|
||||
-- 2. Observe the group is moving
|
||||
-- 3. After 10 seconds it will stop.
|
||||
-- 4. After additional 10 seconds it will move again.
|
||||
-- 5. This will be repeated endless.
|
||||
|
||||
-- Function to stop movement.
|
||||
--- @param Wrapper.Group#GROUP MyGroup
|
||||
function StopMove( MyGroup )
|
||||
MyGroup:MessageToAll("StopMove")
|
||||
local Command = MyGroup:CommandStopRoute( true )
|
||||
MyGroup:SetCommand(Command)
|
||||
end
|
||||
|
||||
-- Function to start movement.
|
||||
--- @param Wrapper.Group#GROUP MyGroup
|
||||
function StartMove( MyGroup )
|
||||
MyGroup:MessageToAll("StartMove")
|
||||
local Command = MyGroup:CommandStopRoute( false )
|
||||
MyGroup:SetCommand(Command)
|
||||
end
|
||||
|
||||
-- Get an object of the group:
|
||||
GroundGroup = GROUP:FindByName( "Ground" )
|
||||
|
||||
-- Run two schedulers every 20 seconds, but with different start delays:
|
||||
Scheduler = SCHEDULER:New( nil )
|
||||
ScheduleIDStop = Scheduler:Schedule(nil, StopMove, { GroundGroup }, 10, 20 ) -- 10 seconds delay from mission start
|
||||
ScheduleIDStart = Scheduler:Schedule(nil, StartMove, { GroundGroup }, 20, 20 ) -- 20 seconds delay from mission start
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 25.03.2017
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 24.02.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Scheduler.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- A ground unit is moving.
|
||||
-- Using the command CommandStopRoute it will be stopped and starts moving again.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission
|
||||
-- 2. Observe the group is moving
|
||||
-- 3. After 10 seconds it will stop.
|
||||
-- 4. After additional 10 seconds it will move again.
|
||||
-- 5. This will be repeated endless.
|
||||
|
||||
-- Function to stop movement.
|
||||
--- @param Wrapper.Group#GROUP MyGroup
|
||||
function StopMove( MyGroup )
|
||||
MyGroup:MessageToAll("StopMove")
|
||||
local Command = MyGroup:CommandStopRoute( true )
|
||||
MyGroup:SetCommand(Command)
|
||||
end
|
||||
|
||||
-- Function to start movement.
|
||||
--- @param Wrapper.Group#GROUP MyGroup
|
||||
function StartMove( MyGroup )
|
||||
MyGroup:MessageToAll("StartMove")
|
||||
local Command = MyGroup:CommandStopRoute( false )
|
||||
MyGroup:SetCommand(Command)
|
||||
end
|
||||
|
||||
-- Get an object of the group:
|
||||
GroundGroup = GROUP:FindByName( "Ground" )
|
||||
|
||||
-- Run two schedulers every 20 seconds, but with different start delays:
|
||||
Scheduler = SCHEDULER:New( nil )
|
||||
ScheduleIDStop = Scheduler:Schedule(nil, StopMove, { GroundGroup }, 10, 20 ) -- 10 seconds delay from mission start
|
||||
ScheduleIDStart = Scheduler:Schedule(nil, StartMove, { GroundGroup }, 20, 20 ) -- 20 seconds delay from mission start
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user