Pourune exprience personnalise et scurise,nous utilisons des cookies pour amliorer votre visite,adapter nos publicits et analyser les performances du site.Pour en savoir plus sur vos choix,consultez notre politique de gestion des cookies.
Google Maps permet d'afficher des cartes interactives. Google Analytics permet de mesurer notre audience. Google Ads permet de suivre les visites sur notre site
scriptlaser.com provenant de nos annonces publicitaires payantes sur le rseau de recherche Google. Google Tag Manager est utilis pour amliorer les statistiques.
Hey folks, I spent a little bit of time working on this script to create a laser beam effect. You can attach a particle system to it to create some sparks at contact point. I suggest placing the script in an empty game object that is aligned with your weapon so it rotates with it.
nice that you publish it but if you want people to also use it you should always include licensing information. something posted in the internet is not automatically free to use (for those hwo care about their legal status).
if you dont care what happens with this code and dont require credits you should consider the WTFPL - Wikipedia or Public domain - Wikipedia.
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!
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.
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.
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!
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.
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
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
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.
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
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.
3a8082e126