In Area - Theseus-Aegis/MissionTemplate GitHub Wiki

This page will explain the usage of the inArea function.


/*
 * Author: Mike
 * Checks if any unit in a list is inside of an area.
 *
 * Can be called anywhere.
 *
 * Arguments
 * 0: Unit Array <ARRAY>
 * 1: Marker <MARKER>
 *
 * Return Value:
 * BOOL
 *
 * Example:
 * [[myGuy, myOtherGuy], "MyMarker"] call MFUNC(inArea)
 */

Usage

This function is primarily designed for Per frame handler style triggers, checking if players are within a marker radius. It can be used to check for individual AI units in an array, but not via groups.

Example:

[{
    params ["_args", "_handle"];
    _args params [["_A", false]];

    private _players = [true] call MFUNC(players);

    if (!_A) then {
        if ([_players, "MyMarker"] call MFUNC(inArea)) then {
            _args set [0, true];
        };
    };
}, 3] call CBA_fnc_addPerFrameHandler;

Alternate Example:

private _groupUnits = units MyGroup;
private _inArea = [_groupUnits, "MyMarker"] call MFUNC(inArea);

if (_inArea) then {};
⚠️ **GitHub.com Fallback** ⚠️