VN_ms_fnc_tracker_attackArea

From Savage Game Design Wiki
Revision as of 12:47, 16 September 2019 by vn>Unknown user (Generated by LM_exportFunctionsToWiki.sqf)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
← back to Functions Introduced in S.O.G. Prairie Fire v1.00
Argument(s): n/a
Effect(s): unknown

Description

/*
    Author: Wyqer, veteran29
    Date: 2019-12-03
    Public: Yes

    Description:
        Spawn waves attacking area.

    Parameter(s):
        _target    - Position to attack                                                     [ARRAY, defaults to []]
        _spawn     - Positions to spawn attackers or radius around target                   [ARRAY, NUMBER, defaults to 200]
        _count     - Amount of waves                                                        [NUMBER, defaults to 10]
        _delay     - Delay between waves                                                    [NUMBER, defaults to 45]
        _condition - Condition code, spawning will stop if it will return false             [CODE, defaults to {true}]
        _ao        - Area, if provided spawned units will have a chance to become avalanche [ARRAY or STRING, defaults to ""]
        _side      - Side of the attacking groups                                           [SIDE, defaults to EAST]
        _onSpawned - Callback function to execute on each spawned group (passed as _this)   [CODE, defaults to {}]
        _completionRadius   - Attack waypoint completion radius                             [NUMBER, defaults to 20]
        _completionStatment - Attack waypoint statment, if ommited default Tracker/Avalanche is applied on completion [STRING, defaults to nil]

    Example:
        [markerPos "vn_wp1", 150, 3, 15] call vn_ms_fnc_tracker_attackArea;

    Returns:
        Spawned groups [ARRAY]
*/

if (!canSuspend) exitWith {
    _this spawn (missionNamespace getVariable _fnc_scriptName);
};

params [
    ["_target", [], [[]], 3],
    ["_spawn", 200, [0, []]],
    ["_count", 10, [0]],
    ["_delay", 45, [0]],
    ["_condition", {true}, [{}]],
    ["_ao", "", ["", []], [4,5,6]],
    ["_side", EAST, [sideUnknown]],
    ["_onSpawned", {}, [{}]],
    ["_completionRadius", 20, [0]],
    ["_completionStatement", nil, [""]]
];

private _msg = format ["[VN] Area attack starting - %1", _this select [0, 4]];
diag_log text _msg;
#ifdef VN_DEBUG
    systemChat _msg;
#endif

// spawn pos fetching function
// depends if radius or array of positions given
private _fnc_getPos = {};
if (_spawn isEqualType []) then {
    // select one of provided positions randomly
    _fnc_getPos = {
        private _spawnPos = [];
        waitUntil {
            sleep 1;

            _spawnPos = selectRandom _spawn;
            if (_spawnPos isEqualType "") then {
                _spawnPos = markerPos _spawnPos;
            };

            !([allPlayers, _spawnPos] call vn_ms_fnc_tracker_positionVisible)
            && !surfaceIsWater _spawnPos
        };

        _spawnPos
    };
} else {
    // find random position around target position
    _fnc_getPos = vn_ms_fnc_tracker_getHiddenPos;
(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)

Syntax

Syntax
[] call vn_ms_fnc_tracker_attackArea;
Return value
Nothing

Examples

Example 1
-