Difference between revisions of "VN ms fnc tracker attackArea"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Text replacement - " |e=" to " |a= |e=")
(Page filling)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
 
{{Function
 
{{Function
  
Line 8: Line 7:
 
|a=
 
|a=
  
|e=
+
|e= global
  
 
|g1= tracker
 
|g1= tracker
  
|d= <pre>/*
+
|d= Spawn waves attacking an area. Uses [[VN_ms_fnc_tracker_positionVisible]], [[VN_ms_fnc_tracker_getHiddenPos]] and [[VN_ms_fnc_tracker_spawnGroup]].
    Author: Wyqer, veteran29
 
    Date: 2019-12-03
 
    Public: Yes
 
  
    Description:
+
|s= [destination, posOrRadius, wavesCount, delay, condition, ao, side, groupSpawnCode, wpRadius, wpCompletion] call [[VN_ms_fnc_tracker_attackArea]]
        Spawn waves attacking area.
 
  
    Parameter(s):
+
|p1n= destination
        _target    - Position to attack                                                    [ARRAY, defaults to []]
+
|p1t= position
        _spawn    - Positions to spawn attackers or radius around target                  [ARRAY, NUMBER, defaults to 200]
+
|p1d= attacked position
        _count    - Amount of waves                                                        [NUMBER, defaults to 10]
+
|p1v=
        _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 {
+
|p2n= posOrRadius
    _this spawn (missionNamespace getVariable _fnc_scriptName);
+
|p2t= {{Biki|Array}} or {{Biki|Number}}
};
+
|p2d= attackers spawn position(s) or radius around ''destination''
 +
|p2v= 200
  
params [
+
|p3n= wavesCount
    ["_target", [], [[]], 3],
+
|p3t= number
    ["_spawn", 200, [0, []]],
+
|p3d= amount of enemy waves
    ["_count", 10, [0]],
+
|p3v= 10
    ["_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]];
+
|p4n= delay
diag_log text _msg;
+
|p4t= number
#ifdef VN_DEBUG
+
|p4d= delay between waves - not a "cooldown between waves" but delay between spawning: previous wave dead or not
    systemChat _msg;
+
|p4v= 45
#endif
 
  
// spawn pos fetching function
+
|p5n= condition
// depends if radius or array of positions given
+
|p5t= code
private _fnc_getPos = {};
+
|p5d= spawn condition code
if (_spawn isEqualType []) then {
+
|p5v= { true }
    // select one of provided positions randomly
 
    _fnc_getPos = {
 
        private _spawnPos = [];
 
        waitUntil {
 
            sleep 1;
 
  
            _spawnPos = selectRandom _spawn;
+
|p6n= ao
            if (_spawnPos isEqualType "") then {
+
|p6t= {{Biki|String}} or {{Biki|Array}}
                _spawnPos = markerPos _spawnPos;
+
|p6d= if provided, 50% chances of the spawned group to be of "Avalanche" kind (track enemy until killed)
            };
+
|p6v= ""
  
            !([allPlayers, _spawnPos] call vn_ms_fnc_tracker_positionVisible)
+
|p7n= side
            && !surfaceIsWater _spawnPos
+
|p7t= side
        };
+
|p7d= waves side
 +
|p7v= {{Biki|east}}
  
        _spawnPos
+
|p8n= groupSpawnCode
    };
+
|p8t= code
} else {
+
|p8d= code to be executed on each spawned groups (passed as <tt>_this</tt>)
    // find random position around target position
+
|p8v= {}
    _fnc_getPos = vn_ms_fnc_tracker_getHiddenPos;
 
</pre><small>''(Placeholder description extracted from the function header by '''LM_exportFunctionsToWiki.sqf''')''</small>
 
  
|s= [] call [[vn_ms_fnc_tracker_attackArea]];
+
|p9n= wpRadius
 
+
|p9t= number
|p1n=
+
|p9d= attack waypoint completion radius
|p1t=
+
|p9v= 20
|p1d=
 
|p1v=
 
  
|p2n=
+
|p10n= wpCompletion
|p2t=
+
|p10t= string
|p2d=
+
|p10d= attack waypoint statement - if ommited, default Tracker/Avalanche behaviour is applied on completion (track enemy until killed)
|p2v=
+
|p10v= nil
  
|r1t=
+
|r1t= array
|r1d=
+
|r1d= spawned groups
  
|x1= <code>-</code>
+
|x1= <code>[markerPos "sog_base", 150, 3, 15] call [[VN_ms_fnc_tracker_attackArea]];</code>
 
}}
 
}}

Latest revision as of 22:44, 25 February 2021

← back to Functions Introduced in S.O.G. Prairie Fire v1.00
by Wyqer, veteran29
Argument(s): n/a
Effect(s): global

Description

Spawn waves attacking an area. Uses VN_ms_fnc_tracker_positionVisible, VN_ms_fnc_tracker_getHiddenPos and VN_ms_fnc_tracker_spawnGroup.

Syntax

Syntax
[destination, posOrRadius, wavesCount, delay, condition, ao, side, groupSpawnCode, wpRadius, wpCompletion] call VN_ms_fnc_tracker_attackArea
Parameters
destination: Position - attacked position
posOrRadius: Array or Number - (Optional, default 200) attackers spawn position(s) or radius around destination
wavesCount: Number - (Optional, default 10) amount of enemy waves
delay: Number - (Optional, default 45) delay between waves - not a "cooldown between waves" but delay between spawning: previous wave dead or not
condition: Code - (Optional, default { true }) spawn condition code
ao: String or Array - (Optional, default "") if provided, 50% chances of the spawned group to be of "Avalanche" kind (track enemy until killed)
side: Side - (Optional, default east) waves side
groupSpawnCode: Code - (Optional, default {}) code to be executed on each spawned groups (passed as _this)
wpRadius: Number - (Optional, default 20) attack waypoint completion radius
wpCompletion: String - (Optional, default nil) attack waypoint statement - if ommited, default Tracker/Avalanche behaviour is applied on completion (track enemy until killed)
Return value
Array - spawned groups

Examples

Example 1
[markerPos "sog_base", 150, 3, 15] call VN_ms_fnc_tracker_attackArea;