Jurugi 10 Posted November 6, 2010 Hey, I was wondering if theres a way to check for whether a vehicle has a unit inside it, because I'm making a 'remove empty vehicles' script that removes all the empty vehicles every half hour or so. Thx Share this post Link to post Share on other sites
kyfohatl 10 Posted November 7, 2010 (edited) I would also be interested in this, just for the sake of learning how to deal with unnamed units in a script, and how to identify them given that they have something in common (e.g. they are empty vehicles). My way of doing this would be to create a trigger that spans all across the map, set to activation by "ANYBODY" and "PRESENT" and the init line of: VehicleDeleteFunc = thisList execVM "EmptyVehicleRemoval.sqf" And in "EmptyVehicleRemoval.sqf" (a bit of a "one-liner", I know): private ["_unitList","_unitType","_N0Crew"]; while {true} do { _unitList = _this; {_unitType = typeOf _x; if (_unitType isKindOf "LandVehicle") then { _N0Crew = count crew _x; if (_N0Crew == 0) then { deleteVehicle _x;};};} foreach _unitList; // Waits for half an hour sleep 1800; }; I've tested it and it works :). Though there are a few problems with it: 1. It removes the vehicle even if it has been only left empty for 2 seconds (though it shouldn't be too hard to put a time parameter in as well). 2. Vehicles that have no crew, or whose crew have dismounted work fine. However vehicles whose crew have been killed are not removed apparantly because dead people in a vehicle still count as crew (I think). So I guess if you change "count crew" to something else it might work. Also if you use an automatic body removal script (there's plenty of them here), this problem should be fixed because the bodies are removed. Hope it helps Regards kyfohatl Edited November 7, 2010 by kyfohatl Share this post Link to post Share on other sites