# Tajin :
// 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. ^^
Oh heck it is, Eden is amazing, hell yes.
But if you really want to make a big mision you need to script them in otherwise you lagging u *ss off. cheers
# Pierre MGI :
I discovered recently, nearestBuilding doesn't work for edited buildings (all maps) or the embedded houses on Unsung map. I don't know the behavior with the other modded maps.
So, I had to write:
_building = nearestObject [_unit,"house"];
instead of
_building = nearestBuilding _unit;
And this helped by the fact a wall isn't a house but a building, so you don't want to spawn something at every walls!. Small objects like small transmission tower (looking like a pole) remains houses (and buildings of course)...
This is why it didn't work everywhere...
aiight thankS! :D