buildingPos: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(63 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.00


|1.00|= Game version
|game2= ofpe
|version2= 1.00


|arg= global |Multiplayer Arguments=
|game3= arma1
____________________________________________________________________________________________
|version3= 1.00


| 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>
|game4= arma2
Since Arma 3 v.155.133934 if index -1 is supplied, the command will return array with all available positions.
|version4= 1.00
|DESCRIPTION=
____________________________________________________________________________________________


| building '''buildingPos''' index |SYNTAX=
|game5= arma2oa
|version5= 1.50


|p1= building: [[Object]] |PARAMETER1=
|game6= tkoh
|version6= 1.00


|p2= index: [[Number]] - index of a specific position or -1 to return available all positions|PARAMETER2=
|game7= arma3
|version7= 0.50


| [[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=
|arg= global
____________________________________________________________________________________________


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


| [[nearestBuilding]], [[nearestObject]], [[nearestObjects]], [[nearObjects]], [[buildingExit]], [[position]], [[setPos]], [[setWaypointHousePosition]], [[waypointHousePosition]], [[BIS_fnc_buildingPositions]] |SEEALSO=
|descr= Returns position of a given indexed position in a [[Object#Building|building]].


|s1= building [[buildingPos]]  index
|p1= building: [[Object]]
|p2= index: [[Number]] - index of a specific position {{Feature|arma3|Since v1.56 index {{hl|-1}} will return all available building positions.}}
|r1= [[Array]] in format [[Position#PositionAGL|PositionAGL]] - a single building position. If building position with given index does not exist, {{hl|[0, 0, 0]}} is returned
{{Feature|arma3|Since v1.56 it can also return an [[Array|array]] of all building positions in format [[Position#PositionAGL|PositionAGL]] if index that was given is {{hl|-1}}.}}
|x1= <sqf>_soldier setPosATL (_house1 buildingPos 2);</sqf>
|x2= <sqf>_allpositions = nearestBuilding player buildingPos -1;</sqf>
|seealso= [[nearestBuilding]] [[nearestObject]] [[nearestObjects]] [[nearObjects]] [[insideBuilding]] [[buildingExit]] [[position]] [[setPos]] [[setWaypointHousePosition]] [[waypointHousePosition]] [[BIS_fnc_buildingPositions]]
}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on August 2, 2006 - 10:45
<dt><dt>
<dt class="note">'''[[User:Hardrock|hardrock]]'''
<dd class="notedate">Posted on 2006-08-02 - 10:45</dd>
<dt class="note">[[User:Hardrock|hardrock]]</dt>
<dd class="note">
<dd class="note">
''Notes from before the conversion:''
''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);
<sqf>
this [[move]] (bunker1 [[buildingPos]] 1);</code>
this move (building buildingPos 1);
this move (bunker1 buildingPos 1);
</sqf>
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:  
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>
<sqf>this setPosATL ((nearestBuilding this) buildingPos 1);</sqf>
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.  
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.
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.


 
<dt><dt>
<dd class="notedate">Posted on January 26, 2007 - 01:02
<dd class="notedate">Posted on 2007-01-26 - 01:02</dd>
<dt class="note">'''[[User:Kronzky|Kronzky]]'''
<dt class="note">[[User:Kronzky|Kronzky]]</dt>
<dd class="note">
<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.
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.


 
<dt><dt>
<dd class="notedate">Posted on February 16, 2007
<dd class="notedate">Posted on 2011-01-08</dd>
<dt class="note">'''[[User:Bdfy|Bdfy]]'''
<dt class="note">[[User:.kju|.kju]]</dt>
<dd class="note">
(building [[buildingPos]] 1) will return [0,0,0] if [[buildingPos]] with this index does not exist.
 
 
<dd class="notedate">Posted on January 08, 2011
<dt class="note">'''[[User:kju|kju]]'''
<dd class="note">
<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).
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 -->
</dl>
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.99|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.96|BUILDINGPOS]]
[[Category:Scripting Commands OFP 1.46|BUILDINGPOS]]
[[Category:Scripting Commands ArmA|BUILDINGPOS]]
[[Category:Scripting Commands ArmA2|BUILDINGPOS]]
[[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}}}}]]

Latest revision as of 11:25, 3 September 2024

Hover & click on the images for description

Description

Description:
Returns position of a given indexed position in a building.
Groups:
Positions

Syntax

Syntax:
building buildingPos index
Parameters:
building: Object
index: Number - index of a specific position
Arma 3
Since v1.56 index -1 will return all available building positions.
Return Value:
Array in format PositionAGL - a single building position. If building position with given index does not exist, [0, 0, 0] is returned
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.

Examples

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

Additional Information

See also:
nearestBuilding nearestObject nearestObjects nearObjects insideBuilding buildingExit position setPos setWaypointHousePosition waypointHousePosition BIS_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
Posted on 2006-08-02 - 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 2007-01-26 - 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 2011-01-08
.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).