Facocero Posted February 7, 2022 Posted February 7, 2022 Hi everyone! A quick question. Is there a more effective way for a trigger to fire exactly when a helicopter lands? So far I have done as usual, using conditions: Unit's Vertical Speed in limits min - 1 max 1 Unit's Speed Lower Than 2 Kts Unit's AGL Altitude lower Than 2 but I am not satisfied, in fact it happens that by staying for a few seconds in overing at 4-5 feet on the trigger, it activates and I do not find it very realistic. Thanks for any advice
Sedlo Posted February 7, 2022 Posted February 7, 2022 Hey @Facocero! Use a simple script that uses an EVENT HANDLER like this to achieve what you want. You can put the script in the actions under "Do Script". I've attached a sample script and a sample mission for you to check out. helounit = Unit.getByName('BLACKHAWK 601') -- Put your unit NAME in where BLACKHAWK 601 is. Make sure to keep the apostrophe in Handler = {} function Handler:onEvent(event) if event.id == world.event.S_EVENT_LAND and event.initiator == helounit then trigger.action.outText('The Helicopter has landed.', 10, true) -- You can put some text here if you'd like trigger.action.setUserFlag ('10', 1) -- this sets flag 10 to be on. Replace the 10 with whatever you want. end end world.addEventHandler(Handler) HELO LAND.miz 1 My Youtube Channel MY DCS MISSIONS
Facocero Posted February 7, 2022 Author Posted February 7, 2022 Thank you Sedlo I will definitely use it 1
BoundaryLayer Posted November 27, 2023 Posted November 27, 2023 On 2/7/2022 at 11:07 PM, Sedlo said: put the script in the actions under "Do Script" Hi, Sedlo. I wonder if there's such a script used to put under Condition - Lua Predicate.
Sedlo Posted November 27, 2023 Posted November 27, 2023 4 minutes ago, BoundaryLayer said: Hi, Sedlo. I wonder if there's such a script used to put under Condition - Lua Predicate. Possible, but I haven't used that before. My Youtube Channel MY DCS MISSIONS
BoundaryLayer Posted November 27, 2023 Posted November 27, 2023 10 minutes ago, Sedlo said: Possible, but I haven't used that before. Are there docs or guidance on this? I've searched on the forum, but most answers are scripts used for "Do Script", while I wish to simply use the script on the condition.
NeedzWD40 Posted November 27, 2023 Posted November 27, 2023 12 minutes ago, BoundaryLayer said: Hi, Sedlo. I wonder if there's such a script used to put under Condition - Lua Predicate. if(Unit.getByName("unitname")) then if(Unit.getByName("unitname"):inAir() == false) then return true else return false end else return false end You'll need another condition for initialization otherwise the condition will return true if the unit starts on the ground, like a flag once the unit takes off.
BoundaryLayer Posted November 27, 2023 Posted November 27, 2023 7 minutes ago, NeedzWD40 said: if(Unit.getByName("unitname")) then if(Unit.getByName("unitname"):inAir() == false) then return true else return false end else return false end Thanks, NeedzWD40, this works! 7 minutes ago, NeedzWD40 said: You'll need another condition for initialization I get your idea here that the script checks if the unit is still inAir or not. From other answers I see people also use world.event.S_EVENT_LAND. I wonder if this can be combined to your script. BTW, where can I find docs on this, as I've just started playing with scripts in ME.
NeedzWD40 Posted November 27, 2023 Posted November 27, 2023 10 minutes ago, BoundaryLayer said: BTW, where can I find docs on this, as I've just started playing with scripts in ME. The hoggit wiki is the best place to start as they update the commands frequently. As for the landing event, it wouldn't help much since the unit would return on the ground on the event's trigger. inAir also works with more than just aircraft, so you could use it to check if a cargo crate is in the air or on the ground for example.
BoundaryLayer Posted November 27, 2023 Posted November 27, 2023 4 minutes ago, NeedzWD40 said: The hoggit wiki is the best place to start as they update the commands frequently. As for the landing event, it wouldn't help much since the unit would return on the ground on the event's trigger. inAir also works with more than just aircraft, so you could use it to check if a cargo crate is in the air or on the ground for example. Thanks! Will dive into this
Recommended Posts