BIS fnc inTrigger: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *P([a-gi-z ])" to "$1 - p$2")
 
(55 intermediate revisions by 6 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


| <pre>//
|game4= arma3
/*
|version4= 0.50
File: inTrigger.sqf


Description:
|gr1= Object Manipulation
Detects whether is position within trigger area.


Parameter(s):
|descr= Detects whether position is within area '''or''' calculates distance to the nearest edge of trigger area by using optional params.
_this select 0: OBJECT or ARRAY - Trigger or trigger area
{{Feature|arma3|Since {{arma3}} v1.57 [[inArea]] is available for an area check.}}
_this select 1: ARRAY or OBJECT - Position
_this select 2 (Optional): BOOL - true for scalar result (distance from border)


Returns:
|s1= [area, position, returnDistance, includeFloorCeiling] call [[BIS_fnc_inTrigger]]
Boolean (true when position is in area, false if not).
*/
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_inTrigger]]; --> |= Syntax
|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]]


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


| |= Return value
|p3= returnDistance: [[Boolean]] - (Optional, default [[false]]) [[true]] to return distance to nearest edge of trigger area
____________________________________________________________________________________________


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


| |= See also
|r1=
* [[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


|x1= <sqf>
private _trigger = createTrigger ["EmptyDetector", getPosATL player];
_trigger setTriggerArea [10, 10, 0, false];
_inTrigger = [_trigger, player] call BIS_fnc_inTrigger; // _inTrigger = true
</sqf>
|seealso= [[createTrigger]] [[createMarker]] [[setTriggerArea]] [[setMarkerSize]] [[triggerArea]] [[markerSize]] [[inArea]] [[inAreaArray]] [[BIS_fnc_getArea]]
}}
}}
<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:Function Group: Misc|{{uc:inTrigger}}]]
[[Category:Functions|{{uc:inTrigger}}]]
[[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 -->
<dl class="command_description">
<dd class="notedate">Posted on May 6, 2015 - 19:34 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
Works with markers too:
<code>inMarker <nowiki>=</nowiki> ["markername", _position] [[call]] [[BIS_fnc_inTrigger]];</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 16:45, 8 November 2023

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.57 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