Jump to content
Sign in to follow this  
druminator

Activate trigger only when vehicle is unhooked from Heli?

Recommended Posts

So I have this mission where one part is to slingload a vehicle to a specific destination. So first I want to "Create Task" and when the vehicle is unhooked at the destination/trigger I want "Set Task State" to be succeeded.

Is there a way to set a trigger to be activated only when the vehicle has been unhooked from the Heli?

Any help/suggestions would be much appreciated!

Share this post


Link to post
Share on other sites

Make sure to only have the trigger run when you want it to:

isNull (getSlingLoad helicoptersName)

*May not work

Share this post


Link to post
Share on other sites

Awesome, will try it out!

Btw thanks for moving the topic, realised after that it was on the wrong section.

Edited by Druminator

Share this post


Link to post
Share on other sites

Hmm were do I put the code? In the trigger or init.sqf or maybe description.ext?

I tried to put this: isNull (getSlingLoad Heli1); in the condition on the trigger but it didn't work.

Share this post


Link to post
Share on other sites

Firstly, you need to make sure the trigger doesn't fire BEFORE the vehicle is hooked, because that's what will happen if you start your mission without the vehicle being hooked already. There are various (some "quick'n'dirrdy") ways to accomplish that.

My preferred solution would be to create the trigger dynamically after the vehicle has been hooked. If you prefer the ingame editor tho, you could setVariable to the trigger which is checked in its condition:

myFancyTrigger setVariable ["isHooked", true];
//in the trigger condition:
thisTrigger getVariable ["isHooked", false] && {isNull (getSlingLoad Heli1)}

(untested)

So that way, the isNull-check will only be executed when the "isHooked" variable in the trigger is true. You could also simply define a global variable, but as for clean coding purposes, you should avoid global variables where you can and if you have to use them, make their name unique to avoid accidently overwriting one.

Regards,

Johnny

Share this post


Link to post
Share on other sites
Note that EH will fire for each rope attached, so ensure that you throw in a check on the task state before setting it.

Good point, added note to BIKI already.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×