Complete Transport and Logistics Deployment - CTLD - Page 5 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 05-18-2015, 08:40 PM   #41
knapsak
Junior Member
 
Join Date: Aug 2011
Location: South Africa
Posts: 20
Thumbs up

Thanks Ciribob

This is awesome, now I can use the C-130 almost the way it is meant to be used.

I am glad you added the JTAC into CTLD makes it so much easier.
knapsak is offline   Reply With Quote
Old 05-19-2015, 06:31 PM   #42
msalama
Veteran
 
msalama's Avatar
 
Join Date: Apr 2008
Posts: 4,382
Default

WOW! This script is exactly what I need at this point. Muchas gracias amigo, very much appreciated
msalama is offline   Reply With Quote
Old 05-19-2015, 08:04 PM   #43
Ciribob
ED Testers Team
 
Join Date: Mar 2015
Location: Brighton, UK
Posts: 1,900
Default

Quote:
Originally Posted by TracerFacer View Post
Hello.. thank you for the CTLD script. Awesome Job! It's making a huge difference already in how we make our maps and it really gives the Helo's a reason to use the sling loads!

After digging through the script to see how things worked.. I was inspired..

I've managed to create 2 functions based off of 2 functions that were present in the CTLD script, that when used in combination with a couple ME triggers & zones ... we can get the sling loads to know they are in a trigger zone.. and react accordingly.

For example.. we want to activate a group of artillery units after the 4 sling loads have been dropped off in a zone. Something that used to work, but has been broke for a long time..

There is probably a more graceful way of doing this. But my skills/time are limited. I submit to you all for review/comments/someone takes the ball and runs with it.

Things I've noted and would like to change.. but I'm dumb and can't figure it out
  • It does not care if cargo is damaged
  • It does not care if the cargo is on the ground or in the air still.. if it's in the zone.. bam.. it counts.
  • It does not care about coalition. Red cargo could flip a blue trigger.

Here is the mission I've been using this in. You can extract the lua file from it or use the code snippet below:
https://dl.dropboxusercontent.com/u/...20Dam-CTLD.miz


Here it is..
Code:
-- Load after CTLD
-- You will need several triggers to get this to work. 
-- A Trigger with - Multiple Actions - for every zone you want to monitor. Pass 3 values. Zone Name. Number of Crates to bring to zone. User Flag to set to 1)
--CONTINOUSE ACTION --> TIME MORE 30 --> DO SCRIPT --> ctld.CheckZone4Crates("MyZoneName-1", 4, 567)
---------------------------------------> DO SCRIPT --> ctld.CheckZone4Crates("MyZoneName-2", 6, 568)

-- Another Trigger for each flag that gets flipped.. 
--ONCE --> FLAG 567 = 1 --> ACTIVATE GROUP xx
--ONCE --> FLAG 568 = 1 --> ACTIVATE GROUP xx

function ctld.checkZone4Crates(_ZoneName,_cratesWanted,_userFlag)
    
	--trigger.action.outText(_ZoneName .. " " .. _cratesWanted .. " " .. _userFlag, 1)
	
	local _crateCount = 0 --How many crates have we found in the zone.
	local _ZonePos = mist.utils.zoneToVec3(_ZoneName)
	local _crates = ctld.getCratesAndDistance4Zone(_ZonePos)
	
	
	for _, _crate in pairs(_crates) do

            if _crate.dist < 1000 then
				
				_crateCount = _crateCount + 1
				
            end
    end
	-- If we found enough crates set the user flag from the ME to 1
	if _crateCount >= _cratesWanted then
		trigger.action.setUserFlag(_userFlag, 1)
	end
	
	
end

function ctld.getCratesAndDistance4Zone(_ZonePos)

    local _crates = {}

    function merge(t1, t2)
    for k, v in pairs(t2) do
        if (type(v) == "table") and (type(t1[k] or false) == "table") then
            merge(t1[k], t2[k])
        else
            t1[k] = v
        end
    end
    return t1
	end
	
	local _allCrates = merge(ctld.spawnedCratesBLUE, ctld.spawnedCratesRED)
	
	--local _allCrates = ctld.spawnedCratesBLUE

    for _crateName, _details in pairs(_allCrates) do

        --get crate
        local _crate = StaticObject.getByName(_crateName)

        --in air seems buggy with crates so if in air is true, get the height above ground and the speed magnitude
        if _crate ~= nil and _crate:getLife() > 0
                and (_crate:inAir() == false or (land.getHeight(_crate:getPoint()) < 200 and mist.vec.mag(_crate:getVelocity()) < 1.0  )) then

            local _dist = ctld.getDistance(_crate:getPoint(), _ZonePos)

            local _crateDetails = { crateUnit = _crate, dist = _dist, details = _details }

            table.insert(_crates, _crateDetails) 
        end
    end

    return _crates
end
Nice Work!

You code gave me an idea, you can now set a cratesRequired parameter on a unit so that it requires more than one crate to build.

Latest version is on github with an updated readme showing how to use the option.

Thanks for the great feedback
Ciribob is offline   Reply With Quote
Old 05-20-2015, 07:30 PM   #44
july865
Member
 
Join Date: Feb 2009
Location: So Cal
Posts: 518
Default

can we update a current mission with your recent code without braking the mission??
__________________
Asus x99, i7 5930k, 32g mem, MSI 1070GTX, 970 Samsung M.2, LG 35in Ultra-Wide, TrackIR 4
Thrustmaster Warthog HOTAS
july865 is offline   Reply With Quote
Old 05-20-2015, 07:33 PM   #45
Ciribob
ED Testers Team
 
Join Date: Mar 2015
Location: Brighton, UK
Posts: 1,900
Default

Quote:
Originally Posted by july865 View Post
can we update a current mission with your recent code without braking the mission??
Yup should be completely fine.

Just make sure you copy any options you changed over to the new version.
__________________
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
Ciribob is offline   Reply With Quote
Old 05-23-2015, 03:09 AM   #46
jeffdude
Member
 
Join Date: Sep 2013
Posts: 227
Default

As usual, the latest patch broke things. Ever since the patch we are seeing crashes with the following errors:
01673.183 INFO NET: Lua: Client [13] "S77th-RandomMember" joined Red in "UH-1H"(2437)
01674.610 INFO NET: Lua: Client [13] "S77th-RandomMember" joined Red in "UH-1H"(243
01674.610 INFO SCRIPTING: CTLD null event
01676.115 INFO DCS: try to write dump information
01676.251 INFO EDCORE: Minidump created.
01676.251 INFO DCS: try to write track file

The crashes seem to happen when a player rapidly switches between units. This may or may not be the cause but CTLD null event seems to precede every crash on maps with the script. We are using the latest CTLD and Mist LUA files. Any guidance on this would be appreciated. Prior to the patch we had a great time with multiplayer missions that used sling-load mechanics to defend bases and even deploy JTAC units.
jeffdude is offline   Reply With Quote
Old 05-23-2015, 09:23 AM   #47
Ciribob
ED Testers Team
 
Join Date: Mar 2015
Location: Brighton, UK
Posts: 1,900
Default

Quote:
Originally Posted by jeffdude View Post
As usual, the latest patch broke things. Ever since the patch we are seeing crashes with the following errors:
01673.183 INFO NET: Lua: Client [13] "S77th-RandomMember" joined Red in "UH-1H"(2437)
01674.610 INFO NET: Lua: Client [13] "S77th-RandomMember" joined Red in "UH-1H"(243
01674.610 INFO SCRIPTING: CTLD null event
01676.115 INFO DCS: try to write dump information
01676.251 INFO EDCORE: Minidump created.
01676.251 INFO DCS: try to write track file

The crashes seem to happen when a player rapidly switches between units. This may or may not be the cause but CTLD null event seems to precede every crash on maps with the script. We are using the latest CTLD and Mist LUA files. Any guidance on this would be appreciated. Prior to the patch we had a great time with multiplayer missions that used sling-load mechanics to defend bases and even deploy JTAC units.
Thanks for the bug report jeffdude. Thats a real shame!

I'll put a version on the test branch in a bit without the event handler as its not actually required, its just more efficient. All its for is removing the transported units from the heli when it dies.

Do you have any other scripts running?
__________________
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
Ciribob is offline   Reply With Quote
Old 05-23-2015, 10:26 AM   #48
Ciribob
ED Testers Team
 
Join Date: Mar 2015
Location: Brighton, UK
Posts: 1,900
Default

Quote:
Originally Posted by jeffdude View Post
As usual, the latest patch broke things. Ever since the patch we are seeing crashes with the following errors:
01673.183 INFO NET: Lua: Client [13] "S77th-RandomMember" joined Red in "UH-1H"(2437)
01674.610 INFO NET: Lua: Client [13] "S77th-RandomMember" joined Red in "UH-1H"(243
01674.610 INFO SCRIPTING: CTLD null event
01676.115 INFO DCS: try to write dump information
01676.251 INFO EDCORE: Minidump created.
01676.251 INFO DCS: try to write track file

The crashes seem to happen when a player rapidly switches between units. This may or may not be the cause but CTLD null event seems to precede every crash on maps with the script. We are using the latest CTLD and Mist LUA files. Any guidance on this would be appreciated. Prior to the patch we had a great time with multiplayer missions that used sling-load mechanics to defend bases and even deploy JTAC units.
I've made a branch on GitHub and removed the event handler and replaced it with a status check every 3 seconds checking for a dead transport unit.

Link: https://github.com/ciribob/DCS-CTLD/tree/eventBugFix

I've only done a quick test and had no crashes but let me know how you get on. It it fixes the issue for you I'll move the changes to the main branch.

Anyone else having the issue, feel free to download and test
Ciribob is offline   Reply With Quote
Old 05-24-2015, 12:02 AM   #49
jeffdude
Member
 
Join Date: Sep 2013
Posts: 227
Thumbs up

Quote:
Originally Posted by Ciribob View Post
I've made a branch on GitHub and removed the event handler and replaced it with a status check every 3 seconds checking for a dead transport unit.

Link: https://github.com/ciribob/DCS-CTLD/tree/eventBugFix

I've only done a quick test and had no crashes but let me know how you get on. It it fixes the issue for you I'll move the changes to the main branch.

Anyone else having the issue, feel free to download and test
Wow! I can't believe how fast you investigated the issue. I'll start using it in the missions right away and get back to you.
jeffdude is offline   Reply With Quote
Old 05-24-2015, 04:38 PM   #50
jeffdude
Member
 
Join Date: Sep 2013
Posts: 227
Default

Quote:
Originally Posted by Ciribob View Post
I've made a branch on GitHub and removed the event handler and replaced it with a status check every 3 seconds checking for a dead transport unit.

Link: https://github.com/ciribob/DCS-CTLD/tree/eventBugFix

I've only done a quick test and had no crashes but let me know how you get on. It it fixes the issue for you I'll move the changes to the main branch.

Anyone else having the issue, feel free to download and test
Early tests show promise with some S77th missions. I'll continue testing today and see if we can't get a server full testing it.
jeffdude is offline   Reply With Quote
Reply

Tags
ctld, ctts, huey, mi-8, mi8, sling loading

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 09:38 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.