Earlier you were helping me write some Arma code. It was coming along fine but something glitched and you stopped responding. The code so far is:// Function to dynamically generate units
fnc_generateUnits = {
    params [“_unitTypes”, “_quantity”, “_distance”, “_spawnHeight”, “_minObjectDistance”];
    private [“_units”];
    // Initialize the units array
    _units = [];
    // Loop through each unitType
    {
        private [“_count”];
        // Generate _quantity number of units for the current unitType
        for “_count” from 1 to _quantity do {
            private [“_spawned”, “_position”, “_lineOfSightCheck”];
            _spawned = false;
            // Loop until a suitable spawn position is found
            while { ! _spawned } do {
                // Generate a random position within a specified radius
                _position = player modelToWorld [(random 2 * _distance) - _distance, (random 2 * _distance) - _distance, _spawnHeight];
                // Check line of sight from all players to the spawn position
                _lineOfSightCheck = true;
                {
                    if (lineIntersectsSurfaces [eyePos _x, _position, _x]) then {
                        _lineOfSightCheck = false;
                        exitWith {};
                    };
                } forEach allPlayers;
                // Check proximity to nearest objects of specific categories
                if (_lineOfSightCheck) then {
                    private [“_nearestObjects”];
                    // Get nearest objects of categories: “Building” and “AllVehicles”
                    _nearestObjects = nearestObjects [_position, [“Building”, “AllVehicles”], _minObjectDistance];
                    
                    // If any nearby object is within the minimum object distance, exit the loop
                    if (count _nearestObjects > 0) exitWith {};
                };
                // If there is no line of sight and no nearby objects, create the unit
                if (_lineOfSightCheck) then {
                    // Create a new unit of current unitType at the generated position
                    _unit = createUnit [_x, _position, [], 0, “NONE”];
                    // Add the created unit to the units array
                    _units pushBack _unit;
                    // Exit the loop
                    _spawned = true;
                };
            };
        };
    } forEach _unitTypes;
    // Schedule a check to remove units if all players are more than _distance away from them
    [] spawn {
        params [“_units”, “_distance”];
        waitUntil {
            private [“_playersNearby”];
            // Iterate through each unit
            {
                private [“_playersInRange”];
                // Get the number of players within _distance from the current unit
                _playersInRange = count (allPlayers select {(_x distance2D _unit) <= _distance});
                // If any player is within _distance, exit the loop
                if (_playersInRange > 0) exitWith {};
                // Store the count of players within _distance for the current unit
                _playersNearby = _playersInRange;
            } forEach _units;
            // If no players are within _distance of any unit, remove the units
            if (_playersNearby == 0) then {
                {
                    if (alive _x) then {
                        deleteVehicle _x;
                    };
                } forEach _units;
                // Exit the waitUntil loop
                true;
            };
            // Delay for some time before checking again
            sleep 10;
        };
    };
};