Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.10 KB | None | 0 0
  1. local Blue_CC = COMMANDCENTER:New( GROUP:FindByName( "Blue HQ"), "HQ" )
  2. local Red_CC = COMMANDCENTER:New( GROUP:FindByName( "Red HQ"), "HQ" )
  3.  
  4. RedDetectionSetGroup = SET_GROUP:New():FilterPrefixes({ "Red EWR" }):FilterCoalitions(coalition.side.BLUE):FilterStart()
  5. BlueDetectionSetGroup = SET_GROUP:New():FilterPrefixes({ "Blue EWR" }):FilterCoalitions(coalition.side.RED):FilterStart()
  6.  
  7. Red_DetectionSetZones = SET_ZONE:New():FilterPrefixes("Red Zone"):FilterStart()
  8. Blue_DetectionZones = DETECTION_ZONES:New( Red_DetectionSetZones, coalition.side.RED ):FilterCategories( Unit.Category.GROUND_UNIT )
  9. Blue_DetectionZones:Start()
  10.  
  11. Red_DetectionArea = DETECTION_AREAS:New( RedDetectionSetGroup, 30000)
  12. Red_DetectionArea:Start()
  13.  
  14. Blue_DetectionArea = DETECTION_AREAS:New(BlueDetectionSetGroup, 30000)
  15. Blue_DetectionArea:Start()
  16.  
  17. --SCHEDULER:New(nil, checkDetectedCount, {Blue_DetectionZones, "ground", blueClientA2GGroupSet}, 1, 10)
  18.  
  19. local zone = ZONE:New("Patrol Zone 2")
  20. local AICAPZone = true
  21.  
  22.  
  23. BlueA2ADispatcher = AI_A2A_CAP_ZONE:New(Blue_DetectionArea, AICAPZone)
  24. BlueA2ADispatcher:SetSquadron("F-5E-01", AIRBASE.Caucasus.Senaki_Kolkhi, { "F-5E CAP"}, 2)
  25. BlueA2ADispatcher:SetSquadronFuelThreshold("F-5E-01", 0.25)
  26. BlueA2ADispatcher:SetSquadronCap( "F-5E-01", zone, 4000, 10000, 500, 600, 800, 900 )
  27. BlueA2ADispatcher:SetSquadronCapInterval( "F-5E-01", 2, 30, 60, 1 )
  28. BlueA2ADispatcher:SetTacticalDisplay(true)
  29. BlueA2ADispatcher:SetDisengageRadius(100000)
  30. BlueA2ADispatcher:SetDefaultDamageThreshold(0.75)
  31. BlueA2ADispatcher:SetDefaultGrouping(2)
  32.  
  33. A2ADispatcher = AI_A2A_CAP_ZONE:New(Red_DetectionArea, AICAPZone)
  34.  
  35. local RedSquadrons = {
  36.     "MiG-19 CAP",
  37.     "MiG-21 CAP"
  38. }
  39.  
  40. local RandomAirframe = RedSquadrons[math.random(1, #RedSquadrons)]
  41.  
  42. A2ADispatcher:SetSquadron("MiG-19-01", AIRBASE.Caucasus.Kobuleti, { RandomAirframe }, 10)
  43. A2ADispatcher:SetSquadronFuelThreshold("MiG-19-01", 0.25)
  44. A2ADispatcher:SetSquadronCap( "MiG-19-01", zone, 35000, 70000, 800, 900, 800, 900 )
  45. A2ADispatcher:SetSquadronCapInterval( "MiG-19-01", 1, 30, 60, 1 )
  46. A2ADispatcher:SetTacticalDisplay(true)
  47. A2ADispatcher:SetDisengageRadius(10000000)
  48. A2ADispatcher:SetDefaultDamageThreshold(0.75)
  49. A2ADispatcher:SetDefaultGrouping(2)
  50.  
  51. local MiG19GroupSet = SET_GROUP:New():FilterPrefixes("MiG-19 CAP"):FilterStart()
  52. local PatrolZoneSet = SET_ZONE:New():FilterPrefixes("Patrol Zone"):FilterStart()
  53.  
  54. function UpdatePatrol(MiG19GroupSet, PatrolZoneSet)
  55.     local MiG19GroupSet = MiG19GroupSet
  56.     local PatrolZoneSet = PatrolZoneSet
  57.  
  58.     local RandomPatrolZone = PatrolZoneSet:GetRandomZone()
  59.  
  60.     BASE:E("MiG19 Count " .. MiG19GroupSet:Count())
  61.     MiG19GroupSet:ForEachGroup(
  62.         function(Group)
  63.             if Group ~= nil then
  64.                 BASE:E("MiG19 Group " .. Group:GetName())
  65.                
  66.                 if Group:GetName() ~= "MiG-19 CAP" then
  67.                     local A2AFsm = A2ADispatcher:GetDefenderTaskFsm(Group)
  68.                     A2AFsm:UpdatePatrol(RandomPatrolZone)
  69.                 end
  70.             end
  71.         end
  72.     )
  73. end
  74.  
  75. --SCHEDULER:New(nil, UpdatePatrol, {MiG19GroupSet, PatrolZoneSet}, 1, 300)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement