Advertisement
morrtz

DCS Objective Manager

Jul 3rd, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.71 KB | None | 0 0
  1. local ObjectiveGroups =
  2. {
  3. ['FACTORY'] =
  4.         {
  5.         ['OIL'] =
  6.                 {
  7.                 ['Nalchik Oil Station'] = {"Nalchik Oil Tank #001","Nalcik Oil Tank #002","Nalchik Oil CP","Nalchik Oil Barraks"},
  8.                 ['Mozdok Oil Station'] = {"Mozdok Oil Tank #001","Mozdok Oil Tank #002","Mozdok Oil CP","Mozdok Oil Barraks"},
  9.                 },
  10.         ['METAL'] =
  11.                 {
  12.                 ['Nalchik Metal Workshop'] = "",
  13.                 ['Gali Metal Workshop'] = "",
  14.                 ['Zugdidi Metal Workshop'] = "",
  15.                 },
  16.         ['AMMUNITION'] =
  17.                 {
  18.                 },
  19.         ['ELECTRIC'] =
  20.                 {
  21.                 },
  22.         ['NUCLEAR'] =
  23.                 {
  24.                 },
  25.         },
  26. ['RADAR'] =
  27.         {
  28.         ['HEWS'] = --High Early Warning System
  29.                 {
  30.                 ['Nalchik HEWS'] = "",
  31.                 ['Vaziani HEWS'] = "",
  32.                 },
  33.         ['LEWS'] = --Low Early Warning System
  34.                 {
  35.                 ['Nalchik HEWS'] = "",
  36.                 ['Vaziani HEWS'] = "",
  37.                 },
  38.         },
  39. ['ARMY'] =
  40.         {
  41.         ['ARMYBASE'] =
  42.                 {
  43.                 ['Nalchik Armybase'] = "",
  44.                 ['Vaziani Armybase'] = "",
  45.                 },
  46.         ['FARP'] =
  47.                 {
  48.                 ['London'] = "",
  49.                 ['Vetka'] = "",
  50.                 },
  51.         ['CP'] =
  52.                 {
  53.                 ['Nalchik CP'] = "",
  54.                 ['Vaziani CP'] = "",
  55.                 },
  56.         ['AIRBASE'] =
  57.                 {
  58.                 ['Gelendzhik'] = {},
  59.                 ['Novorossiysk'] = {},
  60.                 ['Krymsk'] = {},
  61.                 ['Anapa-Vityazevo'] = {},
  62.                 ['Krasnodar-Center'] = {},
  63.                 ['Krasnodar-Pashkovsky'] = {},
  64.                 ['Maykop-Khanskaya'] = {},
  65.                 ['Sochi-Adler'] = {},
  66.                 ['Gudauta'] = {},
  67.                 ['Sukhumi-Babushara'] = {},
  68.                 ['Senaki-Kolkhi'] = {},
  69.                 ['Kutaisi'] = {},
  70.                 ['Kobuleti'] = {},
  71.                 ['Batumi'] = {},
  72.                 ['Mineralnye Vody'] = {},
  73.                 ['Nalchik'] = {},
  74.                 ['Mozdok'] = {},
  75.                 ['Beslan'] = {},
  76.                 ['Tblisi=Lochini'] = {},
  77.                 ['Soganlug'] = {},
  78.                 ['Vaziani'] = {},
  79.                 },
  80.         },
  81. }
  82.  
  83. local CoaObj =
  84. {
  85. ['red'] =
  86.     {
  87.     ['FACTORY'] =
  88.         {
  89.         ['OIL'] = {"Nalchik Oil Station", "Nalchik Oil Station"},
  90.         ['METAL'] = {"Nalchik Metal Workshop","Gali Metal Workshop","Zugdidi Metal Workshop"},
  91.         ['AMMUNITION'] = {"Mozdok Ammo","Gori Ammo"},
  92.         ['ELECTRIC'] = {"Gali Electric","Zugdidi Electric"},
  93.         ['NUCLEAR'] = {"Poti Nuclear","Gelendzhik Nuclear"},
  94.         },
  95.     ['RADAR'] =
  96.         {
  97.         ['HEWS'] = {"Nalchik HEWS","Vaziani HEWS"}, --High Early Warning System
  98.         ['LEWS'] = {"Nalchik HEWS","Vaziani HEWS"}, --Low Early Warning System
  99.         },
  100.     ['ARMY'] =
  101.         {
  102.         ['ARMYBASE'] = {"Nalchik Armybase","Vaziani Armybase"},
  103.         ['FARP'] = {"London","Vetka"},
  104.         ['CP'] = {"Nalchik CP","Vaziani CP"},
  105.         ['AIRBASE'] = {"Gelendzhik","Novorossiysk","Krymsk","Anapa-Vityazevo","Krasnodar-Center","Krasnodar-Pashkovsky","Maykop-Khanskaya","Sochi-Adler","Gudauta","Sukhumi-Babushara","Senaki-Kolkhi","Kutaisi","Kobuleti","Batumi","Mineralnye Vody","Nalchik","Mozdok","Beslan","Tblisi=Lochini","Soganlug","Vaziani"}
  106.         },
  107.     },
  108. ['blue'] =
  109.     {
  110.     ['FACTORY'] =
  111.         {
  112.         ['OIL'] = {"Nalchik Oil Station", "Nalchik Oil Station"},
  113.         ['METAL'] = {"Nalchik Metal Workshop","Gali Metal Workshop","Zugdidi Metal Workshop"},
  114.         ['AMMUNITION'] = {"Mozdok Ammo","Gori Ammo"},
  115.         ['ELECTRIC'] = {"Gali Electric","Zugdidi Electric"},
  116.         ['NUCLEAR'] = {"Poti Nuclear","Gelendzhik Nuclear"},
  117.         },
  118.     ['RADAR'] =
  119.         {
  120.         ['HEWS'] = {"Nalchik HEWS","Vaziani HEWS"}, --High Early Warning System
  121.         ['LEWS'] = {"Nalchik HEWS","Vaziani HEWS"}, --Low Early Warning System
  122.         },
  123.     ['ARMY'] =
  124.         {
  125.         ['ARMYBASE'] = {"Nalchik Armybase","Vaziani Armybase"},
  126.         ['FARP'] = {"London","Vetka"},
  127.         ['CP'] = {"Nalchik CP","Vaziani CP"},
  128.         ['AIRBASE'] = {"Gelendzhik","Novorossiysk","Krymsk","Anapa-Vityazevo","Krasnodar-Center","Krasnodar-Pashkovsky","Maykop-Khanskaya","Sochi-Adler","Gudauta","Sukhumi-Babushara","Senaki-Kolkhi","Kutaisi","Kobuleti","Batumi","Mineralnye Vody","Nalchik","Mozdok","Beslan","Tblisi=Lochini","Soganlug","Vaziani"}
  129.         },
  130.     },
  131. }
  132.    
  133. local moral =
  134. {
  135. ['red'] =
  136.     {
  137.     ['BUILDING'] = "",
  138.     ['PLANE'] = "",
  139.     ['VEHICLE'] = "",
  140.     },
  141. ['blue'] =
  142.     {
  143.     ['BUILDING'] = "",
  144.     ['PLANE'] = "",
  145.     ['VEHICLE'] = "",
  146.     },
  147. }
  148.  
  149.  
  150. --Manage Ground movement
  151. local polyzone =
  152. {
  153.     ["red"] =
  154.     {
  155.         [1] = 'Kutaisi-Senaki'
  156.     },
  157.     ["blue"] =
  158.     {
  159.         [5] = 'Senaki-Kutaisi'
  160.     }
  161. }
  162.  
  163.  
  164. local AutoMovement =
  165. {
  166. ["stop"] = ,
  167. ["path"] =
  168.     {
  169.     ["red"] = ,
  170.     ["blue"] = ,
  171.     },
  172. }
  173.  
  174. function ManageMove()
  175. for
  176. if trigger.misc.getUserFlag(i)
  177.  
  178.  
  179. function GoToRoute(path)
  180.     for GName, GTable in pairs(mist.DBs.groupsByName) do
  181.         if GTable.category == "vehicle" then
  182.             local unit = GTable.unitName
  183.             local pos = unit:getPosition().p
  184.             local zone = mist.getGroupPoints(polyzone[path])
  185.             if mist.pointInPolygon(pos, zone) then
  186.                 ReturnToRoute(GName,path)
  187.             end
  188.         end
  189.     end
  190. end
  191.  
  192. for coa,data in pairs(polyzone) do
  193.     for i,name in pairs(data) do
  194.         if coa = "red" then
  195.             mist.flagFunc.units_in_polygon
  196.             {
  197.             units = {'[red][helicopter]','[red][plane]'},
  198.             zone = mist.getGroupPoints(polyzone.red[i]),
  199.             flag = i,
  200.             req_num = 1,
  201.             interval = 10,
  202.             toggle = true
  203.             }
  204.         elseif coa = "blue" then
  205.             mist.flagFunc.units_in_polygon
  206.             {
  207.             units = {'[blue][helicopter]','[blue][plane]'},
  208.             zone = mist.getGroupPoints(polyzone.blue[i]),
  209.             flag = i,
  210.             req_num = 1,
  211.             interval = 10,
  212.             toggle = true
  213.             }
  214.         end
  215.     end
  216. end
  217.  
  218.  
  219. ReturnToRoute ('blue #001', "path" )
  220. ReturnToRoute ('blue', "path" )
  221. ReturnToRoute ('blue #001', "path #001" )
  222. ReturnToRoute ('blue', "path #001" )
  223.  
  224.  
  225.  
  226. mist.groupRandomDistSelf("Red", 5)
  227. mist.groupRandomDistSelf("Red #001", 5)
  228.  
  229.  
  230. end
  231.  
  232.  
  233. --Get trigger zone V3 point.
  234. function getObjV3(ObName)
  235.     local tZone = trigger.misc.getZone(ObName)
  236.     local tZonepos = {}
  237.     local tZoneposx = tZone.point.x
  238.     local tZoneposz = tZone.point.z
  239.     local tZoneposy = land.getHeight({x = tZone.point.x, y = tZone.point.z})
  240.     local tZoneV3 = {x=tZoneposx, y=tZoneposy, z=tZoneposz}
  241.     return tZoneV3
  242. end
  243.  
  244. --Get distance between 2 V3 points.
  245. function getDistV3(1V3,2V3)
  246.     local pointX = 1V3.x - 2V3.x
  247.     local pointZ = 1V3.z - 2V3.z
  248.     return (pointX^2 + pointZ^2)^0.5
  249. end
  250.  
  251. --Assign Objective to Coalition
  252. function AssignCoaObj(ObjName,Coa)
  253.     if not Coa then
  254.             CoaObj[Coa][
  255.     elseif Coa == "red" then
  256.    
  257.     elseif Coa == "blue" then
  258.    
  259.     end
  260. end
  261.     for FCat, ListFTypes in pairs(ObjectiveGroups) do
  262.        
  263.        
  264.  
  265.  
  266. end
  267.  
  268. --Deactivating Facilities before they expload to remove burned buildings.
  269. function DeactivateFacility()
  270.     for coalition, bases in pairs(deactivateUnits) do
  271.         for base, units in pairs(bases) do
  272.             for index, unit in pairs(units) do
  273.                 if Unit.getByName(unit) then
  274.                     Unit.getByName(unit):destroy()
  275.                 end
  276.             end
  277.         end
  278.     end
  279.    
  280.     for i, group in pairs(VDatabase) do
  281.         for j, v in pairs(group.units) do
  282.             local unit = Unit.getByName(v.name)
  283.             if unit and unit:getLife() <= 1 then
  284.                 local unitpos = unit:getPoint()
  285.                 unit:destroy()
  286.                 trigger.action.explosion(unitpos, 3)
  287.             end
  288.         end
  289.     end
  290. end
  291.  
  292.  
  293.  
  294. function getObjLifeList()
  295. For ObCat, ListObTypes in pairs(ObjectiveGroups) do
  296.     For ObType, ListObNames in pairs(ListObTypes) do
  297.         For ObName, Life in pairs(ListObNames) do
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement