mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
Pickup Zones Modified
Added option to activate / deactivate zone during mission Added coalition to zones so the other team can't pick up from your zone. UNTESTED - Written while at work
This commit is contained in:
137
CTLD.lua
137
CTLD.lua
@@ -22,6 +22,10 @@
|
|||||||
- Report status every 5 minutes or when targets first appear
|
- Report status every 5 minutes or when targets first appear
|
||||||
- Report vague status like 5 armoured vehicles, soldiers and support trucks ??
|
- Report vague status like 5 armoured vehicles, soldiers and support trucks ??
|
||||||
|
|
||||||
|
Steggles TODO:
|
||||||
|
- Test logic on smoke refresh
|
||||||
|
- Test logic on inPickupZone coalition and active check
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
ctld = {} -- DONT REMOVE!
|
ctld = {} -- DONT REMOVE!
|
||||||
@@ -103,18 +107,18 @@ ctld.JTAC_lock = "all" -- "vehicle" OR "troop" OR "all" forces JTAC to only lock
|
|||||||
-- You can add number as a third option to limit the number of soldier or vehicle groups that can be loaded from a zone.
|
-- You can add number as a third option to limit the number of soldier or vehicle groups that can be loaded from a zone.
|
||||||
-- Dropping back a group at a limited zone will add one more to the limit
|
-- Dropping back a group at a limited zone will add one more to the limit
|
||||||
|
|
||||||
|
--pickupZones = { "name", "smoke", "limit (-1 unlimited)", "active (yes/no), "side (1/2)"}
|
||||||
ctld.pickupZones = {
|
ctld.pickupZones = {
|
||||||
{ "pickzone1", "blue" },
|
{ "pickzone1", "blue", -1, "yes", 1 }, --unlimited pickups, active on mission start, red side only
|
||||||
{ "pickzone2", "blue" },
|
{ "pickzone2", "blue", -1, "yes", 2 }, --unlimited pickups, active on mission start, blue side only
|
||||||
{ "pickzone3", "none" },
|
{ "pickzone3", "none", -1, "no", 1 }, --unlimited pickups, not active on mission start, red side only
|
||||||
{ "pickzone4", "none" },
|
{ "pickzone4", "none", -1, "yes", 1 },
|
||||||
{ "pickzone5", "none" },
|
{ "pickzone5", "none", -1, "yes", 1 },
|
||||||
{ "pickzone6", "none" },
|
{ "pickzone6", "none", -1, "yes", 1 },
|
||||||
{ "pickzone7", "none" },
|
{ "pickzone7", "none", -1, "yes", 1 },
|
||||||
{ "pickzone8", "none" },
|
{ "pickzone8", "none", -1, "yes", 1 },
|
||||||
{ "pickzone9", "none", 5 }, -- limits pickup zone 9 to 5 groups of soldiers or vehicles
|
{ "pickzone9", "none", 5, "yes", 1 }, -- limits pickup zone 9 to 5 groups of soldiers or vehicles, only red can pick up
|
||||||
{ "pickzone10", "none", 10 }, -- limits pickup zone 10 to 10 groups of soldiers or vehicles
|
{ "pickzone10", "none", 10, "yes", 2 }, -- limits pickup zone 10 to 10 groups of soldiers or vehicles, only blue can pick up
|
||||||
}
|
}
|
||||||
|
|
||||||
ctld.dropOffZones = {
|
ctld.dropOffZones = {
|
||||||
@@ -3074,7 +3078,10 @@ function ctld.inPickupZone(_heli)
|
|||||||
local _dist = ctld.getDistance(_heliPoint, _triggerZone.point)
|
local _dist = ctld.getDistance(_heliPoint, _triggerZone.point)
|
||||||
|
|
||||||
if _dist <= _triggerZone.radius then
|
if _dist <= _triggerZone.radius then
|
||||||
return {inZone = true,limit = _zoneDetails[3],index=_i}
|
local _heliCoalition = _heli:getCoalition()
|
||||||
|
if _zoneDetails[4] == 1 and _zoneDetails[5] == _heliCoalition then
|
||||||
|
return {inZone = true,limit = _zoneDetails[3],index=_i}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -3180,7 +3187,7 @@ function ctld.refreshSmoke()
|
|||||||
|
|
||||||
local _triggerZone = trigger.misc.getZone(_zoneDetails[1])
|
local _triggerZone = trigger.misc.getZone(_zoneDetails[1])
|
||||||
|
|
||||||
if _triggerZone ~= nil and _zoneDetails[2] >= 0 then
|
if _triggerZone ~= nil and _zoneDetails[2] >= 0 and _zoneDetails[4] == 1 then
|
||||||
|
|
||||||
-- Trigger smoke markers
|
-- Trigger smoke markers
|
||||||
|
|
||||||
@@ -4261,6 +4268,74 @@ function ctld.getPositionString(_unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
------------------------Steggles Functions-----------------------
|
||||||
|
function ctld.activatePickupZone(_zoneName)
|
||||||
|
local _triggerZone = trigger.misc.getZone(_zoneName) -- trigger to use as reference position
|
||||||
|
|
||||||
|
if _triggerZone == nil then
|
||||||
|
trigger.action.outText("CTLD.lua ERROR: Cant find zone called " .. _zoneName, 10)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, _zoneDetails in pairs(ctld.pickupZones) do
|
||||||
|
|
||||||
|
if _triggerZone = trigger.misc.getZone(_zoneDetails[1]) then
|
||||||
|
|
||||||
|
--smoke could get messy if designer keeps calling this on an active zone, check its not active first
|
||||||
|
if _zoneDetails[4] == 1 then
|
||||||
|
trigger.action.outText("CTLD.lua ERROR: Pickup Zone already active: " .. _zoneName, 10)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
_zoneDetails[4] = 1 --activate zone
|
||||||
|
|
||||||
|
if ctld.disableAllSmoke == true then --smoke disabled
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if _zoneDetails[2] >= 0 then
|
||||||
|
|
||||||
|
-- Trigger smoke marker
|
||||||
|
-- This will cause an overlapping smoke marker on next refreshsmoke call
|
||||||
|
-- but will only happen once
|
||||||
|
local _pos2 = { x = _triggerZone.point.x, y = _triggerZone.point.z }
|
||||||
|
local _alt = land.getHeight(_pos2)
|
||||||
|
local _pos3 = { x = _pos2.x, y = _alt, z = _pos2.y }
|
||||||
|
|
||||||
|
trigger.action.smoke(_pos3, _zoneDetails[2])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ctld.deactivatePickupZone(_zoneName)
|
||||||
|
|
||||||
|
local _triggerZone = trigger.misc.getZone(_zoneName) -- trigger to use as reference position
|
||||||
|
|
||||||
|
if _triggerZone == nil then
|
||||||
|
trigger.action.outText("CTLD.lua ERROR: Cant find zone called " .. _zoneName, 10)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, _zoneDetails in pairs(ctld.pickupZones) do
|
||||||
|
|
||||||
|
if _triggerZone = trigger.misc.getZone(_zoneDetails[1]) then
|
||||||
|
|
||||||
|
if _zoneDetails[4] == 0 then --this really needed??
|
||||||
|
trigger.action.outText("CTLD.lua ERROR: Pickup Zone already deactiveated: " .. _zoneName, 10)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
_zoneDetails[4] = 0 --deactivate zone
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- ***************** SETUP SCRIPT ****************
|
-- ***************** SETUP SCRIPT ****************
|
||||||
|
|
||||||
assert(mist ~= nil, "\n\n** HEY MISSION-DESIGNER! **\n\nMiST has not been loaded!\n\nMake sure MiST 3.6 or higher is running\n*before* running this script!\n")
|
assert(mist ~= nil, "\n\n** HEY MISSION-DESIGNER! **\n\nMiST has not been loaded!\n\nMake sure MiST 3.6 or higher is running\n*before* running this script!\n")
|
||||||
@@ -4345,27 +4420,33 @@ for _, _zone in pairs(ctld.pickupZones) do
|
|||||||
|
|
||||||
local _zoneName = _zone[1]
|
local _zoneName = _zone[1]
|
||||||
local _zoneColor = _zone[2]
|
local _zoneColor = _zone[2]
|
||||||
|
local _zoneActive = _zone[4]
|
||||||
|
|
||||||
if _zoneColor == "green" then
|
if _zoneColor == "green" then
|
||||||
_zone[2] = trigger.smokeColor.Green
|
_zone[2] = trigger.smokeColor.Green
|
||||||
elseif _zoneColor == "red" then
|
elseif _zoneColor == "red" then
|
||||||
_zone[2] = trigger.smokeColor.Red
|
_zone[2] = trigger.smokeColor.Red
|
||||||
elseif _zoneColor == "white" then
|
elseif _zoneColor == "white" then
|
||||||
_zone[2] = trigger.smokeColor.White
|
_zone[2] = trigger.smokeColor.White
|
||||||
elseif _zoneColor == "orange" then
|
elseif _zoneColor == "orange" then
|
||||||
_zone[2] = trigger.smokeColor.Orange
|
_zone[2] = trigger.smokeColor.Orange
|
||||||
elseif _zoneColor == "blue" then
|
elseif _zoneColor == "blue" then
|
||||||
_zone[2] = trigger.smokeColor.Blue
|
_zone[2] = trigger.smokeColor.Blue
|
||||||
else
|
else
|
||||||
_zone[2] = -1 -- no smoke colour
|
_zone[2] = -1 -- no smoke colour
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add in counter for troops or units
|
-- add in counter for troops or units
|
||||||
if _zone[3] == nil then
|
if _zone[3] == -1 then
|
||||||
_zone[3] = 10000;
|
_zone[3] = 10000;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- change active to 1 / 0
|
||||||
|
if _zoneActive == "yes" then
|
||||||
|
_zone[4] = 1
|
||||||
|
else
|
||||||
|
_zone[4] = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user