Jump to content
Sign in to follow this  
magicpanda

Delete Units as they get into a Vehicle.

Recommended Posts

I'm trying to set up a kind of Evac APC for basic squad manangement in a sandbox type environment.

 

Basically the player tells the Unit in thier group to get into the back of a crewed APC and after a few secs they are deleted from the player group and from the mission altogether.

 

The key is keeping the APC intact and only deleting units from my group. There is a reinforcement script at work so I dont think I can just name all my units.

 

I've got a shonky version kind of working via a trigger placed over a crewed APC with activation "any group member present". 

 

on Act

evac = createGroup west; [thislist select 0] join evac; sleep 1; { deleteVehicle _x; } forEach units evac;

or something like this

thislist select 0 setVehicleVarName evac; deleteVehicle evac

However it goes tits up when you order more than one squad member near or into the APC or doesn't work at all.

 

I'm pretty sure there is a better way to do this but googling all sorts of things has brought up nothing.

 

Also, is there a way to run scripts on AI units in my team selected with the Function Keys or on AI units in a team? e.g. Team Yellow.

Share this post


Link to post
Share on other sites

I'm a bit confused why you're creating a new group just to make a unit join it, and be deleted afterwards.

 

For the unit deletion upon entering a vehicle the GetIn eventhandler would be a perfect fit.

APCNAME addEventHandler ["GetIn",{

_delete = _this spawn {

params ["","","_unit"];
sleep 5;
deletevehicle _unit;


};

}];

For the scripts running on selected units you could use assignedTeam.

 

Cheers

 

Darn you, F2k. Heh.

Share this post


Link to post
Share on other sites

If you still want use a trigger method, name your APC   "apc"  and there is the code:
 
cond:   

 { _x  in apc } count thisList > 0;

onAct:

nul = [] spawn {sleep 5; { [_x] joinSilent grpNull;  deleteVehicle _x; } forEach crew apc;};

This is doing the same as the code post above .

Share this post


Link to post
Share on other sites

Cheers chaps, I know my way around the editor well but my scripting knowledge is limited hence trying odd things :)

 

This is all a bit lost on me. Will have a proper look later.

APCNAME addEventHandler ["GetIn",{

_delete = _this spawn {

params ["","","_unit"];
sleep 5;
deletevehicle _unit;


};

}];

Share this post


Link to post
Share on other sites
 

If you still want use a trigger method, name your APC   "apc"  and there is the code:
 
cond:   

{ _x  in apc } count thisList > 0;

onAct:

nul = [] spawn {sleep 5; { [_x] joinSilent grpNull; deleteVehicle _x; } forEach crew apc;};

This is doing the same as the code post above .

 

 

Cheers! Problem is you lose the APC crew as well which are used for area defence. 

Share this post


Link to post
Share on other sites

Ah . I though you want to make something like annihilate vehicle. :D

 

Well it that case paste the code from grumpy old man inside APC init field and its will do what you want.

Don't forget change the "APCNAME" to the proper vehicle name or just use "this".

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  

×