{"name":"buildingPos","title":"buildingPos","type":"command","url":"https://community.bistudio.com/wiki/buildingPos","revid":379404,"updated":"2026-10-31T00:02:01Z","groups":["Positions"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","locality":{"argument":"global"},"description":"Returns position of a given indexed position in a building.","syntaxes":[{"syntax":"building buildingPos index","params":[{"name":"building","type":"Object","type_expr":"Object"},{"name":"index","type":"Number","description":"index of a specific position\n\n> [!NOTE]\n> **Arma 3:** Since v1.56 index `-1` will return all available building positions.","type_expr":"Number"}],"returns":{"type":"PositionAGL","type_expr":"PositionAGL","description":"a single building position. If building position with given index does not exist, `[0, 0, 0]` is returned\n> [!NOTE] > **Arma 3:** Since v1.56 it can also return an array of all building positions in format PositionAGL if index that was given is `-1`.","text":"PositionAGL - a single building position. If building position with given index does not exist, `[0, 0, 0]` is returned\n\n> [!NOTE]\n> **Arma 3:** Since v1.56 it can also return an array of all building positions in format PositionAGL if index that was given is `-1`."},"form":"binary","left":{"text":"building"},"right":{"text":"index"}}],"examples":[{"code":["_soldier setPosATL (_house1 buildingPos 2);"]},{"code":["_allpositions = nearestBuilding player buildingPos -1;"]}],"see_also":["nearestBuilding","nearestObject","nearestObjects","nearObjects","insideBuilding","buildingExit","position","setPos","setWaypointHousePosition","waypointHousePosition","BIS_fnc_buildingPositions"],"notes":[{"user":"Hardrock","date":"2006-08-02T10:45:00Z","text":"*Notes from before the conversion:*\nThese examples will move a unit to the 1st position specified in a buildings model, in the second example - bunker1.\n\n```sqf\nthis move (building buildingPos 1);\nthis move (bunker1 buildingPos 1);\n```\n\nIn the default game buildings, the buildingPos is usually right behind a window. This can make it easy to place units in the windows of buildings, by putting the unit near a building and putting this in its init field:\n\n```sqf\nthis setPosATL ((nearestBuilding this) buildingPos 1);\n```\n\nThe location returned by buildingPos is not reliable after the player has exited and then resumed the mission. For code that is executed immediately after the mission starts there is no problem.\nIf buildingPos locations are to be accessed during the mission when the player may have exited and then resumed, save the locations you require at the start of the mission and use these saved locations in your subsequent scripts."},{"user":"Kronzky","date":"2007-01-26T01:02:00Z","text":"The highest index is *not* necessarily the highest position in a building! Check the z-value to find out the absolute height of a position."},{"user":".kju","date":"2011-01-08T00:00:00Z","text":"Almost all buildings loose their building positions when they get (visually) damaged or destroyed. Some debris do still have building positions though. So it is no technical limitation. Just most damaged/destructed buildings models do not (yet?) have building positions. Keep in mind that a damaged or destroyed building is a different object instance (and model)."}]}