Jump to content
Sign in to follow this  
zuff

Quick Helicopter Insertion Question

Recommended Posts

What would be the reverse of this code?

{alive _X && !(_X in crew heli)} count (units groupname) <= 0

I got the code from this old thread: http://forums.bistudio.com/showthread.php?t=79235&highlight=group+heli

What I'm trying to do is set this to a waypoint away from the insertion point so that the helicopter waits until all 'groupname' are disembarked before taking back off.

The problem is sometimes when the 'player' or squad leader unloads at the point the helicopter takes off with the rest of my AI crew still on board.

I've tried:

{alive _X && !(_X [b][color="Red"]out[/color][/b] crew heli)} count (units groupname) <= 0

which failed. Then I tried:

(not ({alive _X && !(_X in crew heli)} count (units groupname) <= 0))

which also failed.

I appreciate your help in advance! :)

Share this post


Link to post
Share on other sites

Have you tried a dogetout unitname at your drop off waypoint in it's on activation box, this should force them out and the heli won't go until they are?

Share this post


Link to post
Share on other sites

I use an eject script that works flawlessly and it waits until everyone has been booted out of the helicopter and then it takes off.

Let me know if you want it.

Share this post


Link to post
Share on other sites

Hello.

Just use a waitUntil statement.

waitUntil

{

({(group _x == my_grp)&&!(_x in my_chopper)}count allUnits == {group _x == my_grp}count allUnits)

};

This will wait until everyone from group my_grp gets out of a chopper called my_chopper.

_neo_

Edited by neokika

Share this post


Link to post
Share on other sites
Have you tried a dogetout unitname at your drop off waypoint in it's on activation box, this should force them out and the heli won't go until they are?

No I didn't try this. Will this force eject them at the waypoint? I thought force ejects were only available by loading in scripts?

---------- Post added at 01:55 PM ---------- Previous post was at 01:54 PM ----------

I use an eject script that works flawlessly and it waits until everyone has been booted out of the helicopter and then it takes off.

Let me know if you want it.

I'm fairly new to editing so if you think I maybe able to grasp it then sure I'd love it if you could send it to me.

Share this post


Link to post
Share on other sites
Let me know if you want it.

Of course people want it, that's why this forum is here! :) hehe

Any time you have useful code, just go ahead and post it. No sense in keeping it to PMs or asking if someone really wants it before posting. Unless the author has asked not to share of course.

Always posting good code makes Search far more useful.

Share this post


Link to post
Share on other sites
Hello.

Just use a waitUntil statement.

This will wait until everyone from group my_grp gets out of a chopper called my_chopper.

_neo_

First Question:

I'm at work so I can't try this now but why would you count allUnits?

Wouldnt just this code work?

waitUntil
{
{(group _x == my_grp)&&!(_x in my_chopper)}
}

I'm guessing that allUnits is counting all units in that group but I dont see where or how that's happening.

Second Question:

Say I get this to work, I would like the helicopter to wait like 5 seconds after the last person the group leaves it, so it gives plenty of time for units to clear the LZ. How would I go about this?

Share this post


Link to post
Share on other sites
Hello.

Just use a waitUntil statement.

This will wait until everyone from group my_grp gets out of a chopper called my_chopper.

_neo_

I tried this statement and put it in the condition field and got a Type nothing expected bool error. Did I put it in the wrong place?

Share this post


Link to post
Share on other sites
Of course people want it, that's why this forum is here! :) hehe

Any time you have useful code, just go ahead and post it. No sense in keeping it to PMs or asking if someone really wants it before posting. Unless the author has asked not to share of course.

Always posting good code makes Search far more useful.

Haha well it was very early in the morning I was about to go to bed and was way too tired to post it.

Anyway this is how you should set up your insertion

Where your helicopter unload waypoint is, make a invisible H object underneath it and make a trigger with this in the condition and act fields

Condition -

player in thislist;

change (player) to whatever your group leaders name is

Act -

_xhandle = [group1,helicopter] execvm "Eject.sqf";

Change the activation to Blufor and repeatedly set the axis to about 50,50 enough to where the helicopter will land inside of the trigger

What this will do is when the helicopter lands and you get kicked out it will then fire off the script seeing if it has the nesseary requirements to eject your squad out of the helicopter. It will then finish and move onto the next way point.

On the transport unload waypoint set the timeout to about 6 seconds on each box so it has enough time for each unit to get out of the way of the helicopter before taking off. Also on the "On Act" box of the waypoint add this in to it

doGetOut units group player;

(player) being your groups leaders name.

Here is the script you should save as Eject.sqf

_group = _this select 0;
_vehicle = _this select 1;
_height = (position _vehicle) select 2;
if ( _height > 10 ) exitwith {hintsilent format ["%1, the %2 height is above 10m (current height: %3), unsafe to eject.", name player, typeOf _vehicle, _height]};

if ( (typename _group != "GROUP") or (typename _vehicle != "OBJECT") ) exitwith {
hintSilent "Invalid Parameters parsed";
};

sleep 1;

{
unassignvehicle _x;
_x action ["EJECT", _vehicle];
sleep 0.5;
} foreach units _group;

Edited by Toasticuss

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  

×