Guest Posted March 17, 2021 Ive eliminated this problem from happening 90% of the time, but it still occurs from time to time, so i want to eliminate it fully This is a vehicle-based mission and all units are using vehicles, i need a script to repeatedly check if any BLUFOR infantry units exist, and to kill them if they are not in a vehicle. need it to be running the whole scenario thonks EDIT:SOLVED IT after consulting a couple of peeps, this script worked unitCheckLoop = true; while {_unitCheckLoop} do { { if (vehicle _x == _x) then { deleteVehicle _x; }; } foreach (units blufor); sleep 60; }; --- Though due to the presence of a respawn script in my mission i had to change the deletevehicle to "_x setdamage 1;" and it still worked fine Share this post Link to post Share on other sites
gc8 981 Posted March 17, 2021 { if(vehicle _x == _x) then // is on foot? { deleteVehicle _x; }; } foreach (units blufor); put that script in a loop. should do it Share this post Link to post Share on other sites
stanhope 412 Posted March 17, 2021 Would a getout event handler not be better? 2 Share this post Link to post Share on other sites
gc8 981 Posted March 17, 2021 38 minutes ago, stanhope said: Would a getout event handler not be better? yes but depends on how he is spawning the tanks. Share this post Link to post Share on other sites
Guest Posted March 18, 2021 7 hours ago, gc8 said: yes but depends on how he is spawning the tanks. Im using Dreadpirate's Editor Based Unit Spawning script, so the units appear in the editor, but in scenario they seem to be deleted at start, only to appear when their respective trigger activates 8 hours ago, gc8 said: { if(vehicle _x == _x) then // is on foot? { deleteVehicle _x; }; } foreach (units blufor); put that script in a loop. should do it Im not sure how to do loops but ill try to the best of my ability tonks Share this post Link to post Share on other sites
Guest Posted March 18, 2021 I've tried this, and the game says there's an issue with _x being an undefined variable while {true} do { if (vehicle _x == _x) then { deleteVehicle _x; }; sleep 60; } foreach (units blufor); Share this post Link to post Share on other sites
Guest Posted March 18, 2021 _unitCheckLoop = true; while {_unitCheckLoop} do { { if (vehicle _x == _x) then { deleteVehicle _x; }; sleep 60; } foreach (units blufor); }; In a discord server someone gave me the above script, shows no errors but doesn't do anything Share this post Link to post Share on other sites
beno_83au 1369 Posted March 18, 2021 At a guess, it's because units blufor isn't returning any units. Is there a group that you've called blufor? Share this post Link to post Share on other sites
Guest Posted March 18, 2021 6 minutes ago, beno_83au said: At a guess, it's because units blufor isn't returning any units. Is there a group that you've called blufor? No need, i got it fixed, this works unitCheckLoop = true; while {_unitCheckLoop} do { { if (vehicle _x == _x) then { deleteVehicle _x; }; } foreach (units blufor); sleep 60; }; Share this post Link to post Share on other sites