locationPosition: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
(Fix return value)
 
(51 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= arma1
|version1= 1.08


|1.08|= Game version
|game2= arma2
|version2= 1.00


|arg= |= Arguments in MP
|game3= arma2oa
|version3= 1.50


|eff= |= Effects in MP
|game4= tkoh
____________________________________________________________________________________________
|version4= 1.00


| Returns the [[Position|position]] of a location. If the location is attached to an object, that object's position is returned. |DESCRIPTION=
|game5= arma3
____________________________________________________________________________________________
|version5= 0.50


| '''locationPosition''' location |SYNTAX=
|gr1= Locations


|p1= location: [[Location]] |PARAMETER1=
|descr= Returns the [[Position|position]] of a location. If the location is attached to an object, that object's position is returned.


| [[Array]] - format [[Position]] |RETURNVALUE=
|s1= [[locationPosition]] location
____________________________________________________________________________________________
 
|x1= <code>_locationPos = [[locationPosition]] myLocation;</code> |EXAMPLE1=


|x2= <code>_location = [[nearestLocation]] <nowiki>[</nowiki>[[getPos]] [[player]], "nameCity"];
|p1= location: [[Location]]
_locationPos = [[locationPosition]] _location;</code> |EXAMPLE2=
____________________________________________________________________________________________


| [[setPosition]], [[createLocation]], [[nearestLocation]], [[nearestLocations]], [[position]], [[size]] |SEEALSO=
|r1= [[Array]] format [[Position#PositionAGL|PositionAGL]] - as locations are placed at Z = zero [[Position#PositionASL|ASL]] the returned Z is negative on land and around zero on water, see {{Link|#Example 3}}


}}
|x1= <sqf>_locationPos = locationPosition myLocation;</sqf>


<h3 style="display:none">Notes</h3>
|x2= <sqf>
<dl class="command_description">
_location = nearestLocation [getPos player, "nameCity"];
<!-- Note Section BEGIN -->
_locationPos = locationPosition _location;
</sqf>


<!-- Note Section END -->
|x3= <sqf>
</dl>
private _landLocation = locationPosition nearestLocation [[2915.2, 6164.52], "NameCityCapital"]; // "Agia Marina" [2915.2, 6164.52, -21.9009]
private _waterLocation = locationPosition nearestLocation [[2647.8799, 5989.9502], "NameMarine"]; // "Marina Bay" [2647.88, 5989.95, 0.0161484]
</sqf>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[setPosition]] [[createLocation]] [[nearestLocation]] [[nearestLocations]] [[position]] [[size]]
 
}}
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Locations|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on October 24, 2015 - 19:20 (UTC)</dd>
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
<dd class="note">
locationPosition returns a position that is altitude zero ASL.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 22:25, 11 April 2023

Hover & click on the images for description

Description

Description:
Returns the position of a location. If the location is attached to an object, that object's position is returned.
Groups:
Locations

Syntax

Syntax:
locationPosition location
Parameters:
location: Location
Return Value:
Array format PositionAGL - as locations are placed at Z = zero ASL the returned Z is negative on land and around zero on water, see Example 3

Examples

Example 1:
_locationPos = locationPosition myLocation;
Example 2:
_location = nearestLocation [getPos player, "nameCity"]; _locationPos = locationPosition _location;
Example 3:
private _landLocation = locationPosition nearestLocation [[2915.2, 6164.52], "NameCityCapital"]; // "Agia Marina" [2915.2, 6164.52, -21.9009] private _waterLocation = locationPosition nearestLocation [[2647.8799, 5989.9502], "NameMarine"]; // "Marina Bay" [2647.88, 5989.95, 0.0161484]

Additional Information

See also:
setPosition createLocation nearestLocation nearestLocations position size

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