Jump to content
Sign in to follow this  
sold67

Converting a small script

Recommended Posts

Hi, I am not a scripter and having some trouble converting a script to where it is run only (If that makes any sense).

I want it to delete all vehicles that are unoccupied in a defined range, so here is what I am currently using that runs via dev tool, but straight up deletes every vehicle:

 _vehicle = nearestObjects [player, ["Car","Air"], 50];
{ deletevehicle _x } forEach _vehicle;  

Here is one I found which deletes only unocupied vehichles, but since I don't script I can't convert it! I would love any help it is driving me crazy.

case 123: // Carmagedon
       {

               _distance = parseNumber(_inputText);

               if ((typeName _distance) == (typeName (1234))) then {

                               player groupchat format["Starting Carmagedon at a range of %1 meters", _distance];

                               {
                                       {              
                                               if ({alive _x} count crew _x == 0) then {
                                                               deleteVehicle _x;
                                                       };
                                       } foreach((getpos player) nearObjects [_x, 15]);
                               } forEach ["LandVehicle", "Air", "Car", "Motorcycle", "Bicycle", "UAV", "Wreck", "Wreck_Base", "HelicopterWreck", "UH1Wreck", "UH1_Base", "UH1H_base", "AH6_Base_EP1","CraterLong", "Ka60_Base_PMC", "Ka137_Base_PMC", "A10"];
                       } else {
                               hint "ERROR: expected number";
                       };

       };

Thank you.

Share this post


Link to post
Share on other sites

If you want to delete any unoccopied vehicle in the area, use that:

 _vehicle = nearestObjects [player, ["Car","Air"], 50];
{
if (count crew _x == 0) then {
deletevehicle _x;
};
} forEach _vehicle;

If you want to delete any unoccopied vehicle in the area that is alive, use that:

 _vehicle = nearestObjects [player, ["Car","Air"], 50];
{
if ((alive _x) && ((count crew _x) == 0)) then {
deletevehicle _x;
};
} forEach _vehicle;

Share this post


Link to post
Share on other sites

You're a hero! Thank you ever so much.

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  

×