// nul = [this] execVM "nearestBpos.sqf"
_unit = _this select 0;
_building = nearestBuilding _unit;
_odist = 99999;
_i = 0;
_sel = 0;
while { (_building buildingPos _i) distance [0,0,0] > 0 } do {
_dist = (_building buildingPos _i) distance _unit;
if (_dist < _odist) {
_sel = _i;
_odist = _dist;
};
_i = _i + 1;
};
_unit setPos _building buildingPos _sel;
_unit setUnitPos "UP";
Here is another old snipped that is very easy to use. It doesn't fill a house but it automatically places an object at the nearest available building position.
Though this probably isn't that useful anymore, now that we have 3DEN. ^^