Jump to content

How to detect landing on a FARP


xvii-Dietrich

Recommended Posts

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

Link to comment
Share on other sites

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.7GHz, 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 10 Pro x64, 1920X1080

Link to comment
Share on other sites

@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.miz

FARP landing detection test.lua


Edited by Hardcard
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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