nearestBuilding: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(78 intermediate revisions by 12 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


| Nearest building to given object. <br>
|game3= arma1
A "building" is defined as an object that is of class "House", and contains a path LOD. |= Description
|version3= 1.00
____________________________________________________________________________________________


| [[Object]] <nowiki>=</nowiki> '''nearestBuilding''' object |= Syntax
|game4= arma2
|version4= 1.00


|p1= object: [[Object]] |= Parameter 1
|game5= arma2oa
|version5= 1.50


| [[Object]] |= Return value
|game6= tkoh
____________________________________________________________________________________________
|version6= 1.00
 
|x1= <code>_nBuilding <nowiki>=</nowiki> nearestBuilding [[player]]</code> |= Example 1
____________________________________________________________________________________________


| [[nearestObject]], [[nearestObjects]], [[nearObjects]], [[nearestBuilding_(VBS2)]] |= See also
|game7= arma3
|version7= 0.50


|gr1= Object Detection
|descr= Finds the nearest building to a given object or position. A "building" is defined as an object that is of class "House" and contains a path LOD.
|s1= [[nearestBuilding]] position
|p1= position: [[Object]] or [[Array]] in format [[Position#Introduction|Position2D]] or [[Position#PositionAGL|PositionAGL]]
|r1= [[Object]]
|x1= <sqf>_nBuilding = nearestBuilding player;</sqf>
|x2= <sqf>_nBuilding = nearestBuilding position player;</sqf>
|seealso= [[buildingPos]] [[nearestObject]] [[nearestObjects]] [[nearObjects]] [[nearestLocation]] [[nearEntities]] [[nearTargets]] [[nearSupplies]] [[nearestLocationWithDubbing]] [[nearObjectsReady]] [[nearRoads]] [[nearestMines]]
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= Pierre MGI
<!-- Note Section BEGIN -->
|timestamp= 20160218201800
A call to nearestBuilding tends to freeze/halt the game for some ticks or even seconds. You may want to use nearestObject(s) with the needed class restriction instead.
|text= This command doesn't return any house or building placed in editor (with [[createVehicle]]). Use [[nearestObjects]] instead:
<!-- Note Section END -->
<sqf>nearestObjects [player, ["House", "Building"], 50] select 0</sqf>
</dl>
}}


<h3 style="display:none">Bottom Section</h3>
{{Note
 
|user= Tankbuster
[[Category:Scripting Commands|NEARESTBUILDING]]
|timestamp= 20201230160400
[[Category:Scripting Commands OFP 1.96|NEARESTBUILDING]]
|text= Some large buildings are not found by this command. "Land_Airport_Tower_F", "Land_Offices_01_V1_F" and "Land_Hotel_02_F" are examples.
[[Category:Scripting Commands OFP 1.46|NEARESTBUILDING]]
}}
[[Category:Scripting Commands ArmA|NEARESTBUILDING]]
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]

Latest revision as of 22:29, 21 August 2022

Hover & click on the images for description

Description

Description:
Finds the nearest building to a given object or position. A "building" is defined as an object that is of class "House" and contains a path LOD.
Groups:
Object Detection

Syntax

Syntax:
nearestBuilding position
Parameters:
position: Object or Array in format Position2D or PositionAGL
Return Value:
Object

Examples

Example 1:
_nBuilding = nearestBuilding player;
Example 2:
_nBuilding = nearestBuilding position player;

Additional Information

See also:
buildingPos nearestObject nearestObjects nearObjects nearestLocation nearEntities nearTargets nearSupplies nearestLocationWithDubbing nearObjectsReady nearRoads nearestMines

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
Pierre MGI - c
Posted on Feb 18, 2016 - 20:18 (UTC)
This command doesn't return any house or building placed in editor (with createVehicle). Use nearestObjects instead:
nearestObjects [player, ["House", "Building"], 50] select 0
Tankbuster - c
Posted on Dec 30, 2020 - 16:04 (UTC)
Some large buildings are not found by this command. "Land_Airport_Tower_F", "Land_Offices_01_V1_F" and "Land_Hotel_02_F" are examples.