mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
Added new options
Added new HAWK launcher config Added new option to allow one Stinger / IGLA with a soldier group
This commit is contained in:
parent
f01f25dc35
commit
e2968fd7de
120
CTLD.lua
120
CTLD.lua
@ -10,13 +10,9 @@
|
||||
|
||||
See https://github.com/ciribob/DCS-CTLD for a user manual and the latest version
|
||||
|
||||
Version: 1.17 - 20/06/2015 - Bug fix for Rearming hawk
|
||||
- Bug fix for smoke spawning IN the ground?!
|
||||
- Bug fix for smoke disable for extractZones
|
||||
Version: 1.18 - 20/06/2015
|
||||
- Enabled multi crate units
|
||||
- Added CountInZone for Cargo with Flag
|
||||
- Added Extract Zone with Flag
|
||||
- Added Create Beacon using Mission Edtor
|
||||
- Added new parameter for the number of launchers to spawn a HAWK with
|
||||
|
||||
|
||||
TODO Support for Spotter Groups
|
||||
@ -26,8 +22,7 @@
|
||||
- Report status every 5 minutes or when targets first appear
|
||||
- Report vague status like 5 armoured vehicles, soldiers and support trucks ??
|
||||
|
||||
TODO Make HAWK have three launchers, it fires all 3 off most times
|
||||
TODO Make hawk only engage closer targets
|
||||
TODO Make hawk only engage closer targets?
|
||||
|
||||
]]
|
||||
|
||||
@ -77,8 +72,8 @@ ctld.enabledRadioBeaconDrop = true -- if its set to false then beacons cannot be
|
||||
|
||||
-- ***************** JTAC CONFIGURATION *****************
|
||||
|
||||
ctld.JTAC_LIMIT_RED = 5 -- max number of JTAC Crates for the RED Side
|
||||
ctld.JTAC_LIMIT_BLUE = 5 -- max number of JTAC Crates for the BLUE Side
|
||||
ctld.JTAC_LIMIT_RED = 10 -- max number of JTAC Crates for the RED Side
|
||||
ctld.JTAC_LIMIT_BLUE = 10 -- max number of JTAC Crates for the BLUE Side
|
||||
|
||||
ctld.JTAC_dropEnabled = true -- allow JTAC Crate spawn from F10 menu
|
||||
|
||||
@ -282,7 +277,9 @@ ctld.spawnableCrates = {
|
||||
{ weight = 1500, desc = "SKP-11 - JTAC", unit = "SKP-11", side = 1, }, -- used as jtac and unarmed, not on the crate list if JTAC is disabled
|
||||
|
||||
{ weight = 200, desc = "2B11 Mortar", unit = "2B11 mortar" },
|
||||
{ weight = 500, desc = "M-109", unit = "M-109", cratesRequired = 5 },
|
||||
|
||||
{ weight = 500, desc = "SPH 2S19 Msta", unit = "SAU Msta", side=1, cratesRequired = 3 },
|
||||
{ weight = 501, desc = "M-109", unit = "M-109", side=2, cratesRequired = 3 },
|
||||
},
|
||||
["AA Crates"] = {
|
||||
{ weight = 210, desc = "Stinger", unit = "Stinger manpad", side = 2 },
|
||||
@ -291,11 +288,14 @@ ctld.spawnableCrates = {
|
||||
{ weight = 1000, desc = "HAWK Launcher", unit = "Hawk ln" },
|
||||
{ weight = 1010, desc = "HAWK Search Radar", unit = "Hawk sr" },
|
||||
{ weight = 1020, desc = "HAWK Track Radar", unit = "Hawk tr" },
|
||||
{ weight = 505, desc = "M6 Linebacker", unit = "M6 Linebacker", cratesRequired = 5 },
|
||||
--
|
||||
|
||||
{ weight = 505, desc = "Strela-1 9P31", unit = "Strela-1 9P31", side =1, cratesRequired = 4 },
|
||||
{ weight = 506, desc = "M1097 Avenger", unit = "M1097 Avenger", side =2, cratesRequired = 4 },
|
||||
},
|
||||
}
|
||||
|
||||
-- if the unit is on this list, it will be made into a JTAC
|
||||
-- if the unit is on this list, it will be made into a JTAC when deployed
|
||||
ctld.jtacUnitTypes = {
|
||||
"SKP", "Hummer" -- there are some wierd encoding issues so if you write SKP-11 it wont match as the - sign is encoded differently...
|
||||
}
|
||||
@ -393,13 +393,13 @@ function ctld.cratesInZone(_zone, _flagNumber)
|
||||
local _zonePos = mist.utils.zoneToVec3(_zone)
|
||||
|
||||
--ignore side, if crate has been used its discounted from the count
|
||||
local _crateTables = {ctld.spawnedCratesRED,ctld.spawnedCratesBLUE }
|
||||
local _crateTables = {ctld.spawnedCratesRED,ctld.spawnedCratesBLUE,ctld.missionEditorCargoCrates }
|
||||
|
||||
local _crateCount = 0
|
||||
|
||||
for _,_crates in pairs(_crateTables) do
|
||||
|
||||
for _crateName, _details in pairs(_crates) do
|
||||
for _crateName, _dontUse in pairs(_crates) do
|
||||
|
||||
--get crate
|
||||
local _crate = StaticObject.getByName(_crateName)
|
||||
@ -2231,12 +2231,7 @@ function ctld.rearmHawk(_heli, _nearestCrate, _nearbyCrates)
|
||||
|
||||
if _nearestHawk ~= nil and _nearestHawk.dist < 300 then
|
||||
|
||||
if _heli:getCoalition() == 1 then
|
||||
ctld.spawnedCratesRED[_nearestCrate.crateUnit:getName()] = nil
|
||||
else
|
||||
ctld.spawnedCratesBLUE[_nearestCrate.crateUnit:getName()] = nil
|
||||
end
|
||||
|
||||
local _uniqueTypes = {} -- stores each unique part of hawk, should always be 3
|
||||
local _types = {}
|
||||
local _points = {}
|
||||
|
||||
@ -2246,13 +2241,17 @@ function ctld.rearmHawk(_heli, _nearestCrate, _nearbyCrates)
|
||||
|
||||
for x = 1, #_units do
|
||||
if _units[x]:getLife() > 0 then
|
||||
table.insert(_types, _units[x]:getTypeName())
|
||||
|
||||
--this allows us to count each type once
|
||||
_uniqueTypes[_units[x]:getTypeName()]=_units[x]:getTypeName()
|
||||
|
||||
table.insert(_points, _units[x]:getPoint())
|
||||
table.insert(_types, _units[x]:getTypeName())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #_types == 3 and #_points == 3 then
|
||||
if ctld.countTableEntries(_uniqueTypes) == 3 and #_points >= 3 then
|
||||
|
||||
-- rearm hawk
|
||||
-- destroy old group
|
||||
@ -2266,6 +2265,13 @@ function ctld.rearmHawk(_heli, _nearestCrate, _nearbyCrates)
|
||||
|
||||
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " successfully rearmed a full HAWK AA System in the field", 10)
|
||||
|
||||
-- remove crate
|
||||
if _heli:getCoalition() == 1 then
|
||||
ctld.spawnedCratesRED[_nearestCrate.crateUnit:getName()] = nil
|
||||
else
|
||||
ctld.spawnedCratesBLUE[_nearestCrate.crateUnit:getName()] = nil
|
||||
end
|
||||
|
||||
return true -- all done so quit
|
||||
end
|
||||
end
|
||||
@ -2274,6 +2280,23 @@ function ctld.rearmHawk(_heli, _nearestCrate, _nearbyCrates)
|
||||
return false
|
||||
end
|
||||
|
||||
function ctld.countTableEntries(_table)
|
||||
|
||||
if _table == nil then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local _count = 0
|
||||
|
||||
for _key,_value in pairs(_table) do
|
||||
|
||||
_count = _count +1
|
||||
end
|
||||
|
||||
return _count
|
||||
end
|
||||
|
||||
function ctld.unpackHawk(_heli, _nearestCrate, _nearbyCrates)
|
||||
|
||||
if ctld.rearmHawk(_heli, _nearestCrate, _nearbyCrates) then
|
||||
@ -2315,9 +2338,31 @@ function ctld.unpackHawk(_heli, _nearestCrate, _nearbyCrates)
|
||||
_txt = _txt .. "Missing HAWK Track Radar\n"
|
||||
end
|
||||
else
|
||||
|
||||
--handle multiple launchers from one crate
|
||||
if _name == "Hawk ln" and ctld.hawkLaunchers > 1 then
|
||||
|
||||
--add multiple launchers
|
||||
for _i=1,ctld.hawkLaunchers do
|
||||
|
||||
-- spawn in a circle around the crate
|
||||
local _angle = math.pi * 2 * (_i - 1) / ctld.hawkLaunchers
|
||||
local _xOffset = math.cos(_angle) * 10
|
||||
local _yOffset = math.sin(_angle) * 10
|
||||
|
||||
local _point = _hawkPart.crateUnit:getPoint()
|
||||
|
||||
_point = {x = _point.x + _xOffset, y=_point.y, z= _point.z + _yOffset}
|
||||
|
||||
table.insert(_posArray, _point)
|
||||
table.insert(_typeArray, "Hawk ln")
|
||||
end
|
||||
else
|
||||
table.insert(_posArray, _hawkPart.crateUnit:getPoint())
|
||||
table.insert(_typeArray, _name)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if _txt ~= "" then
|
||||
@ -3905,6 +3950,8 @@ ctld.crateLookupTable = {}
|
||||
|
||||
ctld.extractZones = {} -- stored extract zones
|
||||
|
||||
ctld.missionEditorCargoCrates = {} --crates added by mission editor for triggering cratesinzone
|
||||
|
||||
-- Remove intransit troops when heli / cargo plane dies
|
||||
--ctld.eventHandler = {}
|
||||
--function ctld.eventHandler:onEvent(_event)
|
||||
@ -3972,6 +4019,33 @@ for _, _groupName in pairs(ctld.extractableGroups) do
|
||||
end
|
||||
end
|
||||
|
||||
-- Add Mission editor added crates
|
||||
-- Crates are NOT returned by coalition.getStaticObjects()
|
||||
--local _objects = coalition.getStaticObjects(1)
|
||||
--if _objects ~= nil then
|
||||
-- for _, _static in pairs(_objects) do
|
||||
--
|
||||
-- env.info("RED:".._static:getTypeName())
|
||||
-- if _static:getTypeName() == "Cargo1" then
|
||||
--
|
||||
-- ctld.missionEditorCargoCrates[ _static:getName()] = _static:getName();
|
||||
-- end
|
||||
-- end
|
||||
--end
|
||||
--
|
||||
--local _objects = coalition.getStaticObjects(2)
|
||||
--
|
||||
--if _objects ~= nil then
|
||||
-- for _, _static in pairs(_objects) do
|
||||
--
|
||||
-- env.info("BLUE:".._static:getTypeName())
|
||||
-- if _static:getTypeName() == "Cargo1" then
|
||||
--
|
||||
-- ctld.missionEditorCargoCrates[ _static:getName()] = _static:getName();
|
||||
-- end
|
||||
-- end
|
||||
--end
|
||||
|
||||
|
||||
-- Scheduled functions (run cyclically)
|
||||
|
||||
|
||||
38
README.md
38
README.md
@ -7,6 +7,7 @@ The script supports:
|
||||
|
||||
* Troop Loading / Unloading via Radio Menu
|
||||
* AI Units can also load and unload troops automatically
|
||||
* Troops can spawn with RPGs and Stingers / Iglas if enabled.
|
||||
* Vehicle Loading / Unloading via Radio Menu for C-130 / IL-76 (Other large aircraft can easily be added) (https://www.digitalcombatsimulator.com/en/files/668878/?sphrase_id=1196134)
|
||||
* You will need to download the modded version of the C-130 from here (JSGME Ready) that fixes the Radio Menu
|
||||
* Coloured Smoke Marker Drops
|
||||
@ -78,7 +79,10 @@ ctld.numberOfTroops = 10 -- default number of troops to load on a transport heli
|
||||
ctld.vehiclesForTransportRED = { "BRDM-2", "BTR_D" } -- vehicles to load onto Il-76 - Alternatives {"Strela-1 9P31","BMP-1"}
|
||||
ctld.vehiclesForTransportBLUE = { "M1045 HMMWV TOW", "M1043 HMMWV Armament" } -- vehicles to load onto c130 - Alternatives {"M1128 Stryker MGS","M1097 Avenger"}
|
||||
|
||||
ctld.hawkLaunchers = 3 -- controls how many launchers to add to the hawk when its spawned.
|
||||
|
||||
ctld.spawnRPGWithCoalition = true --spawns a friendly RPG unit with Coalition forces
|
||||
ctld.spawnStinger = false -- spawns a stinger / igla soldier with every group of 5 or more men.
|
||||
|
||||
ctld.enabledFOBBuilding = true -- if true, you can load a crate INTO a C-130 than when unpacked creates a Forward Operating Base (FOB) which is a new place to spawn (crates) and carry crates from
|
||||
-- In future i'd like it to be a FARP but so far that seems impossible...
|
||||
@ -94,7 +98,7 @@ ctld.buildTimeFOB = 120 --time in seconds for the FOB to be built
|
||||
ctld.radioSound = "beacon.ogg" -- the name of the sound file to use for the FOB radio beacons. If this isnt added to the mission BEACONS WONT WORK!
|
||||
ctld.radioSoundFC3 = "beaconsilent.ogg" -- name of the second silent radio file, used so FC3 aircraft dont hear ALL the beacon noises... :)
|
||||
|
||||
ctld.deployedBeaconBattery = 15 -- the battery on deployed beacons will last for this number minutes before needing to be re-deployed
|
||||
ctld.deployedBeaconBattery = 20 -- the battery on deployed beacons will last for this number minutes before needing to be re-deployed
|
||||
|
||||
ctld.enabledRadioBeaconDrop = true -- if its set to false then beacons cannot be dropped by units
|
||||
```
|
||||
@ -109,10 +113,8 @@ To change what units can be dropped from crates modify the spawnable crates sect
|
||||
-- when we unpack
|
||||
--
|
||||
ctld.spawnableCrates = {
|
||||
|
||||
-- name of the sub menu on F10 for spawning crates
|
||||
["Ground Forces"] = {
|
||||
|
||||
--crates you can spawn
|
||||
-- weight in KG
|
||||
-- Desc is the description on the F10 MENU
|
||||
@ -130,21 +132,24 @@ ctld.spawnableCrates = {
|
||||
{ weight = 1500, desc = "SKP-11 - JTAC", unit = "SKP-11", side = 1, }, -- used as jtac and unarmed, not on the crate list if JTAC is disabled
|
||||
|
||||
{ weight = 200, desc = "2B11 Mortar", unit = "2B11 mortar" },
|
||||
-- { weight = 500, desc = "M-109", unit = "M-109", cratesRequired = 3 },
|
||||
|
||||
{ weight = 500, desc = "SPH 2S19 Msta", unit = "SAU Msta", side=1, cratesRequired = 3 },
|
||||
{ weight = 501, desc = "M-109", unit = "M-109", side=2, cratesRequired = 3 },
|
||||
},
|
||||
|
||||
["AA Crates"] = {
|
||||
|
||||
{ weight = 210, desc = "Stinger", unit = "Stinger manpad", side = 2 },
|
||||
{ weight = 215, desc = "Igla", unit = "SA-18 Igla manpad", side = 1 },
|
||||
|
||||
{ weight = 1000, desc = "HAWK Launcher", unit = "Hawk ln" },
|
||||
{ weight = 1010, desc = "HAWK Search Radar", unit = "Hawk sr" },
|
||||
{ weight = 1020, desc = "HAWK Track Radar", unit = "Hawk tr" },
|
||||
-- { weight = 505, desc = "M6 Linebacker", unit = "M6 Linebacker", cratesRequired = 3 },
|
||||
},
|
||||
--
|
||||
|
||||
{ weight = 505, desc = "Strela-1 9P31", unit = "Strela-1 9P31", side =1, cratesRequired = 4 },
|
||||
{ weight = 506, desc = "M1097 Avenger", unit = "M1097 Avenger", side =2, cratesRequired = 4 },
|
||||
},
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Example showing what happens if you dont have enough crates:
|
||||
@ -212,6 +217,8 @@ The flag number can be used to trigger other actions added using the mission edi
|
||||
|
||||
**The script doesnt differentiate between crates, any crate spawned by the CTLD script can be dropped there and it will count as 1 but if a crate is unpacked in a zone it will no longer count! **
|
||||
|
||||
**Crates added by the Mission Editor cannot be used, only crates spawned by the Script will work!**
|
||||
|
||||
A crate drop zone can be added to any zone by adding a Trigger Once with a Time More set to any time after the CTLD script has been loaded and a DO SCRIPT action of ```ctld.cratesInZone("crateZone",1)```
|
||||
|
||||
Where ```"crateZone"``` is the name of a Trigger Zone added using the mission editor, and ```1``` is the number of the flag where the current number of crates in the zone will be stored.
|
||||
@ -224,8 +231,8 @@ The JTAC Script configuration is shown below and can easily be disabled using th
|
||||
|
||||
```lua
|
||||
-- ***************** JTAC CONFIGURATION *****************
|
||||
ctld.JTAC_LIMIT_RED = 5 -- max number of JTAC Crates for the RED Side
|
||||
ctld.JTAC_LIMIT_BLUE = 5 -- max number of JTAC Crates for the BLUE Side
|
||||
ctld.JTAC_LIMIT_RED = 10 -- max number of JTAC Crates for the RED Side
|
||||
ctld.JTAC_LIMIT_BLUE = 10 -- max number of JTAC Crates for the BLUE Side
|
||||
|
||||
ctld.JTAC_dropEnabled = true -- allow JTAC Crate spawn from F10 menu
|
||||
|
||||
@ -329,6 +336,15 @@ ctld.pickupZones = {
|
||||
|
||||
AI transport units will automatically load troops and vehicles when entering a pickup zone as long as they stay in the zone for a few seconds. They do not need to stop to load troops but Aircraft will need to be on the ground in order to load troops.
|
||||
|
||||
The number of troops that can be loaded from a pickup zone can be configured by changing ```ctld.numberOfTroops``` which by default is 10. You can also enable troop groups to have RPGs and Stingers / Iglas by ```ctld.spawnRPGWithCoalition``` and ```ctld.spawnStinger```.
|
||||
|
||||
If ```ctld.numberOfTroops``` is 6 or more than the soldier group will consist of:
|
||||
|
||||
- 2 MG Soldiers with M249s or Paratroopers with AKS-74
|
||||
- 2 RPG Soldiers (only on the RED side if ```ctld.spawnRPGWithCoalition``` is ```false```
|
||||
- 1 Igla / Stinger
|
||||
- The rest will be standard soldiers
|
||||
|
||||
Example:
|
||||

|
||||
|
||||
@ -449,7 +465,7 @@ You can also list nearby crates that have yet to be unpacked using the F10 CTLD
|
||||
##Crate Unpacking
|
||||
Once you have sling loaded and successfully dropped your crate, you can land and list nearby crates that have yet to be unpacked using the F10 Crate Commands Menu, as well as unpack nearby crates using the same menu. Crates cannot be unpacked near a logistics unit.
|
||||
|
||||
To build a HAWK AA system you will need to slingload all 3 parts - Launcher, Track Radar and Search Radar - and drop the crates within 100m of each other. If you try to build the system without all the parts, a message will list which parts are missing.
|
||||
To build a HAWK AA system you will need to slingload all 3 parts - Launcher, Track Radar and Search Radar - and drop the crates within 100m of each other. If you try to build the system without all the parts, a message will list which parts are missing. The HAWK system by default will spawn with 3 launchers as it usually fires off 3 missiles at one target at a time. If you want to change the amount of launchers it has, edit the ```ctld.hawkLaunchers``` option in the user configuration at the top of the CTLD.lua file.
|
||||
|
||||
Parts Missing:
|
||||

|
||||
|
||||
Binary file not shown.
BIN
test-mission.miz
BIN
test-mission.miz
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user