buildingPos: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (move sqs-syntax comment outside of code box)
m (template:command argument fix)
(31 intermediate revisions by 15 users not shown)
Line 9: Line 9:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns the given indexed position in a building.  
| Returns [[PositionAGL]] of a given indexed position in a [[Object#Building|building]]. The index is 0-based (i.e. the first possible position would be 0. So if a building has 5 positions listed in the editor, 4 would be the highest position index usable with this command). Command will return [0,0,0] if buildingPos with given index is non-existent. <br><br>
 
Since Arma 3 v.155.133934 if index -1 is supplied, the command will return array with all available positions.
The index is 0-based (i.e. the first possible position would be 0. So if a building has 5 positions listed in the editor, 4 would be the highest position index usable with this command).
|DESCRIPTION=
|= Description
____________________________________________________________________________________________
 
| building '''buildingPos''' index |= Syntax
 
|p1= building: [[Object]] |= Parameter 1
 
|p2= index: [[Integer]] |= Parameter 2
 
| [[Position]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________


|s2= '''buildingPos''' [building, index] |= Syntax
| building '''buildingPos''' index |SYNTAX=


|p21= building: [[Object]] |= Parameter 1
|p1= building: [[Object]] |PARAMETER1=


|p22= index: [[Integer]] |= Parameter 2
|p2= index: [[Number]] - index of a specific position or -1 to return available all positions|PARAMETER2=


|r2= [[Position]] |= Return value
| [[Array]] - a single building position in format [[PositionAGL]] or (''since Arma 3 v.155.133934'') [[Array]] of all building positions in format [[PositionAGL]] if index is -1|RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
 
|x1= <code>soldier [[setPos]] (buildingPos [house1, 2])</code>
would be equivalent to


<code>soldier setPos (house1 buildingPos 2)</code> |= Example 1
|x1= <code>_soldier [[setPosATL]] (_house1 [[buildingPos]] 2);</code> |EXAMPLE1=
|x2= <code>_allpositions = [[nearestBuilding]] [[player]] [[buildingPos]] -1;</code> |EXAMPLE2=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[nearestBuilding]], [[position]], [[setPos]] |= See also
| [[nearestBuilding]], [[nearestObject]], [[nearestObjects]], [[nearObjects]], [[buildingExit]], [[position]], [[setPos]], [[setWaypointHousePosition]], [[waypointHousePosition]], [[BIS_fnc_buildingPositions]] |SEEALSO=


}}
}}
Line 48: Line 35:
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on August 2, 2006 - 10:45</dd>
<dd class="notedate">Posted on August 2, 2006 - 10:45
<dt class="note">'''[[User:Hardrock|hardrock]]'''</dt><dd class="note">''Notes from before the conversion:''
<dt class="note">'''[[User:Hardrock|hardrock]]'''
 
<dd class="note">
''Notes from before the conversion:''
These examples will move a unit to the 1st position specified in a buildings model, in the second example - bunker1.
These examples will move a unit to the 1st position specified in a buildings model, in the second example - bunker1.
<code>this [[move]] (building [[buildingPos]] 1);
this [[move]] (bunker1 [[buildingPos]] 1);</code>
In 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:
<code>this [[setPosATL]] (([[nearestBuilding]] this) [[buildingPos]] 1);</code>
The 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.
If 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.


<pre>this move (building buildingPos 1)


this move (bunker1 buildingPos 1)</pre>
<dd class="notedate">Posted on January 26, 2007 - 01:02
<dt class="note">'''[[User:Kronzky|Kronzky]]'''
<dd class="note">
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.


In 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:


<pre>this setPos getPos (buildingPos [nearestBuilding this, 1])</pre>
<dd class="notedate">Posted on February 16, 2007
<dt class="note">'''[[User:Bdfy|Bdfy]]'''
<dd class="note">
(building [[buildingPos]] 1) will return [0,0,0] if [[buildingPos]] with this index does not exist.


The 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.
If 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.
</dd>


<dd class="notedate">Posted on January 26, 2007 - 01:02</dd>
<dd class="notedate">Posted on January 08, 2011
<dt class="note">'''[[User:Kronzky|Kronzky]]'''</dt><dd class="note">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.</dd>
<dt class="note">'''[[User:kju|kju]]'''
<dd class="note">
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).
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>
Line 74: Line 70:


[[Category:Scripting Commands|BUILDINGPOS]]
[[Category:Scripting Commands|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.99|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.96|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.96|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.46|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.46|BUILDINGPOS]]
[[Category:Scripting Commands ArmA|BUILDINGPOS]]
[[Category:Scripting Commands ArmA|BUILDINGPOS]]
[[Category:Scripting Commands ArmA2|BUILDINGPOS]]
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Revision as of 15:34, 7 April 2019

Hover & click on the images for description

Description

Description:
Returns PositionAGL of a given indexed position in a building. The index is 0-based (i.e. the first possible position would be 0. So if a building has 5 positions listed in the editor, 4 would be the highest position index usable with this command). Command will return [0,0,0] if buildingPos with given index is non-existent.

Since Arma 3 v.155.133934 if index -1 is supplied, the command will return array with all available positions.
Groups:
Uncategorised

Syntax

Syntax:
building buildingPos index
Parameters:
building: Object
index: Number - index of a specific position or -1 to return available all positions
Return Value:
Array - a single building position in format PositionAGL or (since Arma 3 v.155.133934) Array of all building positions in format PositionAGL if index is -1

Examples

Example 1:
_soldier setPosATL (_house1 buildingPos 2);
Example 2:
_allpositions = nearestBuilding player buildingPos -1;

Additional Information

See also:
nearestBuildingnearestObjectnearestObjectsnearObjectsbuildingExitpositionsetPossetWaypointHousePositionwaypointHousePositionBIS_fnc_buildingPositions

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Posted on August 2, 2006 - 10:45
hardrock
Notes from before the conversion: These examples will move a unit to the 1st position specified in a buildings model, in the second example - bunker1. this move (building buildingPos 1); this move (bunker1 buildingPos 1); In 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: this setPosATL ((nearestBuilding this) buildingPos 1); The 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. If 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.
Posted on January 26, 2007 - 01:02
Kronzky
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.
Posted on February 16, 2007
Bdfy
(building buildingPos 1) will return [0,0,0] if buildingPos with this index does not exist.
Posted on January 08, 2011
kju
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).

Bottom Section