BIS fnc inTrigger: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "Since {{arma3}} v1.57" to "Since {{arma3}} v1.58")
 
(54 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2
____________________________________________________________________________________________
|version1= 1.00


| arma2 |= Game name
|game2= arma2oa
|version2= 1.50


|1.00|= Game version
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| Detects whether a position is within the trigger area of the given trigger. |= Description
|game4= arma3
____________________________________________________________________________________________
|version4= 0.50


| [trigger, position, (isScalar)] call [[BIS_fnc_inTrigger]] |= Syntax
|gr1= Object Manipulation


|p1= trigger: [[Object]] or [[Array]] - [[Triggers|Trigger]] or trigger area |=
|descr= Detects whether position is within area '''or''' calculates distance to the nearest edge of trigger area by using optional params.
|p2= position: [[Object]] or [[Array]] - reference object (e.g. player) or [[Position]] |=
{{Feature|arma3|Since {{arma3}} v1.58 [[inArea]] is available for an area check.}}
|p3= isScalar (Optional): [[Boolean]] - true for scalar result [default: false] |=
| [[Boolean]] - true when position is in trigger area, false otherwise<br />
[[Number]] - distance from border if ''isScalar'' is true |= Return value
____________________________________________________________________________________________


|x1= <code>_trigger = [[createTrigger]] ["EmptyDetector", [[getPosATL]] [[player]]];
|s1= [area, position, returnDistance, includeFloorCeiling] call [[BIS_fnc_inTrigger]]
_trigger [[setTriggerArea]] [10, 10, 0, false];
_inTrigger = [_trigger, [[player]]] call [[BIS_fnc_inTrigger]]; //_inTrigger = true</code> |=
____________________________________________________________________________________________


| [[createTrigger]] [[createMarker]] [[setTriggerArea]] [[setMarkerSize]] [[triggerArea]] [[markerSize]] |= See also
|p1= area: [[Object]], [[String]], [[Location]] or [[Array]]
* [[Object]] - trigger
* [[String]] - marker
* [[Location]] - location
* [[Array]] - in format [center, distance] or [center, [a, b, angle, rect]] or [center, [a, b, angle, rect, height]]


}}
|p2= position: [[Object]] or [[Array]] - position to check (e.g. [[player]]) or [[Position]]


<h3 style="display:none">Notes</h3>
|p3= returnDistance: [[Boolean]] - (Optional, default [[false]]) [[true]] to return distance to nearest edge of trigger area
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|p4= includeFloorCeiling: [[Boolean]] - (Optional, default [[false]]) to include trigger area floor and ceiling in calculation when calculating distance to nearest edge
</dl>


<h3 style="display:none">Bottom Section</h3>
|r1=
[[Category:Function Group: Misc|{{uc:inTrigger}}]]
* [[Boolean]] - [[true]] when position is in area, false if not
[[Category:Functions|{{uc:inTrigger}}]]
* [[Number]] - (when ''returnDistance'' is [[true]]) - distance from closest border: negative distance - from inside, positive distance - from outside
[[Category:{{Name|arma2}}: Functions|{{uc:inTrigger}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:inTrigger}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:inTrigger}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:inTrigger}}]]


<!-- CONTINUE Notes -->
|x1= <sqf>
<dl class="command_description">
private _trigger = createTrigger ["EmptyDetector", getPosATL player];
<dd class="notedate">Posted on May 6, 2015 - 19:34 (UTC)</dd>
_trigger setTriggerArea [10, 10, 0, false];
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
_inTrigger = [_trigger, player] call BIS_fnc_inTrigger; // _inTrigger = true
<dd class="note">
</sqf>
Works with markers too:
<code>inMarker <nowiki>=</nowiki> ["markername", _position] [[call]] [[BIS_fnc_inTrigger]];</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
|seealso= [[createTrigger]] [[createMarker]] [[setTriggerArea]] [[setMarkerSize]] [[triggerArea]] [[markerSize]] [[inArea]] [[inAreaArray]] [[BIS_fnc_getArea]]
<dl class="command_description">
}}
<dd class="notedate">Posted on October 4, 2015 - 11:14 (UTC)</dd>
<dt class="note">[[User:Larrow|Larrow]]</dt>
<dd class="note">
As of ["Arma 3","Arma3",152,132676,"Stable",true] this command is still broken if checking against markers that have axisB larger axisA.
To get around this if needed you can create your marker with the largest radius in axisA and rotate your marker by 90degrees.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 19:22, 15 September 2024

Hover & click on the images for description

Description

Description:
Detects whether position is within area or calculates distance to the nearest edge of trigger area by using optional params.
Arma 3
Since Arma 3 v1.58 inArea is available for an area check.
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
[area, position, returnDistance, includeFloorCeiling] call BIS_fnc_inTrigger
Parameters:
area: Object, String, Location or Array
  • Object - trigger
  • String - marker
  • Location - location
  • Array - in format [center, distance] or [center, [a, b, angle, rect]] or [center, [a, b, angle, rect, height]]
position: Object or Array - position to check (e.g. player) or Position
returnDistance: Boolean - (Optional, default false) true to return distance to nearest edge of trigger area
includeFloorCeiling: Boolean - (Optional, default false) to include trigger area floor and ceiling in calculation when calculating distance to nearest edge
Return Value:
  • Boolean - true when position is in area, false if not
  • Number - (when returnDistance is true) - distance from closest border: negative distance - from inside, positive distance - from outside

Examples

Example 1:
private _trigger = createTrigger ["EmptyDetector", getPosATL player]; _trigger setTriggerArea [10, 10, 0, false]; _inTrigger = [_trigger, player] call BIS_fnc_inTrigger; // _inTrigger = true

Additional Information

See also:
createTrigger createMarker setTriggerArea setMarkerSize triggerArea markerSize inArea inAreaArray BIS_fnc_getArea

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