Jump to content
Sign in to follow this  
Khalashnikovf

How to check if the unit is inside of house? EDIT: or "behind"

Recommended Posts

Hello everyone, long time...

Well, I need some advice how to check if any "man" unit is inside of building.

I thought about search for position inside of house, but what if player stays not in that position?

I tried to use something like this:

_nObject = nearestObject [_unit, "house"];
if (_unit distance _nObject <= 8) then
{
   ......
};

It literally means, that if some unit is no more than 8 metres away of some house, he is inside.

Well, it has a few bugs :)

If the house is smaller, not working... if its not house, but some sign or railway, not working...

Does anyone has some solution? Pls help :(

EDIT: Forgot to mention, that I need to use this if that building is also not accesable, because I need to check if Im also "behind" that building.

And its also Military Bunker added via editor...

Edited by Khalashnikovf

Share this post


Link to post
Share on other sites

Since it's a bunker added by the editor just name it and check distance to it.

Share this post


Link to post
Share on other sites

Well, bunker is not the only one...I need really every building able in Arma 2 ... and there is that catch, only building. So Im going to do something like this:

if (_nObject isKindOf "Land_Hlidac_budka") then {_insider = 1.5; _behinder = 4; _survivor = 0.42; _stander = 0.56;};
if (_nObject isKindOf "Land_HouseB_Tenement") then {_insider = 16; _behinder = 29; _survivor = 1.35; _stander = 1;};
if (_nObject isKindOf "Land_HouseBlock_A1") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObject isKindOf "Land_HouseBlock_B1") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};

Kinda cruel and really complicated, but a lot of houses are summed up and Im even able to define diferent atributes for these houses :)

Its going to be Looong night....

Share this post


Link to post
Share on other sites

Why do you need this, what exactly are you trying to check and can you determine that in some other way?

Share this post


Link to post
Share on other sites

Its once again for my Nuke script. Im doing this because there is no otehr way how to improve survival chances for soldiers closer to Blast.

That what you see describes:

_nObjects = _this select 0;	// Array of Objects Closest to a player in range of 30 metres.

_insider = 0;	// Maximal distance for Inside area of building.
_behinder = 0;	// Maximal distance for building where it can act like "Behind" cover.
_survivor = 0;	// Multiplier of how much is building able to survive Blast (Standard is Brick small house: Inside=3/Behind=1.5)
_stander = 0;	// Can Unit survive while stands on feet inside/behind certain buidling?

So once I find my lovely building for that soldier, it will choose this coefs for his survival chances.

I got this already made, but now I just need something how to find all REAl houses. because if I just search for NearestObject "house" it will easily "Cover" him behind sign or street lamp :D

Share this post


Link to post
Share on other sites

Ahh I see. Another need for some kind of hasLOSto type command. Personally I'd just go with your first idea and if someone's within x meters of a "house" assume they were able to miraculously use it for cover. ;) Way easier to figure out.

Share this post


Link to post
Share on other sites

Yeah, people will know that street lamp is not good cover, but tell it to AI... :-/

And once some dude discovers that he can duck and cover behind sign, he will do it all time and experience would be completely killed by it :)

So ... I have almost 2/3 of Chernarus, so by tommorow will it be done.

But once I have you got here O:-)

Can you describe me pls how use this list in easiest way?

I thought something like Call xxxxx

But I dont have much exps with call stuff

So what should I need is in some place call this sqf which returns me 4 variable. How to do that? :)

And also would be kinda good to separate these list on Chernarus and Takistan... Is there any way how to recognize which map is launched?

Share this post


Link to post
Share on other sites

I got this already made, but now I just need something how to find all REAl houses. because if I just search for NearestObject "house" it will easily "Cover" him behind sign or street lamp :D

Just iterate on found objects and use boundingbox or sizeof function to measure their approximate size.

Share this post


Link to post
Share on other sites

ok im working with similar stuff so here is how you can find units inside a building of any dimension

_listNearObjects = nearestObjects [center point, ["house"], radiusofNuke];

// If buildings found

if ((count _listNearObjects) > 0) then {

would be to find buildings, it might be best to use this as a function of its own. To determine it as being an actual building, count the building positions inside the house, and check if 2 or more positions exist, then you know its a building.

After you have acquired your array of houses, you need to check for:

any units near any of these buildings

most likely in the form of:

for "_i" from 0 to ((count _listNearObjects) - 1) do {
{
_dist = _x distance (_listNearObjects select _i);
if (_dist < 50) then {
// check here
} foreach allunits
};

after wards you will check if the unit is inside the house:

_dimensions = boundingBox _i;
_WorldDimensionsMax = _i modelToWorld (_dimensions select 1);
_WorldDimensionsMin = _i modelToWorld (_dimensions select 0);

_xmin = _WorldDimensionsMin select 0;
_ymin = _WorldDimensionsMin select 1;
_zmin = _WorldDimensionsMin select 2;

_zmax = _WorldDimensionsMax select 2;
_ymax = _WorldDimensionsMax select 1;
_xmax = _WorldDimensionsMax select 0;

_unitposx = getpos _x select 0;
_unitposy = getpos _x select 1;
_unitposz = getpos _x select 2;

if (((_unitposx > _xmin) && (_unitposx < _xmax)) && ((_unitposy > _ymin) && (_unitposy < _ymax)) && ((_unitposz > _zmin) && (_unitposz < _zmax))) then {
// unit is in building
}; 

This isnt tested, and slight tweaks will need to be made to incorporate it into your script, but it should check for the actual distances of the buildings min x, y, and z, max x, y, and z, and compare to see if the unit is also within this range. max z is the roof of the building, so anything over z will equal them standing on a roof.

However bare in mind this does not work correctly if the building has balconies or multiple roof parts that differ in height. It will only return the max z of the model, not all individual z levels of different roofs. (So a dude on a balcony will survive the Nuke, or something dumb like that)

Share this post


Link to post
Share on other sites

Wow, looks really nice. Will check it later. I like the modeltoworld idea. that Could do the stuff much more better then just and aproximate radius.

But it will still do problems with buildings o L shape, right? :(

This all works fine for cornered standard buildings, but some non typical ...

But maybe these non typical could be check via nearestBuilding(and closest position in house) since almost all non typical buildings are accesable.

Share this post


Link to post
Share on other sites
Wow, looks really nice. Will check it later. I like the modeltoworld idea. that Could do the stuff much more better then just and aproximate radius.

But it will still do problems with buildings o L shape, right? :(

This all works fine for cornered standard buildings, but some non typical ...

But maybe these non typical could be check via nearestBuilding(and closest position in house) since almost all non typical buildings are accesable.

Is there a way to check and see what the model name of a building is and base something off of that? Ex. if myhouse = house_1_b.p3d then this setdamage 1 (I know that isn't correct scripting but it's an example).

Share this post


Link to post
Share on other sites
Wow, looks really nice. Will check it later. I like the modeltoworld idea. that Could do the stuff much more better then just and aproximate radius.

But it will still do problems with buildings o L shape, right? :(

This all works fine for cornered standard buildings, but some non typical ...

But maybe these non typical could be check via nearestBuilding(and closest position in house) since almost all non typical buildings are accesable.

no problem, and yes, problem with this is that if the building is a backsplit, or an irregular shaped house, or has a radio tower thats on top of the roof, the bounding box will return the highest point of the model, not essentially the roof.

And as Ive tried searching for a workaround for this, the only way to truly and accurately check would be to build a library of all buildings and their roof tops and interiors, and im still not too sure what I would be compiling in this library either (big array of positions? a grid of the top of the building?)

the only other method I could think of, would be to have a library of houses with a height of the lowest roof, and checking afterwards the model of the house, and if the units z axis is less than the height of lowest roof.

Share this post


Link to post
Share on other sites
no problem, and yes, problem with this is that if the building is a backsplit, or an irregular shaped house, or has a radio tower thats on top of the roof, the bounding box will return the highest point of the model, not essentially the roof.

And as Ive tried searching for a workaround for this, the only way to truly and accurately check would be to build a library of all buildings and their roof tops and interiors, and im still not too sure what I would be compiling in this library either (big array of positions? a grid of the top of the building?)

the only other method I could think of, would be to have a library of houses with a height of the lowest roof, and checking afterwards the model of the house, and if the units z axis is less than the height of lowest roof.

Perhaps you could figure out the four corners of each roof or perhaps 6 corners depending on shape. Then make it so that it will create a position in there. I've been trying to get window positions together and there aren't honestly that many building types although I'm just doing Takistan.

Share this post


Link to post
Share on other sites
Perhaps you could figure out the four corners of each roof or perhaps 6 corners depending on shape. Then make it so that it will create a position in there. I've been trying to get window positions together and there aren't honestly that many building types although I'm just doing Takistan.

unfortunately bounding box only returns 4 sides, and these may/may not be exactly on the roof, but somewhere in the objects box that encapsulates the entire thing.

ex.

---------------

i * * * I * * * i

i P P P P P P P i

i P * * * * *P i

i P * * * * *P i

where the I, is some object like a radio tower, or shape that isnt a roof.

Edited by Igneous01

Share this post


Link to post
Share on other sites

Well, I made some Library you have been talking about, its for Nuke script.,

This serves for finding closest building with actual shape and determinating if unit is inside or at least behind that building covered from Shockwave.

		if (_unit isKindOf "Man") then
		{
		_nObjects = nearestObjects [_unit, ["Building","House","Strategic","NonStrategic"], 40];

		if (count _nObjects > 0) then
		{
			{
				_bPa = _unit distance _x;
				_bPb = _pos distance _x;
				_bPc = _unit distance _pos;
				_priorityB = 0;
				_bParams = [_x,0,0,0,0];
				[_x,0,0,0,0] call BuildingListPreload;

				//player sidechat format ["%1, bPa:%2, bPb: %3, bPc: %4",_bParams,_bPa,_bPb,_bPc]; // this will show all available building class around unit 40 metres

				if (_bParams select 1 != 0 and _bParams select 2 != 0) then
				{
					if (_bParams select 1 >= _bPa) then {_priorityB = _priorityB + 100;};
					if (_bParams select 1 < _bPa and _bParams select 2 >= _bPa) then {_priorityB = _priorityB + 200;};
					if (_bParams select 2 < _bPa) then {_priorityB = _priorityB + 300;};
					if (_bPc < _bPb) then {_priorityB = _priorityB + 10;};
					_priorityB = _priorityB - (_bParams select 3);
					if (_priorityB < _priorityM) then {_priorityM = _priorityB; _bParamsM = _bParams;};
				};
			} forEach _nObjects;

And this is Library itself:

private ["_nObjectTry", "_insider", "_behinder", "_survivor", "_stander"];

_nObjectTry = _this select 0;	// Array of Objects Closest to a player in range of 30 metres.

_insider = _this select 1;	// Maximal distance for Inside area of building.
_behinder = _this select 2;	// Maximal distance for building where it can act like "Behind" cover.
_survivor = _this select 3;	// Multiplier of how much is building able to survive Blast (Standard is Brick small house: Inside=3/Behind=1.5)
_stander = _this select 4;	// Can Unit survive while stands inside/behind certain buidling? (because of a lot of windows or weak walls)

if (_nObjectTry isKindOf "Land_A_BuildingWIP") then {_insider = 12; _behinder = 18; _survivor = 1.35; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Bastion") then {_insider = 6; _behinder = 13; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Bergfrit") then {_insider = 3; _behinder = 8; _survivor = 1.18; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Donjon") then {_insider = 4; _behinder = 9; _survivor = 1.24; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Gate") then {_insider = 3; _behinder = 12; _survivor = 1.05; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall1_20") then {_insider = 1; _behinder = 10; _survivor = 1.02; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall1_20_Turn") then {_insider = 1; _behinder = 10; _survivor = 1.02; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall1_Corner") then {_insider = 1; _behinder = 4; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall1_Corner_2") then {_insider = 1; _behinder = 4; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall2_30") then {_insider = 1; _behinder = 8; _survivor = 1.01; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall2_Corner") then {_insider = 1; _behinder = 4; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall2_Corner_2") then {_insider = 1; _behinder = 4; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall1_End") then {_insider = 1; _behinder = 8; _survivor = 1.05; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall1_End_2") then {_insider = 1; _behinder = 8; _survivor = 1.05; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall2_End") then {_insider = 1; _behinder = 8; _survivor = 1.01; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Castle_Wall2_End_2") then {_insider = 1; _behinder = 8; _survivor = 1.01; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_FuelStation_Build") then {_insider = 3; _behinder = 9; _survivor = 0.85; _stander = 0.2;};
if (_nObjectTry isKindOf "Land_A_GeneralStore_01") then {_insider = 10; _behinder = 18; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_GeneralStore_01a") then {_insider = 10; _behinder = 18; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_Hospital") then {_insider = 10; _behinder = 25; _survivor = 1.05; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_A_Office01") then {_insider = 10; _behinder = 20; _survivor = 1.05; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_A_Office02") then {_insider = 10; _behinder = 21; _survivor = 1.05; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_A_Pub_01") then {_insider = 8; _behinder = 14; _survivor = 1.00; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_statue02") then {_insider = 1; _behinder = 6; _survivor = 1.00; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_A_TVTower_Base") then {_insider = 4; _behinder = 8; _survivor = 1.05; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_A_statue01") then {_insider = 1; _behinder = 6; _survivor = 1.00; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_Barn_Metal") then {_insider = 10; _behinder = 18; _survivor = 0.80; _stander = 1;};
if (_nObjectTry isKindOf "Land_Barn_W_01") then {_insider = 10; _behinder = 18; _survivor = 0.70; _stander = 1;};
if (_nObjectTry isKindOf "Land_Barn_W_02") then {_insider = 10; _behinder = 18; _survivor = 0.70; _stander = 1;};
if (_nObjectTry isKindOf "Land_Barrack2") then {_insider = 4; _behinder = 10; _survivor = 0.30; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_Church_01") then {_insider = 8; _behinder = 14; _survivor = 1.05; _stander = 1;};
if (_nObjectTry isKindOf "Land_Church_02") then {_insider = 8; _behinder = 16; _survivor = 1.12; _stander = 1;};
if (_nObjectTry isKindOf "Land_Church_02a") then {_insider = 8; _behinder = 16; _survivor = 1.12; _stander = 1;};
if (_nObjectTry isKindOf "Land_Church_03") then {_insider = 8; _behinder = 16; _survivor = 1.12; _stander = 1;};
if (_nObjectTry isKindOf "Land_Church_05R") then {_insider = 8; _behinder = 16; _survivor = 0.90; _stander = 0.85;};
if (_nObjectTry isKindOf "Land_ConcreteBlock") then {_insider = 1; _behinder = 6; _survivor = 1.15; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_Dam_Barrier_40") then {_insider = 1; _behinder = 12; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Dam_ConcP_20") then {_insider = 4; _behinder = 14; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Dam_Conc_20") then {_insider = 4; _behinder = 14; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Farm_Cowshed_a") then {_insider = 8; _behinder = 18; _survivor = 0.78; _stander = 0.84;};
if (_nObjectTry isKindOf "Land_Farm_Cowshed_b") then {_insider = 8; _behinder = 18; _survivor = 0.78; _stander = 0.82;};
if (_nObjectTry isKindOf "Land_Farm_Cowshed_c") then {_insider = 4; _behinder = 8; _survivor = 0.48; _stander = 0.55;};
if (_nObjectTry isKindOf "Land_Hangar_2") then {_insider = 12; _behinder = 28; _survivor = 0.92; _stander = 1;};
if (_nObjectTry isKindOf "Land_Hlidac_budka") then {_insider = 1.5; _behinder = 4; _survivor = 0.42; _stander = 0.56;};
if (_nObjectTry isKindOf "Land_HouseB_Tenement") then {_insider = 16; _behinder = 29; _survivor = 1.35; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseBlock_A1") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseBlock_B1") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseBlock_C1") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseBlock_D1") then {_insider = 10; _behinder = 16; _survivor = 1.05; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV_1I1") then {_insider = 8; _behinder = 15; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV_1I1_dam") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV_1I2") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV_1I4") then {_insider = 6; _behinder = 16; _survivor = 0.70; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV_2L_dam") then {_insider = 6; _behinder = 13; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV2_01A") then {_insider = 9; _behinder = 16; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV2_01A_dam") then {_insider = 9; _behinder = 16; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV2_01B_dam") then {_insider = 9; _behinder = 16; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV2_03_dam") then {_insider = 9; _behinder = 16; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV2_03B_dam") then {_insider = 9; _behinder = 16; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_HouseV2_05") then {_insider = 6; _behinder = 12; _survivor = 0.85; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Expedice_1") then {_insider = 10; _behinder = 20; _survivor = 1.10; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Garage01") then {_insider = 3; _behinder = 7; _survivor = 0.75; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Mlyn_01") then {_insider = 8; _behinder = 18; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Mlyn_02") then {_insider = 8; _behinder = 20; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Mlyn_03") then {_insider = 10; _behinder = 20; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Mlyn_04") then {_insider = 6; _behinder = 14; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Pec_01") then {_insider = 10; _behinder = 16; _survivor = 0.4; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_Ind_Pec_02") then {_insider = 10; _behinder = 24; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Pec_03") then {_insider = 10; _behinder = 24; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Quarry") then {_insider = 10; _behinder = 20; _survivor = 0.8; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_Ind_SawMill") then {_insider = 10; _behinder = 18; _survivor = 0.95; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_SiloVelke_01") then {_insider = 8; _behinder = 16; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_SiloVelke_02") then {_insider = 10; _behinder = 22; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Stack_Big") then {_insider = 6; _behinder = 12; _survivor = 0.85; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_TankBig") then {_insider = 1; _behinder = 8; _survivor = 1.05; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_TankSmall") then {_insider = 2; _behinder = 4; _survivor = 0.65; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_Ind_Vysypka") then {_insider = 12; _behinder = 24; _survivor = 0.85; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Workshop01_01") then {_insider = 4.5; _behinder = 8; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Workshop01_02") then {_insider = 4.5; _behinder = 8; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Workshop01_03") then {_insider = 4.5; _behinder = 8; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Workshop01_04") then {_insider = 4.5; _behinder = 8; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Workshop01_L") then {_insider = 4.5; _behinder = 8; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_Workshop01_box") then {_insider = 1.5; _behinder = 4; _survivor = 0.45; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_loco_742_blue") then {_insider = 1; _behinder = 8; _survivor = 0.65; _stander = 1;};
if (_nObjectTry isKindOf "Land_majak") then {_insider = 3; _behinder = 8; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Mil_Barracks") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Mil_Barracks_L") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Mil_Barracks_i") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Mil_ControlTower") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_Mil_Guardhouse") then {_insider = 5; _behinder = 12; _survivor = 1.00; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_Mil_House") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_Misc_PowerStation") then {_insider = 8; _behinder = 14; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Misc_WaterStation") then {_insider = 2; _behinder = 5; _survivor = 1.00; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_NAV_Lighthouse") then {_insider = 1; _behinder = 3; _survivor = 0.65; _stander = 1;};
if (_nObjectTry isKindOf "Land_Nav_Boathouse") then {_insider = 6; _behinder = 12; _survivor = 0.45; _stander = 1;};
if (_nObjectTry isKindOf "Land_Panelak") then {_insider = 8; _behinder = 15; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_Panelak2") then {_insider = 8; _behinder = 15; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_Panelak3") then {_insider = 8; _behinder = 15; _survivor = 0.90; _stander = 1;};
if (_nObjectTry isKindOf "Land_R_A_GeneralStore_01a") then {_insider = 6; _behinder = 14; _survivor = 0.80; _stander = 1;};
if (_nObjectTry isKindOf "Land_Rail_House_01") then {_insider = 3; _behinder = 8; _survivor = 0.85; _stander = 1;};
if (_nObjectTry isKindOf "Land_SS_hangar") then {_insider = 12; _behinder = 26; _survivor = 1.00; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_Shed_Ind02") then {_insider = 8; _behinder = 16; _survivor = 0.65; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_Tovarna2") then {_insider = 12; _behinder = 24; _survivor = 1.00; _stander = 0.6;};
if (_nObjectTry isKindOf "Land_ind_silomale") then {_insider = 8; _behinder = 16; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_komin") then {_insider = 1.5; _behinder = 6; _survivor = 0.6; _stander = 1;};
if (_nObjectTry isKindOf "Land_repair_center") then {_insider = 8; _behinder = 14; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_domek_zluty") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_hasic_zbroj") then {_insider = 4; _behinder = 9; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_stodola_old_open") then {_insider = 6; _behinder = 14; _survivor = 0.80; _stander = 1;};
if (_nObjectTry isKindOf "Land_stodola_open") then {_insider = 6; _behinder = 14; _survivor = 0.80; _stander = 1;};
if (_nObjectTry isKindOf "Land_wagon_box") then {_insider = 2; _behinder = 6; _survivor = 0.65; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_sara_domek_hospoda") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_domek_kovarna") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_domek_podhradi_1") then {_insider = 4; _behinder = 9; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_domek_ruina") then {_insider = 4; _behinder = 9; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_Domek_sedy") then {_insider = 4; _behinder = 9; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_domek_vilka") then {_insider = 8; _behinder = 15; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_stodola") then {_insider = 8; _behinder = 15; _survivor = 0.70; _stander = 1;};
if (_nObjectTry isKindOf "Land_sara_stodola3") then {_insider = 8; _behinder = 15; _survivor = 0.70; _stander = 1;};
if (_nObjectTry isKindOf "Land_nav_pier_m_2") then {_insider = 8; _behinder = 15; _survivor = 1.35; _stander = 1;};
if (_nObjectTry isKindOf "Warfare_HQ_base_unfolded") then {_insider = 2.5; _behinder = 6; _survivor = 1.15; _stander = 0.85;};
if (_nObjectTry isKindOf "StaticCannon_Preview") then {_insider = 0.1; _behinder = 2; _survivor = 0.15; _stander = 0.1;};
if (_nObjectTry isKindOf "Base_WarfareBBarrier5x") then {_insider = 1; _behinder = 4; _survivor = 0.8; _stander = 0.4;};
if (_nObjectTry isKindOf "Base_WarfareBBarrier10xTall") then {_insider = 3; _behinder = 8; _survivor = 1.05; _stander = 0.9;};
if (_nObjectTry isKindOf "WarfareBBaseStructure") then {_insider = 3; _behinder = 8; _survivor = 1.05; _stander = 0.9;};
if (_nObjectTry isKindOf "WarfareBAirport") then {_insider = 10; _behinder = 20; _survivor = 1.00; _stander = 0.8;};
if (_nObjectTry isKindOf "WarfareBDepot") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Ruins") then {_insider = 3; _behinder = 8; _survivor = 0.3; _stander = 0.1;};
if (_nObjectTry isKindOf "Ruins_EP1") then {_insider = 3; _behinder = 8; _survivor = 0.3; _stander = 0.1;};
if (_nObjectTry isKindOf "WarfareBMGNest_M240_base") then {_insider = 1; _behinder = 4; _survivor = 1.10; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_Fort_Watchtower") then {_insider = 3; _behinder = 8; _survivor = 1.25; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_HBarrier_large") then {_insider = 1; _behinder = 4; _survivor = 0.85; _stander = 0.4;};
if (_nObjectTry isKindOf "Land_BagFenceCorner") then {_insider = 0.5; _behinder = 2; _survivor = 0.75; _stander = 0.05;};
if (_nObjectTry isKindOf "Land_fort_artillery_nest") then {_insider = 1; _behinder = 4; _survivor = 0.85; _stander = 0.2;};
if (_nObjectTry isKindOf "Land_fort_rampart") then {_insider = 1; _behinder = 3; _survivor = 0.85; _stander = 0.2;};
if (_nObjectTry isKindOf "Land_fortified_nest_big") then {_insider = 4; _behinder = 6; _survivor = 1.25; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_fortified_nest_small") then {_insider = 0.8; _behinder = 2; _survivor = 1.05; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_Barrack2") then {_insider = 1; _behinder = 3; _survivor = 1.00; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_Fort_Watchtower_EP1") then {_insider = 3; _behinder = 8; _survivor = 1.25; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_fort_artillery_nest_EP1") then {_insider = 1; _behinder = 4; _survivor = 0.85; _stander = 0.2;};
if (_nObjectTry isKindOf "Land_fort_rampart_EP1") then {_insider = 1; _behinder = 3; _survivor = 0.85; _stander = 0.2;};
if (_nObjectTry isKindOf "Land_fortified_nest_big_EP1") then {_insider = 4; _behinder = 6; _survivor = 1.25; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_fortified_nest_small_EP1") then {_insider = 0.8; _behinder = 2; _survivor = 1.05; _stander = 0.5;};
if (_nObjectTry isKindOf "Fort_Barricade_EP1") then {_insider = 0.8; _behinder = 3; _survivor = 0.45; _stander = 0.1;};
if (_nObjectTry isKindOf "Fort_Barricade") then {_insider = 0.8; _behinder = 3; _survivor = 0.45; _stander = 0.1;};
if (_nObjectTry isKindOf "Land_Barrack2_EP1") then {_insider = 1; _behinder = 3; _survivor = 1.00; _stander = 0.8;};
if (_nObjectTry isKindOf "Warfare_HQ_base_unfolded_EP1") then {_insider = 2.5; _behinder = 6; _survivor = 1.15; _stander = 0.85;};
if (_nObjectTry isKindOf "Land_Hlidac_budka_EP1") then {_insider = 1.5; _behinder = 4; _survivor = 0.42; _stander = 0.56;};
if (_nObjectTry isKindOf "WaterBasin_conc_EP1") then {_insider = 2; _behinder = 8; _survivor = 0.68; _stander = 0.16;};
if (_nObjectTry isKindOf "WarfareBBaseStructure_EP1") then {_insider = 3; _behinder = 8; _survivor = 1.05; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_Ind_Coltan_Main_EP1") then {_insider = 12; _behinder = 24; _survivor = 1.00; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_Ind_FuelStation_Build_EP1") then {_insider = 2; _behinder = 6; _survivor = 0.80; _stander = 0.3;};
if (_nObjectTry isKindOf "Land_Ind_Garage01_EP1") then {_insider = 3; _behinder = 9; _survivor = 0.90; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Mosque_big") then {_insider = 4; _behinder = 12; _survivor = 1.00; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_hq_EP1") then {_insider = 14; _behinder = 36; _survivor = 1.10; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_addon_EP1") then {_insider = 6; _behinder = 12; _survivor = 1.10; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_minaret_1_EP1") then {_insider = 4; _behinder = 8; _survivor = 1.10; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_minaret_1_dam_EP1") then {_insider = 4; _behinder = 8; _survivor = 1.00; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_minaret_2_EP1") then {_insider = 4; _behinder = 8; _survivor = 1.10; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_minaret_2_dam_EP1") then {_insider = 4; _behinder = 8; _survivor = 1.00; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_wall_corner_EP1") then {_insider = 8; _behinder = 16; _survivor = 1.10; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_big_wall_EP1") then {_insider = 8; _behinder = 16; _survivor = 1.10; _stander = 1.0;};
if (_nObjectTry isKindOf "Land_A_Mosque_small_1_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.90; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Mosque_small_1_dam_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.80; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Mosque_small_2_EP1") then {_insider = 5; _behinder = 9; _survivor = 0.90; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Mosque_small_2_dam_EP1") then {_insider = 5; _behinder = 9; _survivor = 0.80; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Minaret_EP1") then {_insider = 2; _behinder = 5; _survivor = 0.80; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Minaret_dam_EP1") then {_insider = 2; _behinder = 5; _survivor = 0.80; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Minaret_Porto_EP1") then {_insider = 2; _behinder = 5; _survivor = 0.80; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Minaret_porto_dam_EP1") then {_insider = 2; _behinder = 5; _survivor = 0.80; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Office01_EP1") then {_insider = 10; _behinder = 24; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_A_Stationhouse_EP1") then {_insider = 8; _behinder = 24; _survivor = 0.90; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_A_Villa_EP1") then {_insider = 14; _behinder = 28; _survivor = 1.10; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_A_Villa_ruins_EP1") then {_insider = 14; _behinder = 28; _survivor = 1.00; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_House_C_1_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_1_dam_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_1_v2_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_1_v2_dam_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_2_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_2_DAM_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_3_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_3_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_4_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_4_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_V1_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_V1_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_V2_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_V2_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_V3_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_5_V3_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_9_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_9_dam_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_10_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_10_dam_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_11_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_11_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_12_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_C_12_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_1_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_3_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_5_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_6_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_7_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_8_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_3_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_5_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_6_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_7_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_K_8_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_1_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_3_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_4_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_6_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_7_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_8_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_9_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.90; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_3_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_4_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_6_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_7_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_House_L_8_dam_EP1") then {_insider = 6; _behinder = 12; _survivor = 0.80; _stander = 0.5;};
if (_nObjectTry isKindOf "Land_Mil_Barracks_EP1") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Mil_Barracks_L_EP1") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Mil_Barracks_i_EP1") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 1;};
if (_nObjectTry isKindOf "Land_Ind_PowerStation_EP1") then {_insider = 8; _behinder = 14; _survivor = 0.90; _stander = 0.9;};
if (_nObjectTry isKindOf "Land_Mil_ControlTower_EP1") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 0.7;};
if (_nObjectTry isKindOf "Land_Mil_Guardhouse_EP1") then {_insider = 5; _behinder = 12; _survivor = 1.00; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_Mil_House_EP1") then {_insider = 8; _behinder = 15; _survivor = 1.15; _stander = 0.8;};
if (_nObjectTry isKindOf "Land_Mil_Repair_center_EP1") then {_insider = 8; _behinder = 14; _survivor = 1.00; _stander = 1;};
if (_nObjectTry isKindOf "Land_Mil_hangar_EP1") then {_insider = 12; _behinder = 28; _survivor = 0.92; _stander = 1;};
if (_nObjectTry isKindOf "Land_A_BuildingWIP_EP1") then {_insider = 12; _behinder = 18; _survivor = 1.35; _stander = 1;};

_bParams = [_nObjectTry]+[_insider]+[_behinder]+[_survivor]+[_stander];

It should be all usable buildings in Arma 2 + OA. I made my own indexes needed for my stuff, but it would be easily possible to convert to yours.

This sript is also possible to run infinite many times for each unit it self :)

EDIT: I should explain the function of it. This script will find most suitable building which provides the most possible protection to make best cover for soldier.

For you is important that library.

I like your idea to create some sketch of evrybuilding and then use it to search player inside of it. It would be possible to use it also for more acurate cover behind building, but would be better to make it more accurate, like one letter is a half of meter.

          ------W-------\
         IFFFFFOOFFFFFFFI\                   
         IFFFFFFFFFFFFFFI\                    
         IFFFFFFFFFFFFFFI\                    
         !FFFFFFFFFOFFFI\                    
         I-_-------------\                
         IFFFFFFI********\                 
         WFFFFOI********\
         IFFFFFOI********\
         IFFFFFOI********\
         IFFFFFOI********\
         --W---********\
         /floorEnd\
         /houseTop\

Legend:


[spoiler] - = Horizontal Wall
I = Vertical Wall
! = Horizontal Entrance
_ = Vertical Entrance
\ = End of line [size="1"](to determine it like in text)[/size]
* = Empty space for L houses
F = Floor
O = Object
W = Window[/spoiler]

/floorEnd\ = End of first floor (next floor could just continue)

/houseTop\ = End of walkable floor for units (so you could OOOO Antenas of roof)

Edited by Khalashnikovf

Share this post


Link to post
Share on other sites

nice one Khalashnikovf ^^

it looks really useful, but I have just figured out a workaround for finding the roof of a building, using a shooting rabbit to detect a solid surface. Works fairly reliably, and can be modified to output the final z coordinate (the final height where the object touches a solid surface)

here it is in case you might need it:

// Probe function
// A workaround for hasSurface
// Creates probe object at a given position, and checks to see if this position has solid ground (diff in height less than 1m) after simulation 
RUFS_ProbeSurface = {
   private ["_pos", "_bball", "_probe", "_zi", "_zf", "_zdiff", "_vel", "_hasSurface"];
   _pos = _this select 0;
   _zi = _pos select 2;
   _bball = "Rabbit"; // our furry little friend
   _probe = _bball createVehicle _pos;
   _probe setpos _pos;
   _vel = -60;
   _probe setVelocity [0, 0 , -60]; // force the object to crash downward
   while {_vel > 0.1 && _vel < -0.1} do {
       _vel = velocity _probe select 2;
   };
   _zf = getposATL _probe select 2;
   _zdiff = _zi - _zf;
   // find difference in height
   if (_zdiff > 0.5 || _zdiff < -1) then {
       _hasSurface = false;
       hint "surface unsuitable";
   } else {
       _hasSurface = true;
       hint "surface suitable";
   };
   deletevehicle _probe;
   // output result
   _hasSurface
};

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  

×