Jump to content

Complete transport script


geloxo

Recommended Posts

^ Love that helicopter script by the way... I found it somewhere but never knew who made it.

 

using the group / unit in zone MIST function may also work though I believe they still call infantry a ground unit. I like that since it allows you to state the number of units that need to be in position to "hold" the objective. It also has a toggle / stop feature that comes in handy. It's also removes the need to identify exactly which group needs to be in the zone- and accounts for ANY ground unit. Just pick a required number that fits the number of infantry in your group...

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Thanks Ajax, I'm still very new when it comes with using scripts. I can plug you information in just fine. But I don't need the helicopters to trigger the event. I want the troops in the zone to trigger the event.With the mission I want to drop the troops off outside the combat zone and make them march into it.

 

ENO

Is there any way to pull the amount of units in zone script from MIST into CTTS? Or do I need to load all of mist to get this to work?

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Just initiate MIST or do it without condition at "mission start"- do script file as is. Make sure it's v3.4. You can then use the MIST guide to go find and edit the part that you need. Also recommend the wiki here:

 

http://wiki.hoggit.us/view/Units_in_zones

 

I think default CTTS load is 11-12... so if you said minimum number 10 (you know, in case you lose any along the way). You could also toggle it so that the flag turns off when your number drops below the minimum.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

I made it for helicopters, but it will work for any type of unit.

 

Anyway, here is a modified Lua predicate to do what you want:

 

-- Lua predicate: anyGroupUnitInZone
-- returns true if any unit of any group in group list is within the zone
-- Usage: trigger type (switched condition) --> Lua predicate (insert this script into text box) --> Do your desired action if true
local function anyGroupUnitInZone(groups, zone)
   local i,j
   for i=1,#groups do
       local group = Group.getByName(groups[i])
       if group then
           local units = group:getUnits()
           if units then
               for j = 1,#units do
                   local unitPos = units[j]:getPoint()
                   local z = trigger.misc.getZone(zone)
                   if unitPos and z then
                       local dx = unitPos.x - z.point.x
                       local dy = unitPos.z - z.point.z
                       local d = math.sqrt(dx*dx + dy*dy)
                       if d < z.radius then return true end
                   end
               end
           end
       end
   end
   return false
end
local groupNames = {'GroupName100','GroupName101','GroupName102'}
local zoneName = 'YourCaptureZoneName1'
return anyGroupUnitInZone(groupNames,zoneName)
Link to comment
Share on other sites

When I drop units With CTTS, I get each units name GroupName100, GroupName101, GroupName102, GroupName103, it goes on as many troops are dropped. With your script. Do I just edit line 26 with the group names by going on as high as I think anyone would try to drop troops in the mission.

 

 

local groupNames = {'GroupName100','GroupName101','GroupName102','GroupName103','GroupName104','GroupName105','GroupName106'}

Just keep doing this for 50 or so groups?

 

 

Then I have have 4 zones I want to capture. As I capture each zone I want to add 1 to a flag.

 

local zoneName = 'YourCaptureZoneName1' only list one zone. Should I run this script for each zone? Do a Capturezonename2 With all the other information the same.

 

EDIT: Ajax, your replies are faster than my refreshes. I cannot thank you enough.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Should I run this script for each zone? Do a Capturezonename2 With all the other information the same.

Yes, exactly. That way you can increment your flag as each zone is captured. Depending on your needs, you may want to use a 'Once'-type trigger instead of a 'Switched condition'-type.

 

I didn't realize you were using dynamically spawned groups. That complicates things a bit. If all these groups have the same 'root' name, then it could be done without listing them. I'll think about it some more.

Link to comment
Share on other sites

Alright, this one will check all groups whose name matches the supplied root name.

 

[font=Courier New]-- Lua predicate: anyGroupUnitInZone
-- returns true if any unit of any group with a name matching the root name is within the zone
-- Usage: trigger type (switched condition) --> Lua predicate (insert this script into text box) --> Do your desired action if true
local function anyGroupUnitInZone(rootName, zone)
   local i,j
   local groups = {}
   local iters = {}
   local redGroups = coalition.getGroups(coalition.side.RED,Group.Category.GROUND)
   local blueGroups = coalition.getGroups(coalition.side.BLUE,Group.Category.GROUND)
   if #redGroups > 0 then
       iters[#iters + 1] = redGroups
   end
   if #blueGroups > 0 then
       iters[#iters + 1] = blueGroups
   end
   for i=1,#iters do
       for j=1,#iters[i] do
           local group = iters[i][j]
           local groupName = group:getName()
           if string.len(groupName) >= string.len(rootName) then
               if rootName == string.sub(groupName,1,string.len(rootName)) then
                   groups[#groups + 1] = groupName
               end
           end
       end
   end
   for i=1,#groups do
       local group = Group.getByName(groups[i])
       if group then
           local units = group:getUnits()
           if units then
               for j = 1,#units do
                   local unitPos = units[j]:getPoint()
                   local z = trigger.misc.getZone(zone)
                   if unitPos and z then
                       local dx = unitPos.x - z.point.x
                       local dy = unitPos.z - z.point.z
                       local d = math.sqrt(dx*dx + dy*dy)
                       if d < z.radius then return true end
                   end
               end
           end
       end
   end
   return false
end
local rootGroupName = 'GroupName'
local zoneName = 'YourCaptureZoneName1'
return anyGroupUnitInZone(rootGroupName,zoneName)
[/font]

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

 

2. Predefined extractable groups can be used to trigger actions during mission as their groupnames will be kept during the mission when transported by human players

 

Hello fellas.

 

I am a huge fan of this CTTS script. But I cant activate a trigger, once a troop has been embarqueda and dropped.

 

I put a unit called "extract1"

I put a triger called alfa

when part of group extract1 inside a trigger zone= somke on place

 

Well, if the unit is not embarqued, and I order them to go to the trigger alfa, it works, But if it has been previously embarqued then, it doesnt.

 

Please help!

Link to comment
Share on other sites

Hey guys, let me start by saying that this script has kept the Huey alive, and we appreciate your hard work.

 

I, like a couple of the guys above have noticed lately that troops are no longer dropped off when commanded to do so. There are no script errors presented and the message that 'xxx dropped off troops' appears as you would expect... It makes no difference if the group is loaded from a 'pickup zone' or if they are an extractable group. Cargo is spawning correctly however.

 

If you have time, we'd sure appreciate any advice!

Intel i9-9900KF @5.2GHz

MSI Z390 Gaming Pro Carbon

32GB G.Skill Trident Z DDR3200 RAM

MSI RTX 2080 Ti Gaming X Trio

40" Panasonic TH-40DX600U @ 4K

Pimax Vision 8K Plus / Oculus Rift CV1 / HTC Vive

Gametrix JetSeat with SimShaker

Windows 10 64 Bit Home Edition

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 2 months later...

Hi geloxo,

 

I just want to point out that CTTS.lua is misbehaving in DCSW release 1.2.12. Given that the script was working fine before and now does not indicates that the problem is with DCSW. I posted a bug report here:

 

http://forums.eagle.ru/showthread.php?t=135312

 

The behavior is easily reproduced in the mission file I posted. It is odd behavior indeed!

 

I only just started using your script and I love it. I hope DCS can sort this out, but I doubt it will be given any priority unless lots of other missions have been broken as well.

 

Thanks for the script in any case. I'll look forward to using again if this gets fixed, or in other scenarios where this particular fault is not an issue.

 

Take care,

Paul

Link to comment
Share on other sites

Quick question about configuring the script. I would like to have AI birds to include UH-1, UH-60, and Ch-47D aircraft. The premise behind this is a mass evacuation of Insurgents and US Forces from Sukhumi - Babushara ---> Kutaisi with an assaulting force within30 km moving to the base.

 

Chinooks will be draining the base of logistical cargo. Fuel, Weapons, etc…

Blackhawks will be shuttling personnel

Iroquois will be Dropping off AT teams to slow down the advancing forces.

 

Do I need three instances of this script or can I define aircraft groups and just plug them into the script;

 

"transport1" = Client UH-1H

"transport2" = Excellent UH-60

"transport3" = Excellent Ch-47D

 

I am at work so extensive search is not possible.

Link to comment
Share on other sites

Hi Gecko6,

 

You do not need to run multiple instances of the script. The script already has quite a few group names set up as you noted above, e.g. transport1, transport2, etc. All you have to do is use those names for your unit pilots' names. It's all in the notes with the script.

 

Paul

Link to comment
Share on other sites

  • 1 month later...
Hey guys, let me start by saying that this script has kept the Huey alive, and we appreciate your hard work.

 

I, like a couple of the guys above have noticed lately that troops are no longer dropped off when commanded to do so. There are no script errors presented and the message that 'xxx dropped off troops' appears as you would expect... It makes no difference if the group is loaded from a 'pickup zone' or if they are an extractable group. Cargo is spawning correctly however.

 

If you have time, we'd sure appreciate any advice!

 

Same problem here, anyone find a fix for this, or is CTTS done for now?

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 1 month later...
Any news on this? We had exactly the same problem:(

 

Please try this one I've modified (I've also attached Geloxo test mission with my updated script)

 

It also has the ability to spawn a crate for transport if you want to practice that, but that can be turned off in the options at the top.

 

VSAAF has been running it for a week or so now with no issues but let me know how you get on.

 

Geloxo, I hope this is OK, message me if you want it taken down!

 

The fix is mostly based on others work, including Chumps, in the bug report as this is the first time i've ever written LUA... so thanks guys!

CTTS.lua

TroopTest-Original.miz


Edited by Ciribob
  • Like 1

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Please try this one I've modified (I've also attached Geloxo test mission with my updated script)

 

It also has the ability to spawn a crate for transport if you want to practice that, but that can be turned off in the options at the top.

 

VSAAF has been running it for a week or so now with no issues but let me know how you get on.

 

Geloxo, I hope this is OK, message me if you want it taken down!

 

The fix is mostly based on others work, including Chumps, in the bug report as this is the first time i've ever written LUA... so thanks guys!

 

Thanks, I will test your script this evening and report back :thumbup:

Link to comment
Share on other sites

Hello all.

 

I would like to use this script to un load a unit Via LoadTransport and dropzone. But I would like that the transport do it when he meet another unit. I also want the transport to delay his activation.

 

What I am doing.

 

I named a VAZ civil vehicle as "transport1" and a UH "helicargo1". So I don't need to edit the CTTS.lua file

 

Once = time more 10sg = do script: Loadtransport ("transport1",4)

 

then I want the dropzone1 trigger to be attached to the VAZ. Any suggestion?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...