Jump to content

Recommended Posts

Posted (edited)

I'm trying to use the Follow command to have a Helicopter follow a Ship.

 

It's not working.

 

When I try select Group to to follow using the drop down it says "NOTHING", even though there are numerous units present.

Edited by Sierra99

[sIGPIC][/sIGPIC]

Primary Computer

ASUS Z390-P, i7-9700K CPU @ 5.0Ghz, 32GB Patriot Viper Steel DDR4 @ 3200Mhz, ZOTAC GeForce 1070 Ti AMP Extreme, Samsung 970 EVO M.2 NVMe drives (1Tb & 500 Gb), Windows 10 Professional, Thrustmaster Warthog HOTAS, Thrustmaster Warthog Stick, Thrustmaster Cougar Throttle, Cougar MFDs x3, Saitek Combat Rudder Pedals and TrackIR 5.

 

-={TAC}=-DCS Server

Gigabyte GA-Z68XP-UD3, i7-3770K CPU @ 3.90GHz, 32GB G.SKILL Ripjaws DDR3 @ 1600Mhz, ZOTAC GeForce® GTX 970.

Posted (edited)

@Sierra99

 

If you're looking for a scripted workaround, this works (the pilot will fly a bit like a sot, though :drunk:):

 

 

local Loop = 1

 

local function OrbitScheduler(Loop, time)

 

local Ship = Unit.getByName("UNIT NAME of the ship in ME")

local Chopper = Unit.getByName("UNIT NAME of the helicopter in ME")

 

local ShipPos3 = Ship:getPosition()

local ShipPos3Mod = {x = ShipPos3.p.x, y = 100 + ShipPos3.p.y, z = ShipPos3.p.z } -- 3D coordinates of the ship's center, offset 100 meters aloft (This line isn't needed! It's a remnant of previous versions of the script)

local ShipVec2Mod = { x = ShipPos3Mod.x , y = ShipPos3Mod.z } -- Ship's coordinates converted to 2D (If you get rid of the line above, this one needs to be modified)

local ShipVec2Mod = { x = ShipPos3.p.x , y = ShipPos3.p.z } -- This is the modified version

 

 

local ChopperPos3 = Chopper:getPosition()

local ChopperVec2 = { x = ChopperPos3.p.x, y = ChopperPos3.p.z } -- 2D coordinates of the helicopter

 

local FarSpeedKmh = 170 -- The desired speed for the helicopter in Km/h (when circling around the ship at a distance)

local CloseSpeedKmh = 20 -- The desired speed for the helicopter in Km/h (when it's closer to the ship)

 

local Distance = ( ( ShipVec2Mod.x - ChopperVec2.x ) ^ 2 + ( ShipVec2Mod.y - ChopperVec2.y ) ^2 ) ^ 0.5 -- Distance between the helicopter and the ship

 

if Distance < 1500 then

 

local OrbitCloseTask = { id = 'Orbit', params = { pattern = "Race-Track", point = ChopperVec2, point2 = ShipVec2Mod, speed = CloseSpeedKmh / 3.6, altitude = 100 }}

Chopper:getController():setTask(OrbitCloseTask)

 

 

elseif Distance > 1500 then

 

local OrbitFarTask = { id = 'Orbit', params = { pattern = "Circle", point = ShipVec2Mod, point2 = ShipVec2Mod, speed = FarSpeedKmh / 3.6, altitude = 100 }}

Chopper:getController():setTask(OrbitFarTask)

 

end

 

if Loop == 1 then

return time + 60

end

end

 

timer.scheduleFunction(OrbitScheduler, Loop, timer.getTime() + 1)

 

 

 

Test mission + script file attached (the huey will land on the normandy on bingo fuel)

Huey Orbit Test.miz

Huey Orbit Ship Test.lua

Edited by Hardcard
Posted

....

Test mission + script file attached (the huey will land on the normandy on bingo fuel)

 

Thanks a lot .. I learn so much studying your sample scripts :)

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar

Mobile: iPad Pro 12.9" of 256 GB

Posted
Thanks a lot .. I learn so much studying your sample scripts :)

 

Well, it's not a perfect solution by any means, just a workaround that has caused me way more pain than I anticipated :lol:

 

Btw, I edited the script in the spoiler, there's a line that's not needed and another that needs to be modified.

 

Cheers!

Posted

There is a way to trick DCS into having helos escort Naval vessels but it involves slowing your Carrier Group down to 6 kts max and adding a line to the lua of AI helos. It could be JSGME'd to work.

Callsign: NAKED

My YouTube Channel

 

[sIGPIC][/sIGPIC]

Posted

Btw, I edited the script in the spoiler, there's a line that's not needed and another that needs to be modified.

 

OK, I'm really amazed at all the tasks that scripting can handle .. I hope someday to be able to write my own ..

 

For my single player missions I do ok with conventional triggers and flags, but I'm starting to get my feet wet in Multiplayer mission editing and at that point, the triggers fall far short as its too cumbersome to keep track of every player status, I want to be able to use data structures to track each player ... mostly to keep scoring and recording achievements ... so, study it is! :D

 

Best regards

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar

Mobile: iPad Pro 12.9" of 256 GB

  • Recently Browsing   0 members

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