diff --git a/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/SET-SCENERY-100 - Scenery Set From Zone.lua b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/SET-SCENERY-100 - Scenery Set From Zone.lua new file mode 100644 index 0000000000..e1158ad1f0 --- /dev/null +++ b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/SET-SCENERY-100 - Scenery Set From Zone.lua @@ -0,0 +1,58 @@ +------------------------------------------------------------------------- +-- SET-SCENERY-100 - Scenery Set From Zone +------------------------------------------------------------------------- +-- Documentation +-- +-- SET_SCENERY: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Set.html##(SET_SCENERY) +-- +------------------------------------------------------------------------- +-- Join the game master slot initially, and then the Tank in +-- Combined Arms after a few seconds. Shoot and destroy on of the tanks +-- ahead. +------------------------------------------------------------------------- +-- Date: November 2022 +------------------------------------------------------------------------- + +-- Get our ZONE object and draw it +local zone = ZONE:FindByName("OilTankZone") +zone:DrawZone(-1,{0,0,1},nil,nil,nil,1) +-- Create a SET_SCENERY from the map objects in the zone +local oilstation = SET_SCENERY:NewFromZone(zone) +-- we'll use this SET for further filtering +local oiltanks = SET_SCENERY:New() + +-- An Airbase has a lot of map objects, but we only want to have tanks +oilstation:ForEachScenery( + function(object) + local scenery = object --Wrapper.Scenery#SCENERY + local name = scenery:GetName() + local desc = scenery:GetDesc() + BASE:I({desc.typeName}) + if string.find(string.lower(desc.typeName),"tank") then + oiltanks:AddObject(scenery) + end + end +) + +-- Count how many we have +local NumberTanks0 = oiltanks:CountAlive() +-- user flag OilTanks will be zero initially +local flag = USERFLAG:New("OilTanks") +flag:Set(0) + +-- Function to check number of alive tanks regularly +function CheckOnOilTanks(TankSet,InitialNo,Threshold) + local NumberTanks = TankSet:CountAlive() + MESSAGE:New("Oil Tanks alive: "..NumberTanks,15,"OilTanks"):ToAll() + if NumberTanks <= InitialNo*Threshold then + -- Success! + MESSAGE:New("Success! Oil Tanks have been diminished!",15,"OilTanks"):ToAll() + -- Set a Flag in Mission Editor + flag:Set(999) + end +end + +-- Create a timer to run the check function +local TankTimer = TIMER:New(CheckOnOilTanks,oiltanks,NumberTanks0,0.2) +-- check every minute +TankTimer:Start(10,30,3600) diff --git a/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/SET-SCENERY-100 - Scenery Set From Zone.miz b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/SET-SCENERY-100 - Scenery Set From Zone.miz new file mode 100644 index 0000000000..4e5c6a4a70 Binary files /dev/null and b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/SET-SCENERY-100 - Scenery Set From Zone.miz differ diff --git a/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/pack.ps1 b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/pack.ps1 new file mode 100644 index 0000000000..bbac66e7c1 --- /dev/null +++ b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/pack.ps1 @@ -0,0 +1,10 @@ +$dir = split-path -parent $MyInvocation.MyCommand.Definition +cd $dir +$file = Split-Path $dir -leaf + +$dir +$file + +cd "_unpacked" +. 7z a -r -y -tzip "..\$file.miz" * +cd .. diff --git a/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/unpack.ps1 b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/unpack.ps1 new file mode 100644 index 0000000000..c208a31858 --- /dev/null +++ b/SET - Data Sets/SET-SCENERY/SET-SCENERY-100 - Scenery Set From Zone/unpack.ps1 @@ -0,0 +1,7 @@ +$dir = split-path -parent $MyInvocation.MyCommand.Definition +cd $dir +$file = Split-Path $dir -leaf +Remove-Item .\_unpacked -Force -Recurse +md "_unpacked" +cd "_unpacked" +. 7z x -r -y "..\$file.miz" *