Jump to content
Sign in to follow this  
Desrat

get all buildings within areas inc positions

Recommended Posts

Just wondering is there a quick way to build an array of all available buildings and positions within them within a radius, rather that just the nearest one???

Even just a list of building class names would be a start..

Share this post


Link to post
Share on other sites
_pos = position player;
_radius = 200;
_houses = nearestObjects [_pos , ["house"], _radius ];

Share this post


Link to post
Share on other sites

nearestObjects [player, ["house"], 200]

If more than one object is found they will be ordered according to their distance (i.e. the closest one will be first in the array).

as for the building positions, suggest you choose one specific building and use a loop to count the possible locations.

Share this post


Link to post
Share on other sites

place in a object or logic init

blds=nearestobjects [this,["house"], 100];ary=[];{ary=ary+[typeof _x,getpos _x]} foreach blds;hint str ary;copyToClipboard str ary

it should return something like this, the data is also copied to clipboard so you can post it in script.

["Land_LampHalogen_F",[1998.2,5687.88,-3.62396e-005],"Land_spp_Transformer_F",[2012.79,5696.06,8.91685e-005],"Land_Shed_Small_F",[2004.21,5720.2,-0.00483322],"Land_ReservoirTank_Airport_F",[2024.25,5703.07,-0.000177383],"Land_MilOffices_V1_F",[1958.54,5707.32,0.0193405],"Land_spp_Transformer_F",[1971.47,5725.77,-1.90735e-006],"Land_Communication_anchor_F",[1972.38,5731.96,9.53674e-007],"Land_Cargo_House_V1_F",[2052.16,5704.01,-0.00451803],"Land_Communication_F",[1972.42,5731.99,1.90735e-005],"Land_Communication_anchor_F",[1972.44,5731.96,9.53674e-007],"Land_Communication_anchor_F",[1972.36,5731.89,0.0159407],"Land_Communication_anchor_F",[1972.4,5731.89,0.0167561],"Land_TentHangar_V1_F",[1954,5629.5,2.67029e-005],"Land_dp_smallFactory_F",[2064.46,5692.13,-0.0314002],"Land_Cargo_Patrol_V1_F",[2053.83,5715.79,0.0133524],"Land_dp_smallTank_F",[2052.87,5749.37,0.057806],"Land_LampHalogen_F",[2088.42,5686.59,-0.000102997],"Land_spp_Transformer_F",[1957.16,5598.73,6.48499e-005],"Land_LampHalogen_F",[2076.97,5732.15,0.00118542],"Land_Airport_Tower_F",[1910.5,5713.64,0.00755119],"Land_MilOffices_V1_F",[1921.52,5738.2,-0.00590897],"Land_dp_smallFactory_F",[2099.2,5678.3,-0.0014801]]

Share this post


Link to post
Share on other sites

Thanks F2k got the ball rolling for me, should be able to start some random unit garrisoning now..

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  

×