Jump to content
Sign in to follow this  
nigelbland

BuildingPos in the Initialization Field

Recommended Posts

Just experimenting with getting a unit inside a house using the Initialization field when adding a unit.

I thought that the following would work:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">NearHouse = nearestBuilding this;  this setPos (NearHouse buildingPos 1);

However the unit disapears. I set a trigger to detect whether the unit was in the area but he wasn't. If I set the buildingPos to 0 then he appears exactly where I put him originally, outside the house.

Any ideas?

Share this post


Link to post
Share on other sites

That code works fine (in ver 1.02). The problem must be related to your surrounding code. Also, position 0 should work fine, since it's base 0. (i.e. 0 to n-1 positions).

Not all buildings will have a position 1, so it would return position [0,0,0] which would not be in your area, but in the ocean.

Calculate the total number of available positions before you call buildingPos. See this thread for tips on how to calculate.

Share this post


Link to post
Share on other sites

This works also:

this setPos (nearestBuilding this buildingPos x)

where x is the position in house...in hotels this number goes up to over 260 but some of them are in sealed rooms so one has to go in and check the position himself... wink_o.gif

Share this post


Link to post
Share on other sites

Use random for more dynamic wink_o.gif

Hotel for example:

this setPos (nearestBuilding this buildingPos random 260)

Have fun to find the unit in the hotel wink_o.gif

Regards,

Mr-Murray

Share this post


Link to post
Share on other sites

I just made a script that will allow you to put a unit at random in any building. You just put him close to a house and the script figures out how many positions there are inside the house and then positions the unit at random there. Works with multiple units and all houses.

I'll just check it some more before I upload it. It's a very simple script, but I am a simple guy so I have to beta it a bit.

Share this post


Link to post
Share on other sites

How can I get this to work with objects?

I want to put a 50.cal on a fooftop. The line works but I cant place it where I want...no-matter where I place it, the 50 always spawns in the same spot

Share this post


Link to post
Share on other sites

Thx smile_o.gif

I was playing around with setpos´ed units on balconies and in open hallways to make best use of the infrastructure provided.

What I came across is that some balconies don´t have solid ground. The soldiers will sink through the building until they hit the ground. Bad.

I setpos´ed a pallette under their feet.

Bad.

PaletteA in Arma is not static anymore. It just drops to the ground. Searched for a flat substitute and found that the "body" makes a perfect solid stand for the soldier on the balcony.

I know it´s ugly but it works biggrin_o.gif

Ok soldier on the balcony, standing solid on a dead body that is not visible as it is in the floor of the balcony. So far so good.

What happened now is that the setpos´ed soldier cannot engage targets as he can´t turn. His head turns but he can´t aim his weapon. I was like wtf and had a setpos on my own player to see what´s going on there. Once you are on the balcony you can´t turn or move. This is really sad as those houses with a lot of balconies really would be very nice for urban ambushes. I guess it´s a problem with the house itself. Maybe BIS can have a look. This is the house in question. Tried several balconies on different heights with no positive results.

When shooting at the free spaces at balconies the shots get deflected by invisible wall, so I assume the collision sphere is not properly set up. A fix would be great.

House in question:

ArmAGCS0022.jpg

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  

×