Jump to content

GazDesignate - Laser Designator Script for SA342M - Gazelle


CakeSorbus

Recommended Posts

Hey helicopter pilots,

 

if you (like me) just can't wait any longer for the OH-58D to finally be released, and want to get in on the action of designating targets for our fast and high flying buddies a little earlier, I created something that might interest you!

 

This script adds the ability for Pilots of the SA342M to designate ground targets by laser.

 

It includes the following features:

 

  • -Configurable laser codes and laser code presets
  • -Automatic tracking of the Viviane LOS and recalculation of the lased point
  • -Configurable snapping function to automatically snap the laser to nearby targets
  • -Lasermodes: IR (Visible in NVG), Laser, or both
  • -Configurable load time before menu options are created
  • -No MIST or MOOSE needed

 

Laser configuration and activation is done through options in the F10 radio menu, I highly recommend the use of macros. To that end I included an option in the config section of the script that allows you to delay the creation of the menu entries. That way you can control where in the F10 menu the scripts main menu option is located.

 

How do you load the script?

 

Including the script in missions works similar to CTLD. First you must enter the pilot names of all Gazelles, you want to use the script with, into the list of names at the top of the script. The name must be the same as the one specified in the Field "Pilot Name" in the mission editor.

Please note that the script only works with the M-variant of the gazelle. All other Gazelles will be ignored.

 

While you have the script open anyway, maybe take the time and see if the options for delaying the menu creation are configured to your liking.

You can also enter lasercodes into the provided list, or change existing ones. Please note that only the last 10 entries in the list are loaded into the ingame radio menu.

 

Once you made your adjustments, don't forget to save. Now, to get the script into you mission, you have to set up a trigger that performs a "DO SCRIPT FILE" action at the beginning of the mission. To do that either use a trigger of the type MISSIONSTART or use a ONCE trigger, with a condition of TIME MORE (x seconds). 

 

Now you should be all set up. After entering a Gazelle M you should first get a message, that tells you that GazDesignate is loading. After a few seconds (or more, depending on how you configured it) the loading message will update to tell you that the script has loaded. Check the F10 - Other radio menu. There you should now find an entry that says "Laser designator". Congratz, you are ready to go!

 

How do you use it?

 

If you take the time to read the menu entries, the use of the script should be quite self explanatory. I will only highlight a few things.

 

The range setting is only there in case the automatic laser point calculation fails or is to inaccurate. Note that I included an option to make relative changes to the range currently dialed in. I have macros bound to these options...very useful for quick adustments. You can check the accuracy of the automatic range calculation by comparing the number it returns on laser activation or slewing, to the number your rangefinder in the Viniane gives you. If the deviation is higher than the blast zone of the weapons you want to lase onto your target, you need to make some manual adustments. Range adustments can be done while the laser is active. Note that I included a snapping function that can be configured in the script file. Per default the snapping distance is set to 30 m. This means that, once the script has calculated a target point for the laser, it searches for units within a radius of 30 m around that point. If it finds a unit, the laser is automatically pointed at the position of that unit. You can turn off the snapping function by setting the search distance in the config section to 0.

 

Once you activate the laser in one of its modes, the activation options are removed. Instead you get a "turn off" option. If the option for deactivating the laser sits at the same place where the "Designate (Laser) option was before, so it can be accessed by the same macro. I'd like to take credit for that, but it's just a "happy little accident", that i had not planned for but am more than happy about!

 

Once the laser is turned on, it will automatically follow the sights orientation, the laser point is recalculated at an interval that you can adjust in the config section of the script file. Out of the box the script recalculates every 0.1 seconds, but only if the sight has been moved. I use a Ryzen 7 3700X and the cpu load induced by the recalculation doesn't rise above the "background noise", but on some smaller cpus, or on servers with a high player load, there may be permormance issues. Thus I included the option to increase the interval between recalculations. The more acute the angle to the ground gets, the less accurate the calculated range will be. Curiously the deviations in the calculated ranges provided by the script are about the same in magnitude as the deviations in the measurements with the Gazelles own rangefinder.

 

As you know, the Gazelle is not really that stationary in auto hover, but is always swinging side to side and up and down. Therefore I had to dampen the sensitivty of the script to orientation changes of the sight a little bit, because otherwise it would constantly try to recalculate the laser spot. This dampening is mostly felt on the y-axis of the sight. The x-axis has less variation and can be updated at a higher resolution. My recommendation: When lasing targets in the distance (>5000 m), first place the sight left or right from the target and then, with the laser activated, slew the sight over the target. Sometimes you have to wiggle around for a bit, but you should in most cases be able to get the laser to recognize the target. If that method fails, you can still put in the range manually. 

 

When first starting it, or slewing it around, the laser is only stabilized in the horizontal axis, I recommend to only adjust the lased point from a leveled out hover position. When the laser is active, and you don't manually move it, it should stay on the position targeted by the Viviane sight, even if you move your helicopter. Abrupt maneuvers will still cause the laser to veer of.

 

One minor bug stills exists, that I could not yet snuff out: When you have the autopilot in slave mode, it does not update the horizontal orientation of the laser on rotation of the helicopter, only once you wiggle the sight up and down a little, it will update. Probably a mistake in the logic of the script, I will look into that some more.

 

How does it work?

 

The script uses the functions spot.createLaser, spot.createInfraRed, spot.setPoint and spot.setCode to create and update the laser.

The orientation of the Viviane sight was a bit more tricky, but I found out that you can use Unit.getDrawArgumentValue(), to access the curent animation state of the Viviane sight (ArgumentValue 215 and 216). The rest was math (and a bit of logic)!

 

A quick note on how the range calculation works. The main problem that I faced was that I could not acces the rangefinder readings through the scripting engine. Manually entering 5 digit ranges through the F10 menu is not exactly convenient so I tried to find a way to calculate the range with the numbers I had: Helicopter altitude (BARO and AGL) and heading + vertical angle of the Viviane sight. I first attempted trigonometry, but that only worked (semi-accurately at best) in cases where the target area was significantly lower than the helicopter and at about the same elevation as underneath the helicopter. In all other cases the results where highly inaccurate or just plain wrong.

I ended up having to "brute force" the diagonal range to the target area: I run a for loop that calculates the elevation of points increasingly further away from the helicopter along the Vivianes LOS. The calculated elevation is checked against the land height at the given point (land.getHeight).

The point where the calculated elevation slips below the land height is where the laser from the rangefinder touches ground. I first run a loop with very high distances between the checks. The range resulting from that loop is then fed into the next one, that works with smaller intervals. This cycle continues until I'm down to increments of 0.1 m. In that way I can calculate a very accurate diagonal distance without having to run a loop that checks from 1-20000 with increments of 0.1.

Changelog

 

2021/02/24 v. 1.2 - new version is attached to this post

  • Fixed a minor bug that prevented status messages from being shown when changing the laser code digit per digit
  • Tweaked the sensitivity to changes in sight orientation, laser spot follows the sight orientation more closely now

 

2021/03/11 v. 1.3 - new version is attached to this post

  • Script now returns the coordinates of the targeted point in LatLong-Format (decimal minutes) and MGRS as a message
  • Message display time for information about the targeted point can now be configured in the script

 

2021/03/19 v. 1.4 - new version is attached to this post

  • Laser would not activate after respawning - fixed (hopefullly)

 

Known Bugs

  • none at this time, if you find one please report it as a reply to this thread (with attached log file, please)


 

 

 

 

 

 

 

 

 

GazDesignator.lua


Edited by CakeSorbus
Script Update
  • Like 1
  • Thanks 5
Link to comment
Share on other sites

Looking forward to trying this.  A couple of questions:

 

1) do you place this in the Scripts folder, or the Scripts/Hooks folder?

 

2) will this work with other scripts such as CTLD, MOOSE, MIST?

 

3) What do I enter in the DO SCRIPT field?  "GazDESIGNATOR"? I thnk it is just do script file command.

 

Thanks,


Edited by AKA_Clutter

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

Hey Clutter,

 

regarding your questions:

1) No, you only have to load the script in your mission with the "DO SCRIPT FILE" action, the script will then automatically be included within the .miz file. You don't have to place it anywhere manually

 

2) Yes, CTLD, MOOSE and MIST will continue to function normally while this script is loaded.

 

3) Exactly, just use the "DO SCRIPT FILE" action

Cheers

Cake

Link to comment
Share on other sites

CakeSorbus,

 

Thanks for the response.  I have a test mission constructed and hope to test with the Squad tonight.

 

Another question.

 

Once I have built the mission, it looks like I have to go into the miz file and edit the script there, and not the one I have in the Script folder.  Is that correct, or am I doing something wrong.  I am new to including scripts, and haven't done much ME in YEARS.

 

Thanks,

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

CakeSorbus,

 

Just got through doing a test with 4 pilots, one Gazelle.

 

Worked pretty smooth.  I have some things that I need to workout in learning how it works, and setting up my controls (the radio menu is the friendliest for those in VR).  

 

Overall I think I would say like the chef guy says "Winner Winner Chicken Dinner" 

 

This has breathed life back into the Gazelle, while waiting for the KW

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

22 hours ago, AKA_Clutter said:

CakeSorbus,

 

Thanks for the response.  I have a test mission constructed and hope to test with the Squad tonight.

 

Another question.

 

Once I have built the mission, it looks like I have to go into the miz file and edit the script there, and not the one I have in the Script folder.  Is that correct, or am I doing something wrong.  I am new to including scripts, and haven't done much ME in YEARS.

 

Thanks,

You got the basics right, in the end the script file that is in the .miz file must be updated. There's an easier way to do that, though:

1. Make your changes in the script file in your scripts folder

 

2. Reselect the script file in the ME in the "DO SCRIPT FILE" action.

 

3. Save your Mission.

 

The updated version of the script file has now been copied into the .miz file.

Link to comment
Share on other sites

3 hours ago, CakeSorbus said:

 

 

2. Reselect the script file in the ME in the "DO SCRIPT FILE" action.

 

THAT is the step I was missing.  THANKS once again.

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

CakeSorbus,

 

I built a little test mission and put 4 Gazelle Ms in it.  I tested each one separate and all seem to work iirc.

 

However, tonight we did a test with 3 and 4 in the Gazelles and only 2 of them would work.  the others would show the menu, but F5 would not designate.  

 

Is there a limit on the number of Gazelles that can lase?

 

Could the problem be in us joining the choppers to close together (i.e., within 30 seconds of each other?

 

Thanks

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

Hmm...there is a bug that causes the laser to stop functioning after leaving and then reentering a slot. I'm currently still working on a fix for that.

Not sure if that's whats causing you problem, though.

Can you please send me your logfile of the session? That would be a great help. You find your logfile in Saved Games/DCS/Logs/dcs.log

Note that this file only logs your last session, if you played DCS in between testing the script and reporting the bug, it won't be of any help to me. In that case please cause the bug to trigger again and then send me your fresh logfile directly afterwards.

 

Cheers

Cake

Link to comment
Share on other sites

Thanks CakeSobus.

 

I'll download the new version and try and test over the weekend.

 

Skalute!

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

Me again.  🙂

 

Downloaded v1.4 and did some test today with the squad.  Didn't have enough pilots to actual test dropping ordnance from multiple planes, but it did allow 3 pilots to get in gazelle and designate something.

 

Also it looks like if I am in slot 1 and exit I can't rejoin in slot 1.  However, Slot 2 can join Slot 1 and Slot 1 can join Slot 2 and we can both designate.

 

I did note that is some cases the GM12 hit a target close to the one I was lasing, but not the one I was lasing.  Hope to do more test.  I need to learn how to actually drop from an 18 when someone else is designating.

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

5 hours ago, AKA_Clutter said:

Me again.  🙂

 

Downloaded v1.4 and did some test today with the squad.  Didn't have enough pilots to actual test dropping ordnance from multiple planes, but it did allow 3 pilots to get in gazelle and designate something.

 

Also it looks like if I am in slot 1 and exit I can't rejoin in slot 1.  However, Slot 2 can join Slot 1 and Slot 1 can join Slot 2 and we can both designate.

 

I did note that is some cases the GM12 hit a target close to the one I was lasing, but not the one I was lasing.  Hope to do more test.  I need to learn how to actually drop from an 18 when someone else is designating.

Try to leave a 10 second gap between leaving a Gazelle slot and rejoining it...the script checks for empty slots every 10 seconds and then removes their radio menu options so they can be recreated when the slot is populated again.

 

The problem with the wrong target being designated might be related to the snap to target function the laser has. Try setting GazDesignate.ToleranceGaz in the config section to a lower value to reduce the radius around the calculated target point that is searched for targets.

Link to comment
Share on other sites

  • 1 month later...
19 hours ago, damienntrix said:

very good job, your mod is a must.
would it be possible to transpose it to ka-50 by taking the ka canon as a reference?

Technically it's a just a script, not a mod. 😛

The Ka-50 cannon has an animation for its movement, so I think it is possible to adapt the methods I used in my script and create a similar functionality for the Ka-50.
Of course you'd have to change the calculations that work in the background as well.

I personally am not interested in extending my script to include the Ka-50 since I'm not a big fan of that helo and also mostly work on this at the moment, but if you want to give it a try, feel free to lift any code you can use from my script.

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
On 7/5/2021 at 7:03 PM, Mercian said:

Awesome work! I got into the Gaz recently and thought "If only this thing had a laser designator" and here you are with this gem. Thank you.

Thanks! ☺️ I'm always happy for feedback (especially if it's positive).

Let me know if you run into any issues with my script.

Link to comment
Share on other sites

No problems at all, works beautifully. I've actually been tinkering with it to make a single player AFAC mission where you can call in AI air support to attack the targets you're designating. Again, works like a charm.


Edited by Mercian
Link to comment
Share on other sites

  • 1 month later...
2 hours ago, S. Low said:

Is it possible to adapt this to the L model?

Sadly not, that's due to the design of the Lima's sight, which does not have an external moving part when the sight is slewed up and down. This in turn means that there's no animation state that I can grab by script command and use to calculate the vertical component of the aim point of the sight.


Edited by CakeSorbus
  • Thanks 1
Link to comment
Share on other sites

  • 7 months later...

This seems insanely amazing and just what I want right now, here's hoping it still works gonna play later 🙂

(played around a little seems to work ok, will play more this evening with humans opens so many doors)


Edited by shinobi61
update
Link to comment
Share on other sites

  • Recently Browsing   0 members

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