Jump to content
Sign in to follow this  
Splicer

How to find enterable houses?

Recommended Posts

Hi all,

I have been able to use a script to assess what objects in a certain area are houses and combined it with another script to select a random house to place units in it.

The problem is -as you may already know- that some houses have no doors that can actually open and some times units are place in such houses. :stuck:

Is there a way to find out & select only houses where one can actually enter?

I found this thread (http://forums.bistudio.com/showthread.php?t=90870), but no solution was given.

Any ideas/pointers will be deeply appreciated.

Thanks much in advance!

Best, Splicer.

Share this post


Link to post
Share on other sites

There is a way to dig out the building positions from the config for houses, I think it is returned as an array.

With it you can check if the positions is greater than 0 or 1.

I have a script laying about from ArmA which could be used, I'm at work ATM so I can't provide you with it.

I hope I find it because my dePBO tools doesn't work at the current time.

Share this post


Link to post
Share on other sites
There is a way to dig out the building positions from the config for houses, I think it is returned as an array.

With it you can check if the positions is greater than 0 or 1.

I have a script laying about from ArmA which could be used, I'm at work ATM so I can't provide you with it.

I hope I find it because my dePBO tools doesn't work at the current time.

I think that won't help, because i suspect there are non-enterable houses which also have positions (at least there was few of them in ArmA1).

So you can't tell whether the house is really enterable only by finding some positions defined in the config.

I haven't tested it, but maybe buildingExit could help?

Share this post


Link to post
Share on other sites

building buildingPos index will return a position in the building. [0,0,0] returns if the building doesn't have a predefined position with such an index. Also the given positions are not 100% accurate, so using setPos for AI units to those positions will often result in the AI units clipping through the building and dying as soon as they try to move anywhere. A reasonable workaround is placing them outside and telling them to doMove* to those positions, and if you are using a specific position and want to set them looking at a specific direction, then also use setFormDir once the movement completes**.

* doMove when used on a group leader will not tell the rest of the group to follow. You can use doFollow for the group members though they will still often stay outside of the building. Using doMove on a group member will result in him going back to formation as soon as he reaches his destination.

** Use waitUntil {moveToCompleted _unit}; _unit setFormDir _dir; for that.

On another note, some non-enterable buildings still have building positions, but usually not more than 1-2 that are right outside the building.

Also, my ACE_Co_05 Patrol City mission uses almost all enterable buildings in the game (that were made by BIS, though, so no addon-buildings), so you can use that to complie a list of (almost) all enterable buildings.

Edited by galzohar

Share this post


Link to post
Share on other sites

Has anyone actually compiled a list yet for enterable houses in Arma1 or arma2. Or am i really forced to run around the island, knocking on every door to see which ones open. lol

Share this post


Link to post
Share on other sites

Best way I found, since I could never find a way to get the buildingPos from the config, is to just request buildingPos #5, and if the first element of the returned array is not 0, then it has at least 6 building positions, and from my experience it will be an enter-able building.

Share this post


Link to post
Share on other sites

This is mostly correct, but there are a select few (or at least 1) enterable building(s) that have building positions yet are not enterable (the positions would be just outside). There are also enterable buildings that have some of their building positions outside.

Share this post


Link to post
Share on other sites

There's another approach to this problem I've mentioned at the end of this post. Basically you retrieve a list of all buildings inside a given perimeter with nearestObjects. Then you filter that list (e.g. sort by distance to a given unit and pick the nearest one) based on a well defined/selected pool of buildings/-classes.

To good thing about this approach is that the buildings you'll find are of guaranteed quality (as your needs demand it). Which is also the downside, since you need to adapt the buildingpool for each world/island that uses a different set of buildings. But it's quite worth the effort, especially since you can aggregate buildings to form building-types (domestic buildings, military buildings, industrial buildings).. which can be important information.

Share this post


Link to post
Share on other sites

Right.. I Just wrote something that gets you the location of ALL enterable houses around you. You can also define the radius of where houses should be searched.

houses = player nearObjects ["House",200]; // The last number in the array is the radius in meters.

tocount = count houses;

counter = 0;

while {(counter < tocount)} do

{

testdata2 = houses select counter buildingPos 1;

diag_log testdata2;

counter = counter +1;

}

This saves ALL the locations of houses that are enterable in your arma.rpt

However it also shows the [0,0,0] for the ones you can't enter. I am currently working on a solution to fix that..

Note: This will also show radio towers with a rooftop etc.

ps instead of writing down which houses are available you could also randomly place units inside of them.

Edited by Joshii

Share this post


Link to post
Share on other sites

if !((testdata2 select 0) == 0 && (testdata2 select 1) == 0 && (testdata2 select 2) == 0) then {diag_log testdata2};

was the first thing that came to mind. Not tested though, but you get the idea.

Share this post


Link to post
Share on other sites
if !((testdata2 select 0) == 0 && (testdata2 select 1) == 0 && (testdata2 select 2) == 0) then {diag_log testdata2};

was the first thing that came to mind. Not tested though, but you get the idea.

Thank you pretty much indeed.

Script searching only enterable houses in an adjustable radius.

Right now it only searches those with buildingPos 1 however you could also search those with Pos 6 only or what so ever.

Also you can change the searchradius to search 1 city only for example.

This script also puts red dots on any enterable house it found on the ingame map.

p.s If you want it to write the House # on map and into the rpt just do it yourself or if you need help post in here and I will do it. This will allow you to recognize houses on map and then get the position from the rpt.

houses = player nearObjects ["House",200]; // The last number in the array is the searchradius in meters.

tocount = count houses;

counter = 0;

while {(counter < tocount)} do

{

testdata2 = houses select counter buildingPos 1;

markerstring = format ["House %1", counter];

namestring = format ["Marker%1", counter];

if !((testdata2 select 0) == 0 && (testdata2 select 1) == 0 && (testdata2 select 2) == 0)

then

{

namestring = createMarker [markerstring, houses select counter];

namestring setMarkerShape "ICON";

markerstring setMarkerType "DOT";

diag_log testdata2;

counter = counter +1;

}

else

{

counter = counter +1;

};

}

Edited by Joshii

Share this post


Link to post
Share on other sites

Ok great thanks for the all info about this, Now one thing that im confused about though, is do i save all the code into a SQF file, and then place this=execvm"house.sqf"; into a playable unit and then just walk/drive around the cities?

Sorry of the noob question there im jus well a noob when it comes to scripting.

EDIT: just tried it would with just calling it from a script on the player, and it works just fine nice little red mark on the house, thank you sooo very much

Edited by Woodstock21

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  

×