diff --git a/CTLD.lua b/CTLD.lua index 9418c6d..5d338f0 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -13,10 +13,9 @@ Contributors: - Steggles - https://github.com/Bob7heBuilder - Version: 1.60 - 20/03/2015 - - Added ability to disable hover pickup and instead load crates with F10 - - Added new function - ctld.removeExtractZone to stop an extract zone after a while - - Added ability to limit the number of AA systems that can be built and active at one time + Version: 1.61 - 19/04/2015 + - Added ability to add Waypoint zones + -- Troops dropped in a waypoint zone will automatically head to the center of the zone ]] @@ -124,7 +123,7 @@ ctld.JTAC_location = true -- shows location of target in JTAC message ctld.JTAC_lock = "all" -- "vehicle" OR "troop" OR "all" forces JTAC to only lock vehicles or troops or all ground units --- ***************** Pickup and dropoff zones ***************** +-- ***************** Pickup, dropoff and waypoint zones ***************** -- Available colors (anything else like "none" disables smoke): "green", "red", "white", "orange", "blue", "none", @@ -185,6 +184,21 @@ ctld.dropOffZones = { } +--wpZones = { "Zone name", "smoke color", "ACTIVE (yes/no)", "side (0 = Both sides / 1 = Red / 2 = Blue )", } +ctld.wpZones = { + { "wpzone1", "green","yes", 2 }, + { "wpzone2", "blue","yes", 2 }, + { "wpzone3", "orange","yes", 2 }, + { "wpzone4", "none","yes", 2 }, + { "wpzone5", "none","yes", 2 }, + { "wpzone6", "none","yes", 1 }, + { "wpzone7", "none","yes", 1 }, + { "wpzone8", "none","yes", 1 }, + { "wpzone9", "none","yes", 1 }, + { "wpzone10", "none","no", 0 }, -- Both sides as its set to 0 +} + + -- ******************** Transports names ********************** -- Use any of the predefined names or set your own ones @@ -943,7 +957,6 @@ function ctld.deactivatePickupZone(_zoneName) end end - -- Change the remaining groups currently available for pickup at a zone -- e.g. ctld.changeRemainingGroupsForPickupZone("pickup1", 5) -- adds 5 groups -- ctld.changeRemainingGroupsForPickupZone("pickup1", -3) -- remove 3 groups @@ -976,6 +989,77 @@ function ctld.changeRemainingGroupsForPickupZone(_zoneName, _amount) end +-- Activates a Waypoint zone +-- Activates a Waypoint zone when called from a trigger +-- EG: ctld.activateWaypointZone("pickzone3") +-- This means that troops dropped within the radius of the zone will head to the center +-- of the zone instead of searching for troops +function ctld.activateWaypointZone(_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.wpZones) do + + if _zoneName == _zoneDetails[1] then + + --smoke could get messy if designer keeps calling this on an active zone, check its not active first + if _zoneDetails[3] == 1 then + -- they might have a continuous trigger so i've hidden the warning + --trigger.action.outText("CTLD.lua ERROR: Pickup Zone already active: " .. _zoneName, 10) + return + end + + _zoneDetails[3] = 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 + + +-- Deactivates a Waypoint zone +-- Deactivates a Waypoint zone when called from a trigger +-- EG: ctld.deactivateWaypointZone("wpzone3") +-- This disables wpzone3 so that troops dropped in this zone will search for troops as normal +-- These functions can be called by triggers +function ctld.deactivateWaypointZone(_zoneName) + + local _triggerZone = trigger.misc.getZone(_zoneName) + + 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 _zoneName == _zoneDetails[1] then + + _zoneDetails[3] = 0 --deactivate zone + end + end +end + -- Continuous Trigger Function -- Causes an AI unit with the specified name to unload troops / vehicles when -- an enemy is detected within a specified distance @@ -3786,10 +3870,17 @@ function ctld.spawnDroppedGroup(_point, _details, _spawnBehind, _maxSearch) _maxSearch = ctld.maximumSearchDistance end - local _enemyPos = ctld.findNearestEnemy(_details.side, _point, _maxSearch) + local _wpZone = ctld.inWaypointZone(_point,_spawnedGroup:getCoalition()) - ctld.orderGroupToMoveToPoint(_spawnedGroup:getUnit(1), _enemyPos) + if _wpZone.inZone then + ctld.orderGroupToMoveToPoint(_spawnedGroup:getUnit(1), _wpZone.point) + env.info("Heading to waypoint - In Zone ".._wpZone.name) + else + local _enemyPos = ctld.findNearestEnemy(_details.side, _point, _maxSearch) + ctld.orderGroupToMoveToPoint(_spawnedGroup:getUnit(1), _enemyPos) + end + return _spawnedGroup end @@ -4090,6 +4181,29 @@ function ctld.inDropoffZone(_heli) return false end +-- are we in a waypoint zone +function ctld.inWaypointZone(_point,_coalition) + + for _, _zoneDetails in pairs(ctld.wpZones) do + + local _triggerZone = trigger.misc.getZone(_zoneDetails[1]) + + --right coalition and active? + if _triggerZone ~= nil and (_zoneDetails[4] == _coalition or _zoneDetails[4]== 0) and _zoneDetails[3] == 1 then + + --get distance to center + + local _dist = ctld.getDistance(_point, _triggerZone.point) + + if _dist <= _triggerZone.radius then + return {inZone = true, point = _triggerZone.point, name = _zoneDetails[1]} + end + end + end + + return {inZone = false} +end + -- are we near friendly logistics zone function ctld.inLogisticsZone(_heli) @@ -4155,6 +4269,25 @@ function ctld.refreshSmoke() end end + --waypoint zones + for _, _zoneDetails in pairs(ctld.wpZones) do + + local _triggerZone = trigger.misc.getZone(_zoneDetails[1]) + + --only trigger if smoke is on AND zone is active + if _triggerZone ~= nil and _zoneDetails[2] >= 0 and _zoneDetails[3] == 1 then + + -- Trigger smoke markers + + 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 + + --refresh in 5 minutes timer.scheduleFunction(ctld.refreshSmoke, nil, timer.getTime() + 300) end @@ -5527,6 +5660,34 @@ for _, _zone in pairs(ctld.dropOffZones) do _zone[4] = 1 end +--sort out waypoint zones +for _, _zone in pairs(ctld.wpZones) do + + local _zoneColor = _zone[2] + + if _zoneColor == "green" then + _zone[2] = trigger.smokeColor.Green + elseif _zoneColor == "red" then + _zone[2] = trigger.smokeColor.Red + elseif _zoneColor == "white" then + _zone[2] = trigger.smokeColor.White + elseif _zoneColor == "orange" then + _zone[2] = trigger.smokeColor.Orange + elseif _zoneColor == "blue" then + _zone[2] = trigger.smokeColor.Blue + else + _zone[2] = -1 -- no smoke colour + end + + --mark as active for refresh smoke logic to work + -- change active to 1 / 0 + if _zone[3] == "yes" then + _zone[3] = 1 + else + _zone[3] = 0 + end +end + -- Sort out extractable groups for _, _groupName in pairs(ctld.extractableGroups) do diff --git a/Cargo Spawn Test.miz b/Cargo Spawn Test.miz index ab009bc..4d094b5 100644 Binary files a/Cargo Spawn Test.miz and b/Cargo Spawn Test.miz differ diff --git a/Pickup-Dropoff-Demo.miz b/Pickup-Dropoff-Demo.miz index 0037683..a7bb61c 100644 Binary files a/Pickup-Dropoff-Demo.miz and b/Pickup-Dropoff-Demo.miz differ diff --git a/README.md b/README.md index 9159a65..e01ae9c 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,50 @@ Complete Troops and Logistics Deployment for DCS World ## Contents -- [Features](#features) -- [Setup in Mission Editor](#setup-in-mission-editor) -- [In Game](#in-game) - - [Troop Loading and Unloading](#troop-loading-and-unloading) - - [Cargo Spawning and Sling Loading](#cargo-spawning-and-sling-loading) - - [Crate Unpacking](#crate-unpacking) - - [Forward Operating Base (FOB) Construction](#forward-operating-base-fob-construction) - - [Radio Beacon Deployment](#radio-beacon-deployment) -- [Advanced Scripting](#advanced-scripting) - - This script is a rewrite of some of the functionality of the original Complete Combat Troop Transport Script (CTTS) by Geloxo (http://forums.eagle.ru/showthread.php?t=108523), as well as adding new features. +* [Contents](#contents) +* [Features](#features) +* [Setup in Mission Editor](#setup-in-mission-editor) + * [Script Setup](#script-setup) + * [Script Configuration](#script-configuration) + * [Pickup and Dropoff Zones Setup](#pickup-and-dropoff-zones-setup) + * [Waypoint Zones Setup](#waypoint-zones-setup) + * [Transport Unit Setup](#transport-unit-setup) + * [Logistic Setup](#logistic-setup) + * [Mission Editor Script Functions](#mission-editor-script-functions) + * [Preload Troops into Transport](#preload-troops-into-transport) + * [Create Extractable Groups without Pickup Zone](#create-extractable-groups-without-pickup-zone) + * [Spawn Extractable Groups without Pickup Zone at a Trigger Zone](#spawn-extractable-groups-without-pickup-zone-at-a-trigger-zone) + * [Spawn Extractable Groups without Pickup Zone at a Point](#spawn-extractable-groups-without-pickup-zone-at-a-point) + * [Activate / Deactivate Pickup Zone](#activate--deactivate-pickup-zone) + * [Change Remaining Groups For a Pickup Zone](#change-remaining-groups-for-a-pickup-zone) + * [Activate / Deactivate Waypoint Zone](#activate--deactivate-waypoint-zone) + * [Unload Transport](#unload-transport) + * [Load Transport](#load-transport) + * [Auto Unload Transport in Proximity to Enemies](#auto-unload-transport-in-proximity-to-enemies) + * [Create Radio Beacon at Zone](#create-radio-beacon-at-zone) + * [Create / Remove Extract Zone](#create--remove-extract-zone) + * [Count Extractable UNITS in zone](#count-extractable-units-in-zone) + * [Count Extractable GROUPS in zone](#count-extractable-groups-in-zone) + * [Create Crate Drop Zone](#create-crate-drop-zone) + * [Spawn Sling loadable crate at a Zone](#spawn-sling-loadable-crate-at-a-zone) + * [Spawn Sling loadable crate at a Point](#spawn-sling-loadable-crate-at-a-point) + * [JTAC Automatic Targeting and Laser](#jtac-automatic-targeting-and-laser) +* [In Game](#in-game) +* [Troop Loading and Unloading](#troop-loading-and-unloading) +* [Cargo Spawning and Sling Loading](#cargo-spawning-and-sling-loading) + * [Simulated Sling Loading](#simulated-sling-loading) + * [Real Sling Loading](#real-sling-loading) +* [Crate Unpacking](#crate-unpacking) +* [Forward Operating Base (FOB) Construction](#forward-operating-base-fob-construction) +* [Radio Beacon Deployment](#radio-beacon-deployment) + * [A10\-C UHF ADF Radio Setup](#a10-c-uhf-adf-radio-setup) + * [KA\-50 UHF ADF Radio Setup](#ka-50-uhf-adf-radio-setup) + * [Mi\-8 ARC\-9 VHF Radio Setup](#mi-8-arc-9-vhf-radio-setup) + * [UH\-1 ADF VHF Radio Setup](#uh-1-adf-vhf-radio-setup) +* [Advanced Scripting](#advanced-scripting) + ## Features The script supports: @@ -30,11 +61,11 @@ The script supports: * Mortar Group * Standard Group * 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 + * 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 * Extractable Soldier Spawn at a trigger zone * Extractable soldier groups added via mission editor -* Unit construction using crates spawned at a logistics area and dropped via Simulated Cargo Sling or Real Cargo Sling +* Unit construction using crates spawned at a logistics area and dropped via Simulated Cargo Sling or Real Cargo Sling * HAWK AA System requires 3 separate and correct crates to build * HAWK system can also be rearmed after construction by dropping another Hawk Launcher nearby and unpacking. Separate repair crate can also be used. * BUK AA System requires 2 separate and correct crates to build @@ -51,7 +82,7 @@ The script supports: * BTR-D * BRMD-2 * FOB Building - * Homing using FM Radio Beacon + * Homing using FM Radio Beacon * Easy Beacon Creation using Mission Editor plus Beacon Naming * Radio Beacon Deployment * Ability to deploy a homing beacon that the A10C, Ka-50, Mi-8 and Huey can home on @@ -61,6 +92,7 @@ The script supports: * Count Crates in Zone * Works for both crates added by the Mission Editor and Crates spawned by Transports * Count soldiers extracted to a zone (the soldiers disappear) +* Waypoint triggers to force dropped groups to head to a location * Advanced Scripting Callback system A complete test mission is included. @@ -245,6 +277,184 @@ Example showing what happens if you dont have enough crates: **Make sure that after making any changes to the script you remove and re-add the script to the mission. ** + +### Pickup and Dropoff Zones Setup +Pickup zones are used by transport aircraft and helicopters to load troops and vehicles. A transport unit must be inside of the radius of the trigger and the right side (RED or BLUE or BOTH) in order to load troops and vehicles. +The pickup zone needs to be named the same as one of the pickup zones in the ```ctld.pickupZones``` list or the list can be edited to match the name in the mission editor. + +Pickup Zones can be configured to limit the number of vehicle or troop groups that can be loaded. To add a limit, edit the 3rd parameter to be any number greater than 0 as shown below. + +You can also list the UNIT NAME of ship instead of a trigger zone to allow the loading/unloading of troops from a ship. You will not be able to fast rope troops onto the deck so you must land to drop the troops off. + +***If your pickup zone isn't working, make sure you've set the 5th parameter, the coalition side, correctly and that the zone is active.*** + +```lua +--pickupZones = { "Zone name or Ship Unit Name", "smoke color", "limit (-1 unlimited)", "ACTIVE (yes/no)", "side (0 = Both sides / 1 = Red / 2 = Blue )", flag number (optional) } +ctld.pickupZones = { + { "pickzone1", "blue", -1, "yes", 0 }, + { "pickzone2", "red", -1, "yes", 0 }, + { "pickzone3", "none", -1, "yes", 0 }, + { "pickzone4", "none", -1, "yes", 0 }, + { "pickzone5", "none", -1, "yes", 0 }, + { "pickzone6", "none", -1, "yes", 0 }, + { "pickzone7", "none", -1, "yes", 0 }, + { "pickzone8", "none", -1, "yes", 0 }, + { "pickzone9", "none", 5, "yes", 1 }, -- limits pickup zone 9 to 5 groups of soldiers or vehicles, only red can pick up + { "pickzone10", "none", 10, "yes", 2 }, -- limits pickup zone 10 to 10 groups of soldiers or vehicles, only blue can pick up + + { "pickzone11", "blue", 20, "no", 2 }, -- limits pickup zone 11 to 20 groups of soldiers or vehicles, only blue can pick up. Zone starts inactive! + { "pickzone12", "red", 20, "no", 1 }, -- limits pickup zone 11 to 20 groups of soldiers or vehicles, only blue can pick up. Zone starts inactive! + { "pickzone13", "none", -1, "yes", 0 }, + { "pickzone14", "none", -1, "yes", 0 }, + { "pickzone15", "none", -1, "yes", 0 }, + { "pickzone16", "none", -1, "yes", 0 }, + { "pickzone17", "none", -1, "yes", 0 }, + { "pickzone18", "none", -1, "yes", 0 }, + { "pickzone19", "none", 5, "yes", 0 }, + { "pickzone20", "none", 10, "yes", 0, 1000 }, -- optional extra flag number to store the current number of groups available in + + { "USA Carrier", "blue", 10, "yes", 0, 1001 }, -- instead of a Zone Name you can also use the UNIT NAME of a ship +} +``` + +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: +![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-22-48-57_zpsc5u7bymy.png~original "Pickup zone") + +Dropoff zones are used by AI units to automatically unload any loaded troops or vehicles. This will occur as long as the AI unit has some units onboard and stays in the radius of the zone for a few seconds and the zone is named in the ```ctld.dropoffZones``` list. Again units do not need to stop but aircraft need to be on the ground in order to unload the troops. + +If your dropoff zone isn't working, make sure the 3rd parameter, the coalition side, is set correctly. + +```lua + +-- dropOffZones = {"name","smoke colour",0,side 1 = Red or 2 = Blue or 0 = Both sides} +ctld.dropOffZones = { + { "dropzone1", "green", 2 }, + { "dropzone2", "blue", 2 }, + { "dropzone3", "orange", 2 }, + { "dropzone4", "none", 2 }, + { "dropzone5", "none", 1 }, + { "dropzone6", "none", 1 }, + { "dropzone7", "none", 1 }, + { "dropzone8", "none", 1 }, + { "dropzone9", "none", 1 }, + { "dropzone10", "none", 1 }, +} +``` + +![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-23-15-72_zpsrmfzbdtr.png~original "Dropoff Zone") + +Smoke can be enabled or disabled individually for pickup or dropoff zones by editing the second column in the list. + +Available colours are: +* ```"green"``` +* ```"red"``` +* ```"white"``` +* ```"orange"``` +* ```"blue"``` +* ```"none"``` + +Smoke can be disabled for all zones regardless of the settings above using the option ```ctld.disableAllSmoke = true``` in the User Configuration part of the script. + +### Waypoint Zones Setup + +Waypoint zones can be used to make dropped or spawned troops automatically head to the center of a zone. The troops will head to the center of the zone if the coalition matches (or the coalition is set to 0) and if the zone is currently active. + +If your Waypoint zone isn't working, make sure the 3rd parameter, the coalition side, is set correctly and the zone is set to active. + +```lua + +--wpZones = { "Zone name", "smoke color", "ACTIVE (yes/no)", "side (0 = Both sides / 1 = Red / 2 = Blue )", } +ctld.wpZones = { + { "wpzone1", "green","yes", 2 }, + { "wpzone2", "blue","yes", 2 }, + { "wpzone3", "orange","yes", 2 }, + { "wpzone4", "none","yes", 2 }, + { "wpzone5", "none","yes", 1 }, + { "wpzone6", "none","yes", 1 }, + { "wpzone7", "none","yes", 1 }, + { "wpzone8", "none","yes", 1 }, + { "wpzone9", "none","yes", 1 }, + { "wpzone10", "none","no", 1 }, +} +``` + +Smoke can be enabled or disabled individually for waypoiny zones exactly the same as Pickup and Dropoff zones by editing the second column in the list. + +The available colours are: +* ```"green"``` +* ```"red"``` +* ```"white"``` +* ```"orange"``` +* ```"blue"``` +* ```"none"``` + +Smoke can be disabled for all zones regardless of the settings above using the option ```ctld.disableAllSmoke = true``` in the User Configuration part of the script. + +### Transport Unit Setup +Any unit that you want to be able to transport troops needs to have the **"Pilot Name"** in the ```ctld.transportPilotNames``` list. **Player controlled transport units should be in a group of their own and be the only unit in the group, otherwise other players may have radio commands they shouldn't**. The group name isn't important and can be set to whatever you like. A snippet of the list is shown below. + +If the unit is player controlled, troops have to be manually loaded when in a pickup zone, AI units will auto load troops in a pickup zone. + +```lua +ctld.transportPilotNames = { + "helicargo1", + "helicargo2", + "helicargo3", + "helicargo4", + "helicargo5", + "helicargo6", + "helicargo7", + "helicargo8", + "helicargo9", + "helicargo10", + } +``` + +Example for C-130: +![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-26-26-40_zpswy4s4p7p.png~original "C-130FR") + +Example for Huey: +![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-26-30-78_zpsm8bxsofc.png~original "Huey") + +Example for AI APC: +![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-25-50-65_zpsdiztodm5.png~original "AI APC") + + +### Logistic Setup +Logistic crates can also be spawned by Player-controlled Transport Helicopters, as long as they are near a friendly logistic unit listed in ```ctld.logisticUnits```. The distance that the heli's can spawn crates at can be configured at the top of the script. Any static object can be used for Logistics. + +```lua +ctld.logisticUnits = { + "logistic1", + "logistic2", + "logistic3", + "logistic4", + "logistic5", + "logistic6", + "logistic7", + "logistic8", + "logistic9", + "logistic10", +} + +``` + +Example: + +![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2016-01-53-20_zps1ccbwnop.png~original "Logistic Unit") + + ### Mission Editor Script Functions #### Preload Troops into Transport You can also preload troops into AI transports once the CTLD script has been loaded, instead of having the AI enter a pickup zone, using the code below where the parameters are: @@ -305,8 +515,8 @@ ctld.spawnGroupAtPoint("blue", {mg=1,at=2,aa=3,inf=4,mortar=5}, {x=1,y=2,z=3}, 2 ``` -### Activate / Deactivate Pickup Zone -You can activate and deactive a pickup zone as shown below. When a zone is active, troops can be loaded from it as long as there are troops remaining and you are the same side as the pickup zone. +#### Activate / Deactivate Pickup Zone +You can activate and deactivate a pickup zone as shown below. When a zone is active, troops can be loaded from it as long as there are troops remaining and you are the same side as the pickup zone. ```lua ctld.activatePickupZone("pickzone3") @@ -316,7 +526,7 @@ or ctld.deactivatePickupZone("pickzone3") ``` -### Change Remaining Groups For a Pickup Zone +#### Change Remaining Groups For a Pickup Zone In the configuration of a pickup zone / pickup ship you can limit the number of groups that can be loaded. Call the function below to add or remove groups from the remaining groups at a zone. @@ -329,21 +539,32 @@ ctld.changeRemainingGroupsForPickupZone("pickup1", -3) -- remove 3 groups for zo ``` +#### Activate / Deactivate Waypoint Zone +You can activate and deactivate a waypoint zone as shown below. When a waypoint zone is active, and the right coalition of troops is dropped inside, the troops will attempt to head to the center of the zone. -### Unload Transport +```lua +ctld.activateWaypointZone("wpzone1") +``` +or +```lua +ctld.deactivateWaypointZone("wpzone1") +``` + +#### Unload Transport You can force a unit to unload its units (as long as its on the ground) by calling this function. ```lua ctld.unloadTransport("helicargo1") +``` - ###Load Transport +#### Load Transport You can force a unit to load its units (as long as its on the ground) by calling this function. ```lua ctld.loadTransport("helicargo1") ``` -### Auto Unload Transport in Proximity to Enemies +#### Auto Unload Transport in Proximity to Enemies If you add the below as a DO SCRIPT for a CONTINOUS TRIGGER, an AI unit will automatically drop its troops if its landed and there are enemies within the specificed distance (in meters) ```lua @@ -519,147 +740,6 @@ the mission but there can be a delay of up to 30 seconds after activation for th You can also change the **name of a unit*** (unit, not group) to include "**hpriority**" to make it high priority for the JTAC, or "**priority**" to set it to be medium priority. JTAC's will prioritize targets within view by first marking hpriority targets, then priority targets, and finally all others. This works seemlessly with the all/vehicle/troop functionality as well. In this way you can have them lase SAMS, then AAA, then armor, or any other order you decide is preferable. -### Pickup and Dropoff Zones Setup -Pickup zones are used by transport aircraft and helicopters to load troops and vehicles. A transport unit must be inside of the radius of the trigger and the right side (RED or BLUE or BOTH) in order to load troops and vehicles. -The pickup zone needs to be named the same as one of the pickup zones in the ```ctld.pickupZones``` list or the list can be edited to match the name in the mission editor. - -Pickup Zones can be configured to limit the number of vehicle or troop groups that can be loaded. To add a limit, edit the 3rd parameter to be any number greater than 0 as shown below. - -You can also list the UNIT NAME of ship instead of a trigger zone to allow the loading/unloading of troops from a ship. You will not be able to fast rope troops onto the deck so you must land to drop the troops off. - -***If your pickup zone isn't working, make sure you've set the 5th parameter, the coalition side, correctly and that the zone is active.*** - -```lua ---pickupZones = { "Zone name or Ship Unit Name", "smoke color", "limit (-1 unlimited)", "ACTIVE (yes/no)", "side (0 = Both sides / 1 = Red / 2 = Blue )", flag number (optional) } -ctld.pickupZones = { - { "pickzone1", "blue", -1, "yes", 0 }, - { "pickzone2", "red", -1, "yes", 0 }, - { "pickzone3", "none", -1, "yes", 0 }, - { "pickzone4", "none", -1, "yes", 0 }, - { "pickzone5", "none", -1, "yes", 0 }, - { "pickzone6", "none", -1, "yes", 0 }, - { "pickzone7", "none", -1, "yes", 0 }, - { "pickzone8", "none", -1, "yes", 0 }, - { "pickzone9", "none", 5, "yes", 1 }, -- limits pickup zone 9 to 5 groups of soldiers or vehicles, only red can pick up - { "pickzone10", "none", 10, "yes", 2 }, -- limits pickup zone 10 to 10 groups of soldiers or vehicles, only blue can pick up - - { "pickzone11", "blue", 20, "no", 2 }, -- limits pickup zone 11 to 20 groups of soldiers or vehicles, only blue can pick up. Zone starts inactive! - { "pickzone12", "red", 20, "no", 1 }, -- limits pickup zone 11 to 20 groups of soldiers or vehicles, only blue can pick up. Zone starts inactive! - { "pickzone13", "none", -1, "yes", 0 }, - { "pickzone14", "none", -1, "yes", 0 }, - { "pickzone15", "none", -1, "yes", 0 }, - { "pickzone16", "none", -1, "yes", 0 }, - { "pickzone17", "none", -1, "yes", 0 }, - { "pickzone18", "none", -1, "yes", 0 }, - { "pickzone19", "none", 5, "yes", 0 }, - { "pickzone20", "none", 10, "yes", 0, 1000 }, -- optional extra flag number to store the current number of groups available in - - { "USA Carrier", "blue", 10, "yes", 0, 1001 }, -- instead of a Zone Name you can also use the UNIT NAME of a ship -} -``` - -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: -![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-22-48-57_zpsc5u7bymy.png~original "Pickup zone") - -Dropoff zones are used by AI units to automatically unload any loaded troops or vehicles. This will occur as long as the AI unit has some units onboard and stays in the radius of the zone for a few seconds and the zone is named in the ```ctld.dropoffZones``` list. Again units do not need to stop but aircraft need to be on the ground in order to unload the troops. - -If your dropoff zone isn't working, make sure the 3rd parameter, the coalition side, is set correctly. - -```lua - --- dropOffZones = {"name","smoke colour",0,side 1 = Red or 2 = Blue or 0 = Both sides} -ctld.dropOffZones = { - { "dropzone1", "green", 2 }, - { "dropzone2", "blue", 2 }, - { "dropzone3", "orange", 2 }, - { "dropzone4", "none", 2 }, - { "dropzone5", "none", 1 }, - { "dropzone6", "none", 1 }, - { "dropzone7", "none", 1 }, - { "dropzone8", "none", 1 }, - { "dropzone9", "none", 1 }, - { "dropzone10", "none", 1 }, -} -``` - -![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-23-15-72_zpsrmfzbdtr.png~original "Dropoff Zone") - -Smoke can be enabled or disabled individually for pickup or dropoff zones by editing the second column in the list. - -Available colours are: -* ```"green"``` -* ```"red"``` -* ```"white"``` -* ```"orange"``` -* ```"blue"``` -* ```"none"``` - -Smoke can be disabled for all zones regardless of the settings above using the option ```ctld.disableAllSmoke = true``` in the User Configuration part of the script. - -### Transport Unit Setup -Any unit that you want to be able to transport troops needs to have the **"Pilot Name"** in the ```ctld.transportPilotNames``` list. **Player controlled transport units should be in a group of their own and be the only unit in the group, otherwise other players may have radio commands they shouldn't**. The group name isn't important and can be set to whatever you like. A snippet of the list is shown below. - -If the unit is player controlled, troops have to be manually loaded when in a pickup zone, AI units will auto load troops in a pickup zone. - -```lua -ctld.transportPilotNames = { - "helicargo1", - "helicargo2", - "helicargo3", - "helicargo4", - "helicargo5", - "helicargo6", - "helicargo7", - "helicargo8", - "helicargo9", - "helicargo10", - } -``` - -Example for C-130: -![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-26-26-40_zpswy4s4p7p.png~original "C-130FR") - -Example for Huey: -![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-26-30-78_zpsm8bxsofc.png~original "Huey") - -Example for AI APC: -![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2015-25-50-65_zpsdiztodm5.png~original "AI APC") - - -### Logistic Setup -Logistic crates can also be spawned by Player-controlled Transport Helicopters, as long as they are near a friendly logistic unit listed in ```ctld.logisticUnits```. The distance that the heli's can spawn crates at can be configured at the top of the script. Any static object can be used for Logistics. - -```lua -ctld.logisticUnits = { - "logistic1", - "logistic2", - "logistic3", - "logistic4", - "logistic5", - "logistic6", - "logistic7", - "logistic8", - "logistic9", - "logistic10", -} - -``` - -Example: - -![alt text](http://i1056.photobucket.com/albums/t379/cfisher881/Launcher%202015-05-10%2016-01-53-20_zps1ccbwnop.png~original "Logistic Unit") - # In Game ## Troop Loading and Unloading diff --git a/test-fob.miz b/test-fob.miz index 7d97f9a..97b8206 100644 Binary files a/test-fob.miz and b/test-fob.miz differ diff --git a/test-mission.miz b/test-mission.miz index cafc445..9d17cf0 100644 Binary files a/test-mission.miz and b/test-mission.miz differ