Jump to content

Air unit to follow ground unit/ship - basic scripting


Sickdog

Recommended Posts

Objective: I'm trying to get a helicopter to follow a ship (or even a ground unit) using basic scripting (I'd prefer not to use MOOSE, MIST, etc).

 

Problem: I can't get helicopter to follow a naval unit or a ground unit with basic scripting, but I can get it to follow an air unit no problem. Yet, the Hoggitworld documentation says it should be possible: "Controlled aircraft will follow the assigned group along their route in formation. If the assigned group is on the ground the AI will orbit overhead. If assigned to a flight lead or group its wingmen will stay in their specified formation." I did notice that using ME, there is no option to follow a ground unit, only an air unit, which makes me wonder about the accuracy of the above statement from Hoggitworld. I see "Escort ground unit" works but doesn't give me the desired results. I want the helo to follow a ship in a perfect formation, like Funkyfranky's Rescue Helo-Carrier Formation 24/7 example.

 

my research:

- I've done an endless search on these forums for an answer or point in the right direction already, doesn't look like anyone else has asked this.

- I've already read the Hoggit world page on "DCS TASK FOLLOW" here:

https://wiki.hoggitworld.com/view/DCS_task_follow

 

- I've done a lot of trial and error with no luck. I can get a helo to follow another helo or fixed wing, but it ignores my script to follow a ground unit. I've tried various ground units to no avail.

- When I try to load a script to follow a naval unit or just type the script text in DO SCRIPT, DCS crashes with tons of messages in the log, I think the most important one is:

 

EDCORE: # C0000005 ACCESS_VIOLATION at BD7F4FC6 00:00000000

 

I noticed when the optional escort "params" lastWptIndexFlag and lastWptIndex are not included, it doesn't crash. I've toyed with their values to no avail as well.

 

-I've used and looked at the "Rescue Helo-Carrier Formation 24/7" and I see it works great using MOOSE, and my understanding (I'm still rather new at scripting) is that anything that can be done in MOOSE or MIST can be done with a little more work using basic scripting. I've also tried to dig into the MOOSE lua files to see how it's done but I can't make much sense of it. But it must be possible!

 

The code I've been using is:

 Follow = {
 id = 'Follow',
 params = {
   groupId = Group.ID,
   pos = Vec3,
   lastWptIndexFlag = boolean,
   lastWptIndex = number
 }    
}

 

and I've tried the example:

 

 local followTask = {
 id = 'Follow',
 params = {
   groupId = 5,
   pos = {x = 200, y = 0, z = -100,
 }    
}
Group.getByName('follower'):getController():pushTask(followTask)

 

I did notice that there's what I think is an extra comma after the z coordinate, I've tried the code with and without it, and with and without the optional params.

 

 

 

Anybody have any info, tips, or ideas for what I'm doing wrong or whether or not this is even possible using basic scripting?

 

Thanks a ton in advance for any comments/help!


Edited by Sickdog
additional info with the code I'm using

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

You should be able to get it to follow a ground unit using the basic mission editor commands. If you setup the Helo as Task Escort, the advanced waypoint actions will allow you to TYPE = Perform Task > Action = Ground Escort, the ground group should then be selectable as the unit to escort. I've tried it with a ship and this won't work so can't help you there...

Windows 10 64 bit | Intel i5-9600k OC 5 Ghz | RTX 2080 |VENGEANCE® LPX 32GB DDR 4 OC 3200

 

Hotas Warthog | Logitech G Flight Rudder Pedals | Track IR 4

Link to comment
Share on other sites

Not an answer you are looking for, but.... the whole purpose of MOOSE (and MiST) is to make using the DCS scripting API more "user-friendly", which it does most successfully. Curious why the resistance to using it.

 

Hmm, good question and was sort of expecting someone to ask. I guess the answer is two fold.

1) I’m trying to use scripting to enhance naval operations and not much more, so i don’t really need all the functionality of MOOSE/MIST and I’d rather load less scripts. I once had an issue with MOOSE running and another script running so wanted to avoid that as well.

2) This might be harder to explain but I get a strange satisfaction out of using the bare scripting. I realize this is a stupid reason and won’t get much empathy for my problems when I have them scripting but just being honest. :)

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Hmm, good question and was sort of expecting someone to ask. I guess the answer is two fold.

1) I’m trying to use scripting to enhance naval operations and not much more, so i don’t really need all the functionality of MOOSE/MIST and I’d rather load less scripts. I once had an issue with MOOSE running and another script running so wanted to avoid that as well.

2) This might be harder to explain but I get a strange satisfaction out of using the bare scripting. I realize this is a stupid reason and won’t get much empathy for my problems when I have them scripting but just being honest. :)

 

What you can do is examine how Moose / Mist does it and then write it yourself. In the end both systems are using the DCS API so you'll see what calls and how it's done.

 

In the end you'll probably write 10-20 times more code (maybe even more) than you would just using Moose or Mist.

Link to comment
Share on other sites

 

 local followTask = {
 id = 'Follow',
 params = {
   groupId = 5,
   pos = {x = 200, y = 0, z = -100,
 }    
}
Group.getByName('follower'):getController():pushTask(followTask)

 

I did notice that there's what I think is an extra comma after the z coordinate, I've tried the code with and without it, and with and without the optional params.

 

Remove that comma, pos table has no further values, so that comma shouldn't be there.

 

Also, your followTask table isn't closed, you're missing the final }

 

Here's a corrected version:

 

local followTask = {
 id = 'Follow',
 params = {
   groupId = 5,
   pos = {x = 200, y = 0, z = -100}    
  } 
}
Group.getByName('follower'):getController():pushTask(followTask)

 

 

As for a solution to your problem, I can't get into it right now, but I'm sure that either Funkyfranky or Grimes will be able to help with this.


Edited by Hardcard
Link to comment
Share on other sites

What you can do is examine how Moose / Mist does it and then write it yourself. In the end both systems are using the DCS API so you'll see what calls and how it's done.

 

In the end you'll probably write 10-20 times more code (maybe even more) than you would just using Moose or Mist.

 

Thanks- I’ve tried to look under the hood of MOOSE, but really couldn’t make sense of how they did it. You’re right, maybe I’m just being stubborn and in the end need to use MOOSE for this purpose, but I appreciate your response.

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Remove that comma, pos table has no further values, so that comma shouldn't be there.

 

Also, your followTask table isn't closed, you're missing the final }

 

Here's a corrected version:

 

local followTask = {
 id = 'Follow',
 params = {
   groupId = 5,
   pos = {x = 200, y = 0, z = -100}    
  } 
}
Group.getByName('follower'):getController():pushTask(followTask)

 

 

As for a solution to your problem, I can't get into it right now, but I'm sure that either Funkyfranky or Grimes will be able to help with this.

 

 

Thanks Hardcard (or as I used to call you accidentally, Hardcore, haha), I noticed those errors too and did fix them in my code, I just literally copied and pasted from the Hoggitworld page, so it’s a typo on that page. I should have mentioned that in the original post. I’d get scripting errors if used that code so i quickly figured that out. But still doesn’t work with those fixes added.

 

Yeah, sorta hoping Grimes chimes in here, he might know if this is even possible with “Follow” or if I have to get creative/use MOOSE to have a helo follow a ship.

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

@Sickdog

 

Remember the script I gave you for the offset landing point on that cargo ship?

 

Let's see if I can find it... here it is

 

You can try your luck with MOOSE, see if :RouteToVec3() works with the offset pointVec3 returned by that script.

 

If it doesn't work, DCS task mission looks like a promising alternative (or not :D) .


Edited by Hardcard
Link to comment
Share on other sites

If you don't want to script it and would rather do it in ME then this video should help. SUNTSAG has some great ME vids to follow. He also posts some great mods here in the forums

 

 

Thanks, not quite what I’m looking for, ME for this functionality doesn’t give much control over the rescue helo but it’s the way I’ve been doing it to date. Trying to get a helo to follow a ship using scripting without MOOSE/MIST is my objective.

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Having been trying to accomplish the same goal for quite a while, but no luck so far. Thought it would be as easy as setting the speed of the helo and carrier to the same, then soon noticed in game that the helo will slowly drift away...

 

Tried to open the "F/A-18C Carrier Takeoff" Quick Action mission file in ME, found nothing in it... weird...

 

Sorry for not being able to help at all. As a formal SW Engineer, I do understand your insists of not using script framework for this specific task. Stubborn, maybe, but it is such efforts and enthusiasts that keeps our SW neat and tidy, collectively providing better performance and user experience...

 

Well, guess the only value, if any, that I'm trying to contribute here is merely showing my support......:D

 

Anyway, keep it up.

i9-9900K, G.Skill 3200 32GB RAM, AORUS Z390 Pro Wifi, Gigabyte Windforce RTX 2080 Ti, Samsung 960 Pro NVMe 512G + 860 Pro 1T, TM Warthog HOTAS, VKB T-Rudder, Samsung O+

F/A-18C, F-16C, A-10C, UH-1, AV-8B, F-14, JF-17, FC3, SA342 Gazelle, L-39, KA-50, CEII, Supercarrier Preordered. (Almost abandoned: CA - VR support please?)

PG, NTTR

Link to comment
Share on other sites

Having been trying to accomplish the same goal for quite a while, but no luck so far. Thought it would be as easy as setting the speed of the helo and carrier to the same, then soon noticed in game that the helo will slowly drift away...

 

Tried to open the "F/A-18C Carrier Takeoff" Quick Action mission file in ME, found nothing in it... weird...

 

Sorry for not being able to help at all. As a formal SW Engineer, I do understand your insists of not using script framework for this specific task. Stubborn, maybe, but it is such efforts and enthusiasts that keeps our SW neat and tidy, collectively providing better performance and user experience...

 

Well, guess the only value, if any, that I'm trying to contribute here is merely showing my support......:D

 

Anyway, keep it up.

 

Thanks for the support Ravenzino, I know most people won’t understand why I don’t just use Funkyfranky’s awesome rescue helo Moose script (which I have played with and it’s really cool!!). Ultimately I might just have to submit to using Moose for this, was hoping to get a simple YES/NO answer from Grimes as he seems to know the capabilities/limitations of the scripting engine well. With a little luck maybe he’ll chime in whether air units can “follow” air AND GROUND units like the hoggitworld documentation indicates. I’m leaning towards “no” and it’s just a typo, should read air units can only “follow” air units. “Escort” doesn’t yield the same results as there’s a lot of orbiting of the following unit. In the end, following ground units isn’t what I want anyway, just wanted to start there, but if that doesn’t work then I have no hope for following a ship. Just confused as it appears that’s the Task that MOOSE is using! I’m so confused.

 

But to help you, if all you want is the helo to fly by the CVN’s side, not do anything else or turn with the ship, may I suggest you uncheck the G/S option for the helo and check the ETA box. In fact, I’d suggest you do the same for the carrier, set your waypoints up, jot down the time the carrier hits the waypoints, make the helo waypoints right next to the CVN’s waypoint and set the ETA exactly the same. You’ll notice the ground speed listed (where you normally set it) will change depending on the ETA, and you’ll see it’s much more precise (within a tenth of a knot or whatever unit you’re using). This tenth of a knot is not usually shown, I think there might be some rounding going on behind the scenes or something else going on that causes our rescue helos to fall behind or fly ahead of the CVN. But using ETA’s should keep them happily holding hands much better, at least in a straight line. ;)

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

  • Recently Browsing   0 members

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