isOnRoad: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(alt syntax, example, see also)
m (Some wiki formatting)
 
(61 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2 |= Game name
|game1= arma2
|version1= 1.00


|1.00|= Game version
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.50


| Checks if given object or position is on road. |= Description
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| '''isOnRoad''' object |= Syntax
|game4= arma3
|version4= 0.50


|p1= object: [[Object]]  |= PARAMETER1
|arg= global


|p2= |= PARAMETER2
|gr1= Roads and Airports


|p3= |= PARAMETER3
|descr= Checks if given position is inside road segment. Same as [[roadAt]], only return is boolean instead of road object.


| [[Boolean]] |= RETURNVALUE
|s1= [[isOnRoad]] position


|s2= '''isOnRoad''' position |= Syntax
|p1= position: [[Object]] or [[Array]] in format [[Position#PositionAGL|PositionAGL]] (especially on bridges) or {{GVI|arma3|2.00|size= 0.75}} [[Position#Introduction|Position2D]], in which case Z will be automatically deduced as the height of the road surface


|p21= position: [[Array]] - format [[getPosATL]] (especially on bridges) |= PARAMETER1
|r1= [[Boolean]]


|p22= |= PARAMETER2
|x1= <sqf>_objOnRoad = isOnRoad player;</sqf>


|p3= |= PARAMETER3
|x2= <sqf>_posOnRoad = isOnRoad ASLToAGL getPosASL player;</sqf>


| r2= [[Boolean]] |= RETURNVALUE
|seealso= [[nearRoads]] [[roadsConnectedTo]] [[roadAt]] [[surfaceIsWater]] [[getRoadInfo]] [[nearestTerrainObjects]]
}}


 
{{Note
|x1= <code>_objOnRoad = [[isOnRoad]] [[player]];</code>|= EXAMPLE1
|user= Tankbuster
 
|timestamp= 20171124213100
|x2= <code>_posOnRoad = [[isOnRoad]] [[getPosATL]] [[player]];</code>|= EXAMPLE1
|text= Some roadobjects will return false when using this command. invisibleroadway_square_f.p3d is found by the nearRoads command, yet will return false for isOnRoad.
 
____________________________________________________________________________________________
 
| [[surfaceIsWater]] |= SEEALSO
 
|  |= MPBEHAVIOUR
____________________________________________________________________________________________
}}
}}
<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 15:30, 17 April 2023

Hover & click on the images for description

Description

Description:
Checks if given position is inside road segment. Same as roadAt, only return is boolean instead of road object.
Groups:
Roads and Airports

Syntax

Syntax:
isOnRoad position
Parameters:
position: Object or Array in format PositionAGL (especially on bridges) or Arma 3 logo black.png2.00 Position2D, in which case Z will be automatically deduced as the height of the road surface
Return Value:
Boolean

Examples

Example 1:
_objOnRoad = isOnRoad player;
Example 2:
_posOnRoad = isOnRoad ASLToAGL getPosASL player;

Additional Information

See also:
nearRoads roadsConnectedTo roadAt surfaceIsWater getRoadInfo nearestTerrainObjects

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
Tankbuster - c
Posted on Nov 24, 2017 - 21:31 (UTC)
Some roadobjects will return false when using this command. invisibleroadway_square_f.p3d is found by the nearRoads command, yet will return false for isOnRoad.