Jump to content
Sign in to follow this  
daza

Teamjump script problem

Recommended Posts

I have a script that is to be used when aboard a c130 and have your ai team with you, and you want to parachute into enemy territory together. It works fine, but if there are other ai members still on the ground they die.

So i want to check each unit in _par if they are actually in the plane, i thought i could do it this way, putting these lines into the loop.

if (vehicle _par select _i !=_veh) then

{_i=_i+1};

But the problem is if it checks and skips over a unit who isnt in the plane via _i=_i+1, what if the next unit after that is on the ground before it can loop back to the check (hope that sounds logical lol). I'd need a loop within the loop, which im not sure if you can do that with .sqf it might be easier to do in sqs with goto?

So perhaps i would need something before the loop, i suppose i need to take out the units not in plane out of the array list in _par. But how do i do that?

Thanks for your help guys

_veh = herc1;
_grp =group player;
_par = units _grp;
_i=0;
_j= (count _par);
while{_j>_i} do
{
unassignvehicle (_par select _i);
(_par select _i) action ["EJECT", _veh];
_i=_i+1;
sleep 0.5;
};

Share this post


Link to post
Share on other sites
What's wrong with a

{yourCrapHere;} foreach crew herc1;

?

And this.

Thanks for your reply Reimann.

This is going to be for a coop mission (i should of mentioned that), so if there are two human players onboard with their own ai squad, wouldnt that code eject everyone on board? i'm just wanting one group that activated the script via addaction. So if there are other players on board still, they wont be affected.

Share this post


Link to post
Share on other sites

Hmm.. one unit of several in a particular plane, but not those of the same group on the ground... how about

_unit = assignedCargo herc1;

if (_x == group player) then {
_x action ["EJECT", herc1];
}

forEach _unit;

Though 'group player' is probably wrong.

Share this post


Link to post
Share on other sites

If it's run from addaction, it means its local to the player. If the goal is to eject all units from his group, then wouldnt this work?

{_x action ["EJECT",vehicle _x]} foreach units group player;

Share this post


Link to post
Share on other sites
but if there are other ai members still on the ground they die.

Apparently not. (Though I haven't set up a scenario to test things myself.)

Edited by Reimann

Share this post


Link to post
Share on other sites
Apparently not. (Though I haven't set up a scenario to test things myself.)

I'm running through further testing. The ground units don't die now, previous they would for some reason. But since the latest patch, they just eject from a vehicle if they are in one on the ground.

Share this post


Link to post
Share on other sites
{if (_x in herc1) then {_x action ["EJECT",vehicle _x]}} foreach units group player;

Edited by Shuko

Share this post


Link to post
Share on other sites
{if (_x in herc1) then {_x action ["EJECT",vehicle _x]}} foreach units group player;

Thanks again Shk, that works! great! :D

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  

×