Finally got MOOSE_CTLD building FOBs like it was supposed to.

This commit is contained in:
iTracerFacer 2024-11-19 09:55:34 -06:00
parent 02253148df
commit 53f810a6b5
5 changed files with 88 additions and 13 deletions

View File

@ -2,6 +2,16 @@
--[ Created by: F99th-TracerFacer
--[ Date: Nov2024
local pointsAwardedTroopsDeployed = 1
local pointsAwardedTroopsExtracted = 1
local pointsAwardedTroopsPickedup = 1
local pointsAwardedTroopsRTB = 1
local pointsAwardedCrateDropped = 1
local pointsAwardedCrateBuilt = 1
local pointsAwardedCrateRepair = 1
local msgTime = 10
-- Setup CTLD for Red and Blue Coalitions
local red_helos = SET_GROUP:New():FilterCoalitions("red"):FilterCategoryHelicopter():FilterStart()
local red_ctld = CTLD:New(coalition.side.RED)
@ -156,30 +166,30 @@ red_ctld:AddCratesCargo("T-90",{"Red-T90"},CTLD_CARGO.Enum.VEHICLE, 1, 8500, 25)
blue_ctld:AddCratesCargo("M1A2",{"Blue-M1A2"},CTLD_CARGO.Enum.VEHICLE, 1, 8500, 25)
-- Add FOBs
red_ctld:AddCratesCargo("Forward Ops Base",{"Red-FOB"},CTLD_CARGO.Enum.FOB, 4, 500, 8)
blue_ctld:AddCratesCargo("Forward Ops Base",{"Blue-FOB"},CTLD_CARGO.Enum.FOB, 4, 500, 8)
red_ctld:AddCratesCargo("Forward Ops Base",{"Red-FOB"},CTLD_CARGO.Enum.FOB, 4, 500, 3)
blue_ctld:AddCratesCargo("Forward Ops Base",{"Blue-FOB"},CTLD_CARGO.Enum.FOB, 4, 500, 3)
-- AA Crates
red_ctld:AddCratesCargo("SA-8",{"SA8"},CTLD_CARGO.Enum.CRATE, 4, 500, 10)
red_ctld:AddCratesCargo("SA-6",{"SA6"},CTLD_CARGO.Enum.CRATE, 4, 500, 10)
red_ctld:AddCratesCargo("SA-10",{"SA10"},CTLD_CARGO.Enum.CRATE, 6, 500, 10)
blue_ctld:AddCratesCargo("Linebacker",{"LINEBACKER"},CTLD_CARGO.Enum.CRATE, 2, 500, 10)
blue_ctld:AddCratesCargo("Hawk Site",{"HAWK"},CTLD_CARGO.Enum.CRATE, 4, 500, 10)
blue_ctld:AddCratesCargo("Patriot Site",{"PATRIOT"},CTLD_CARGO.Enum.CRATE, 6, 500, 10)
blue_ctld:AddCratesCargo("Linebacker",{"LINEBACKER"},CTLD_CARGO.Enum.CRATE, 2, 500, 5)
blue_ctld:AddCratesCargo("Hawk Site",{"HAWK"},CTLD_CARGO.Enum.CRATE, 4, 500, 4)
blue_ctld:AddCratesCargo("Patriot Site",{"PATRIOT"},CTLD_CARGO.Enum.CRATE, 12, 500, 4)
-- Add 6 Red Load Zones
red_ctld:AddCTLDZone("RedLoadZone1", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Red, true, false)
-- Add 6 Red Load Zones that are active but have no beacon.
red_ctld:AddCTLDZone("RedLoadZone1", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Red, true, false)
red_ctld:AddCTLDZone("RedLoadZone2", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Red, true, false)
red_ctld:AddCTLDZone("RedLoadZone3", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Red, true, false)
red_ctld:AddCTLDZone("RedLoadZone4", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Red, true, false)
red_ctld:AddCTLDZone("RedLoadZone5", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Red, true, false)
red_ctld:AddCTLDZone("RedLoadZone6", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Red, true, false)
-- Add 6 Blue Load Zones
-- Add 6 Blue Load Zones that are active but have no beacon.
blue_ctld:AddCTLDZone("BlueLoadZone1", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Blue, true, false)
blue_ctld:AddCTLDZone("BlueLoadZone2", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Blue, true, false)
blue_ctld:AddCTLDZone("BlueLoadZone3", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Blue, true, false)
@ -188,7 +198,6 @@ blue_ctld:AddCTLDZone("BlueLoadZone5", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Blue,
blue_ctld:AddCTLDZone("BlueLoadZone6", CTLD.CargoZoneType.LOAD, SMOKECOLOR.Blue, true, false)
function blue_ctld:OnAfterTroopsDeployed(From,Event,To,Group,Unit,Troops)
if Unit then
local PlayerName = Unit:GetPlayerName()

View File

@ -1,5 +1,5 @@
local ENABLE_SAMS = false -- used for testing purposes. Set to true to enable SAMs, false to disable.
local TAC_DISPLAY = true -- Set to false to disable Tacview display for AI flights (default = false)
local ENABLE_SAMS = true -- used for testing purposes. Set to true to enable SAMs, false to disable.
local TAC_DISPLAY = false -- Set to false to disable Tacview display for AI flights (default = false)
-- How many red/blue aircraft are in the air by default.
local RedA2ADefaultOverhead = 1.5

View File

@ -1,4 +1,4 @@
env.info('*** MOOSE GITHUB Commit Hash ID: 2024-11-11T12:19:49+01:00-fb2ba1dea086b6ae987e67ab7386ced9d6ce33a8 ***')
env.info('*** MOOSE GITHUB Commit Hash ID: 2024-11-18T18:36:47+01:00-75e80a00913b1f49ef1140350f0a2de989939ace ***')
if not MOOSE_DEVELOPMENT_FOLDER then
MOOSE_DEVELOPMENT_FOLDER='Scripts'
end
@ -7458,6 +7458,7 @@ if not Event.IniUnit then
Event.IniUnit=CLIENT:FindByName(Event.IniDCSUnitName,'',true)
end
Event.IniDCSGroupName=Event.IniUnit and Event.IniUnit.GroupName or""
Event.IniGroupName=Event.IniDCSGroupName
if Event.IniDCSGroup and Event.IniDCSGroup:isExist()then
Event.IniDCSGroupName=Event.IniDCSGroup:getName()
Event.IniGroup=GROUP:FindByName(Event.IniDCSGroupName)
@ -106176,6 +106177,9 @@ or Target:IsInstanceOf("SET_STATIC")
or Target:IsInstanceOf("SCENERY")
or Target:IsInstanceOf("SET_SCENERY")then
auftrag=AUFTRAG.Type.BOMBING
elseif Target:IsInstanceOf("OPSZONE")
or Target:IsInstanceOf("SET_OPSZONE")then
auftrag=AUFTRAG.Type.CAPTUREZONE
end
if group then
local category=group:GetCategory()
@ -106208,6 +106212,26 @@ end
end
return auftrag
end
function PLAYERTASK:_CheckCaptureOpsZoneSuccess(OpsZone,CaptureSquadGroupNamePrefix,Coalition,CheckClientInZone)
local isClientInZone=true
if CheckClientInZone then
isClientInZone=false
for _,client in ipairs(self:GetClientObjects())do
local clientCoord=client:GetCoordinate()
if OpsZone.zone:IsCoordinateInZone(clientCoord)then
isClientInZone=true
break
end
end
end
local isCaptureGroupInZone=false
OpsZone:GetScannedGroupSet():ForEachGroup(function(group)
if string.find(group:GetName(),CaptureSquadGroupNamePrefix)then
isCaptureGroupInZone=true
end
end)
return OpsZone:GetOwner()==Coalition and isClientInZone and isCaptureGroupInZone
end
function PLAYERTASK:_SetController(Controller)
self:T(self.lid.."_SetController")
self.TaskController=Controller
@ -106292,6 +106316,34 @@ end,task:GetTarget()
)
return self
end
function PLAYERTASK:AddOpsZoneCaptureSuccessCondition(CaptureSquadGroupNamePrefix,Coalition)
local task=self
task:AddConditionSuccess(
function(target)
if target:IsInstanceOf("OPSZONE")then
return task:_CheckCaptureOpsZoneSuccess(target,CaptureSquadGroupNamePrefix,Coalition,true)
elseif target:IsInstanceOf("SET_OPSZONE")then
local successes=0
local isClientInZone=false
target:ForEachZone(function(opszone)
if task:_CheckCaptureOpsZoneSuccess(opszone,CaptureSquadGroupNamePrefix,Coalition)then
successes=successes+1
end
for _,client in ipairs(task:GetClientObjects())do
local clientCoord=client:GetCoordinate()
if opszone.zone:IsCoordinateInZone(clientCoord)then
isClientInZone=true
break
end
end
end)
return successes==target:Count()and isClientInZone
end
return false
end,task:GetTarget()
)
return self
end
function PLAYERTASK:AddReconSuccessCondition(MinDistance)
local task=self
task:AddConditionSuccess(
@ -106310,6 +106362,19 @@ return false
end,task:GetTarget())
return self
end
function PLAYERTASK:AddTimeLimitFailureCondition(TimeLimit)
local task=self
TimeLimit=TimeLimit or 0
task.StartTime=-1
task:AddConditionFailure(
function()
if task.StartTime==-1 then
task.StartTime=timer.getTime()
end
return TimeLimit>0 and timer.getTime()-task.StartTime>TimeLimit
end)
return self
end
function PLAYERTASK:AddNextTaskAfterSuccess(Task)
self:T(self.lid.."AddNextTaskAfterSuccess")
table.insert(self.NextTaskSuccess,Task)
@ -106721,6 +106786,7 @@ PLAYERTASKCONTROLLER.Scores={
[AUFTRAG.Type.RECON]=100,
[AUFTRAG.Type.ESCORT]=100,
[AUFTRAG.Type.CAP]=100,
[AUFTRAG.Type.CAPTUREZONE]=100,
}
PLAYERTASKCONTROLLER.SeadAttributes={
SAM=GROUP.Attribute.GROUND_SAM,
@ -123137,7 +123203,7 @@ timer.scheduleFunction(os.remove,filename,timer.getTime()+1)
timer.scheduleFunction(os.remove,filenvbs,timer.getTime()+1)
self:T("MSRS vbs and batch file removed")
elseif self.UsePowerShell==true then
local pwsh=string.format('powershell.exe -ExecutionPolicy Unrestricted -WindowStyle Hidden -Command "%s"',filename)
local pwsh=string.format('start /min "" powershell.exe -ExecutionPolicy Unrestricted -WindowStyle Hidden -Command "%s"',filename)
if string.len(pwsh)>255 then
self:E("[MSRS] - pwsh string too long")
end