Jump to content
Sign in to follow this  
lucilk

remove BIS_fnc_spawnGroup vehicles

Recommended Posts

Can anyone tell me please how can i remove vehicles spawned with BIS_fnc_spawnGroup.

Its working with just infantry squads, but if its motorized or tank platoon you cant delete the vehicles.

I tryed this:

{{deleteVehicle _x} forEach crew _x;} foreach units tankplatoon;

{deleteVehicle _x} foreach tankplatoon;

{deleteVehicle _x} foreach vehicles tankplatoon;

{{deleteVehicle _x} forEach vehicles _x;} foreach units tankplatoon;

and more...

Share this post


Link to post
Share on other sites

Can you spawn vehicles with spawnGroup? Or, are you using BIS_fnc_spawnVehicle and getting the crew? :)

If the latter, then an array is returned, where the first element (select 0) is the vehicle. I haven't tried, but if tankplatoon is the variable for the spawned group and vehicle, you could deleteVehicle (tankplatoon select 0) and I think it would work (for just the vehicle).

The variable select 1 is the array of objects, though, too. So, if you used tankplatoon = [parameters] BIS_fnc_spawnVehicle, something like:

tankGroup = tankplatoon select 1
{deleteVehicle _x} foreach tankGroup;

Or even:

{deleteVehicle _x} foreach (tankplatoon select 1);

That might work, too.

Share this post


Link to post
Share on other sites

nop its not working...

i even tryed "select 0"

take a look at this:

motgroup = [getpos infspawnpos, side player, (configFile >> "CfgGroups" >> "West" >> "USMC" >> "Motorized" >> "USMC_MotInfSection")] call BIS_fnc_spawnGroup;

well it spawns ok but when i try to delete it its not woking, and its not the units , its the vehicles that i cant delete

Share this post


Link to post
Share on other sites

I noticed you're using "vehicles" in the code above... Its "vehicle" really.

I am using this algorithm in my editor spawn script to delete the editor vehicles, adapted to what you have:

_unitsInGroupAdd = [];
_unitsInGroup = units motgroup;
{
 _vcl = vehicle _x;
 if (!(_vcl in _unitsInGroupAdd) AND (typeOf _vcl != "")) then {
  _unitsInGroupAdd = _unitsInGroupAdd + [_vcl];
   _crew = crew _vcl;
  { deleteVehicle _x; } forEach _crew;
  deleteVehicle _vcl;
 };
 sleep 0.01;
} forEach _unitsInGroup;

Dont think I missed something but you never know lol.

You could probably check if the unit is a certain type of vehicle too, this is a generic piece of code.

Edited by Murklor

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  

×