Jump to content
Comrade Cheeki Breeki

[Solved] Way to make a helicopter take off after certain units have exited?

Recommended Posts

I've been trying to make a sequence where you fly in on a helicopter with your squad, land, the pilot and copilot wait for you and your squad to get out, and then they continue. I have a "LAND" waypoint and invisible helipad making the landing simple, and the next waypoint is a "MOVE" waypoint that takes the helicopter out of sight and deletes it. However, in its current state, the helicopter will land and then immediately take off again and proceed to the next waypoint. I understand why this happens, but the issue I am stuck on is how to check if the units are inside the vehicle or not. I know you would have to put it in the Condition section of the land waypoint, but I don't know what to put there. I tried listing off every unit and making it

if (unit !in helo_intro) then {true} else {false};

(unit being the unit specified, just have that repeated a bunch) but apparently !in isn't valid. I thought about making an array that contained the units that were outside the helicopter, and as each one exited they were added to the array, and then it would check if everyone in the squad was in that array before returning true, but I don't even know where to begin with that. I would really appreciate some help.

Edited by Comrade Cheeki Breeki
solved

Share this post


Link to post
Share on other sites
if !(_unit in _helo) then {
	//They're out
	} else {
	//They're still in
};

The ! is in the wrong spot.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, Comrade Cheeki Breeki said:

I've been trying to make a sequence where you fly in on a helicopter with your squad, land, the pilot and copilot wait for you and your squad to get out, and then they continue. I have a "LAND" waypoint and invisible helipad making the landing simple, and the next waypoint is a "MOVE" waypoint that takes the helicopter out of sight and deletes it. However, in its current state, the helicopter will land and then immediately take off again and proceed to the next waypoint. I understand why this happens, but the issue I am stuck on is how to check if the units are inside the vehicle or not. I know you would have to put it in the Condition section of the land waypoint, but I don't know what to put there. I tried listing off every unit and making it


if (unit !in helo_intro) then {true} else {false};

(unit being the unit specified, just have that repeated a bunch) but apparently !in isn't valid. I thought about making an array that contained the units that were outside the helicopter, and as each one exited they were added to the array, and then it would check if everyone in the squad was in that array before returning true, but I don't even know where to begin with that. I would really appreciate some help.

 

As @beno_83au stated, the exclamation mark is in the wrong spot.

To check if a group is inside/outside a vehicle:

crew _chopper arrayIntersect units _infGroup isEqualTo [];//returns true if all units of the group are outside the chopper

count (units _infGroup select {_x in crew _chopper}) isEqualTo count units _infGroup;//returns true if all units of the group are inside

Cheers

  • Like 3

Share this post


Link to post
Share on other sites
19 hours ago, Grumpy Old Man said:

 

As @beno_83au stated, the exclamation mark is in the wrong spot.

To check if a group is inside/outside a vehicle:


crew _chopper arrayIntersect units _infGroup isEqualTo [];//returns true if all units of the group are outside the chopper

count (units _infGroup select {_x in crew _chopper}) isEqualTo count units _infGroup;//returns true if all units of the group are inside

Cheers

 

Works out great, thanks man! I learn something new every time I visit this forum.

Share this post


Link to post
Share on other sites

Also, worth mentioning:

If you need to add another condition then use () like so:

if (!(_unit in _heli) && ...) then {} else {};

 

  • Like 2

Share this post


Link to post
Share on other sites
45 minutes ago, HazJ said:

Also, worth mentioning:

If you need to add another condition then use () like so:


if (!(_unit in _heli) && ...) then {} else {};

 

 

Ok, thanks! That was the original way I was trying to do it but couldn't get it to work (didn't put the parentheses around each condition) but the arrayIntersect method helped me out. I'm a real scrub when it comes to arma scripting so these things really help me.

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

×