Jump to content
Sign in to follow this  
Gareth_Sims

Help with Unit removal

Recommended Posts

Hi I am creating a mission and I have a script running to delete units at a set distance to the player, I want to have some NPC units that are set at a location for the player to loot, however the script I am using deletes them as well as the units I need it to.

The command =

0=[] spawn {while {true} do {sleep 1;{if (_x distance player>=500) then {deleteVehicle _x}} forEach allUnits}}

is there any way I can leave the units I want by changing anything is this command or will this not work??

Cheers for any help.

Share this post


Link to post
Share on other sites

forEach allUnits-[unit1,unit2]

where unit1-2 are the names of the units you want to remove from the array

Share this post


Link to post
Share on other sites
forEach allUnits-[unit1,unit2]

where unit1-2 are the names of the units you want to remove from the array

Hi and thanks for the response, is there a way to use this solution to remove entire selected Groups rather than say [unit1,unit2] would [group1,group2] work? there are a lot of groups to be removed with this :)

Share this post


Link to post
Share on other sites
0= [] spawn {while {true} do {sleep 1;{_grp = units _x;{if (_x distance player >= 500) then {deleteVehicle _x}} foreach _grp} foreach   (allgroups-[grp1,grp2])}}

Share this post


Link to post
Share on other sites

Legends, thank you both for your time :) will test out after work

Works like a charm :) thank you guys again

Edited by Gareth_Sims

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  

×