El Rabito

Delete objects on Roads

4 posts in this topic

I try to clean the roads on the map because 10 million wrecks and trash-piles just look stupid.
I found a script to do this, but i struggle with adding a road check. The script should only remove objects on roads.

Anyone could help me out ? Cheers

Quote

/*
Ex: null = [] execVM "clean.sqf // Defaults to marker named "center" and 50m radius (unless it's an area marker).
    null = ["myOtherMarker"] execVM "clean.sqf // Cleans around a marker named "myOtherMarker" with 50m radius (unless it's an area marker).
    null = ["myUglyBackyard", 200] execVM "clean.sqf // Cleans 200m around a marker named "myUglyBackyard" (unless it's an area marker).
*/

// Defaults
params [["_marker", "center"], ["_area", 50]];

// Types of junk to clean.
_junk = ["LAND_WRECK", "WRECK", "DATSUN01T","DATSUN02T", "WRECK_UAZ_F", "WRECK_HMMWV", "GARBAGEPALLET_", "GARBAGEWASHINGMACHINE_", "HILUXT"];

// Area marker flag
_markerArea = false;

// If we're an area marker sort sizes to get the largest size and set the area flag for later.
if (markerShape _marker in ["ELLIPSE", "RECTANGLE"]) then {
    _shape = markerSize _marker; // Returns the size, ie [50, 70]
    _shape sort false; // Sort the area array, ie now [70, 50]
    _area = _shape select 0;  // Set area to the largest size
    _markerArea = true;  // Set flag for later
};

{
    _item = _x;  // Current item in search area list

    // If we're an area marker check that the object is actually within the marker.  Ie, 65m away from the 50m side for example.
    if (_markerArea && !(getPosWorld _item inArea _marker)) exitWith {};

    // If we're in the area compare the object name to the _junk list.  If we match hide the object.
    if ({(toUpper(str _item) find _x >=0)} count _junk > 0) then {
        hideObjectGlobal _item;
    };
} foreach nearestTerrainObjects [markerpos _marker, ["HIDE"], _area];

 

Edited by El Rabito

Share this post


Link to post
Share on other sites
Advertisement

I tried it on chernarus_2035. I tried some stuff with isOnRoad but i couldn't get it to work. It's working for the map but i only want to remove the objects on roads.

Share this post


Link to post
Share on other sites

Hey @El Rabito Maybe this code from spawn vehicles on roads will help. I think you will need to use: nearRoads

    _road = getPos ([7700, 8500, 0] nearRoads 11000); call BIS_fnc_selectRandom);
    _position = [_road, 0, 5, 5, 0, 99999, 0] call BIS_fnc_findSafePos;

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.