xvii-Dietrich Posted May 25, 2019 Posted May 25, 2019 What I want to do Have a trigger activate, whenever I land the player's helicopter (e.g. an SA342M Gazelle) on a FARP. What I have done so far Place the FARP Place a trigger zone on the FARP big enough to cover the landing pads. Create a "3 Switched Condition" trigger Set the conditions as follows: - Unit inside trigger zone - Unit speed < 1 km/h - Unit AGL altitude < 12 - Unit bank in limits -3 .. 3 - Unit pitch in limits -3 .. 3 Set the trigger action (display a message) In case it helps, I've attached the "minimum working example" mission. Note, I am using plain DCS (no fancy scripting tools, external programmes, etc.) It sort of works but there are some problems. Problems A very-close-to-ground hover (but not actually landed) will set the trigger off. I know that I could get the AGL altitude tweaked further, but this is very difficult to do, especially when the FARP is on slightly sloped ground (so each landing pad will be a different AGL altitude). Also, when getting very close, the trigger will go off multiple times. I know that this is because the helicopter is right on the edge of one of the limits (perhaps speed lower-than) and as it goes in and out of limit, it keeps triggering. Any suggestions? Does anyone have any ideas on how I could improve the above or otherwise effectively determine if a helicopter is properly on the FARP? Thanks!FARP-Landing-v1.miz
Ramsay Posted May 25, 2019 Posted May 25, 2019 Any suggestions? Does anyone have any ideas on how I could improve the above or otherwise effectively determine if a helicopter is properly on the FARP? Belsimtec's Huey UN Campaign What Belsimtec do in their Huey UN Campaign is set their landing conditions to check for : • Zone (inside) • Altitude (below xxx m) • VSI (between +/- 1) • Collective Down (between 0 and 0.2). Note: AFAIK you can only check the collective position in single player. BST use X: COCKPIT ARGUMENT IN RANGE (200, 0, 0.2, "") where 200 = collective argument for the Huey. This means the landing condition is only met when the Huey has landed in the Zone and the pilot has pushed the collective all the way down. Changing the code to read the Gazelle's Collective Checking : • DCS World\Mods\aircraft\SA342\Cockpit\arg_int.lua • DCS World\Mods\aircraft\SA342\Cockpit\clickabledata.lua it looks like 104 = collective argument for the Gazelle. so you might test something like X: COCKPIT ARGUMENT IN RANGE (104, 0, 0.2, "") if the mission you are making is for single player. Unfortunately, it's a while since I played with the Gazelle's arguments, so don't know if the above code is correct/works and YMMV. i9 9900K @4.8GHz, 64GB DDR4, RTX4070 12GB, 1+2TB NVMe, 6+4TB HD, 4+1TB SSD, Winwing Orion 2 F-15EX Throttle + F-16EX Stick, TPR Pedals, TIR5, Win 11 Pro x64, Odyssey G93SC 5120X1440
Majinbot Posted May 25, 2019 Posted May 25, 2019 I think the event script should work: https://wiki.hoggitworld.com/view/DCS_event_land PC: i7-13700K - Gigabyte RTX 5080 GAMING OC - 64GB DDR5 6400 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + LG OLED 32GS95UE - TrackIR5 - Quest 3
Hardcard Posted May 25, 2019 Posted May 25, 2019 (edited) @xvii-Dietrich As Majinbot mentioned, I think the simplest solution is to use a LAND event, combined with a simple landing zone check (perhaps you don't even need the zone check). EDIT: I've attached a scripted version of your test mission + script file. I've simply modified the unit name of the gazelle client and the name of the FARP. The script I've written will detect any landing event from the gazelle client, then send you a landing message ONLY when it lands on that FARP (I didn't need the trigger zone in the end): local Gazelle_Client = Unit.getByName("Gazelle_Leader") local Event_Handler = {} function Event_Handler:onEvent(Event) if Event.id == 4 and Event.initiator == Gazelle_Client and Event.place:getName() == "FARP_Landing" then trigger.action.outText(Gazelle_Client:getName().." landed on "..Event.place:getName(),10) end end world.addEventHandler(Event_Handler)FARP-Landing-Scripted.mizFARP landing detection test.lua Edited May 25, 2019 by Hardcard [sIGPIC][/sIGPIC]
xvii-Dietrich Posted May 26, 2019 Author Posted May 26, 2019 Thank you everyone for your help and suggestions. It is greatly appreciated. The "Collective" idea is clever, and initially I went for that. However, it turned out a to be a little problematic, because the collective position can be affected by weight (fuel, loadout, etc.). This made it quite fiddly to set up. The LUA script idea turned out to be more reliable, even though it was more complex (I'd not tried injecting LUA into a mission before, so needed to do a lot of reading to understand what was going on). One change I made to the script that @Hardcard provided was to add a trigger.action.setUserFlag() function. local Gazelle_Client = Unit.getByName("Gazelle_Leader") local Event_Handler = {} function Event_Handler:onEvent(Event) if Event.id == 4 and Event.initiator == Gazelle_Client and Event.place:getName() == "FARP_Landing" then trigger.action.outText(Gazelle_Client:getName().." landed on "..Event.place:getName(),10) trigger.action.setUserFlag(10,1) end end world.addEventHandler(Event_Handler) This then allows me to have other things trigger off the landing (such as a vehicle driving over to meet the helicopter, etc..) These could be in the script too, I guess, but it was easier for me to keep the script simple, and work on the actions in the editor where there are no chances of me making syntax errors. Also, in case it helps anyone, the LUA script is activated at the mission start. So there is a "4 MISSION START" trigger, with no conditions and an action "DO SCRIPT FILE", into which you load the script you want. This is in the example that @Hardcard provided, but I just wanted to draw attention to how the script is started. So, it's all working now. Thanks again for the help!
Recommended Posts