Difference between revisions of "VN ms fnc waypoint artillery"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (1 revision imported)
m (Text replacement - " |a= " to " |author= ")
Line 4: Line 4:
 
|v= 1.00
 
|v= 1.00
  
|a= Wyqer, veteran29
+
|author= Wyqer, veteran29
  
 
|e=
 
|e=

Revision as of 18:33, 5 January 2021

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

Description

/*
    Author: Wyqer, veteran29
    Date: 2019-09-23
    Public: Yes

    Description:
        Tells the group to fire artillery barrage on waypoint/position.

    Path (for scripted WP):
        vn\missions_f_vietnam\functions\waypoint\fn_waypoint_Artillery.sqf

    Parameter(s):
        _group    - Group to do the barrage                                 [GROUP, defaults to grpNull]
        _pos      - Position to fire at                                     [ARRAY, defaults to [0,0,0]]
        _owner    - Waypoint owner, optional                                [OBJECT, defaults to objNull]
        _rounds   - Number of rounds to fire per artillery vehicle in group [NUMBER, defaults to 5 + random 3]
        _magazine - Magazine type to fire                                   [STRING, defaults to ""]
        _precision- Artillery precision in meters                           [NUMBER, defaults to 50]

    Returns:
        Script reached the end [BOOL]
*/

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

params [
    ["_group", grpNull, [grpNull]],
    ["_pos", [0,0,0], [[]], 3],
    ["_owner", objNull, [objNull]],
    ["_rounds", 5 + random 3, [0]],
    ["_magazine", "", [""]],
    ["_precision", 50, [0]]
];

if (_owner isEqualTo objNull) then {
    _owner = leader _group;
};

waitUntil {simulationEnabled _owner};

#ifdef VN_DEBUG
    systemChat format ["[VN_WP_Artillery] Grp:%1, Pos:%2, Owner:%3, Rnds:%4, Mag:%5", _group, _pos, _owner, _rounds, _magazine];
#endif

private _wp = [_group, currentWaypoint _group];
_wp setWaypointDescription localize "STR_A3_CfgWaypoints_Artillery";

// get group vehicles
private _vehicles = [];
{
    _vehicles pushBackUnique vehicle _x;
} forEach units _group;

// filter out humans
_vehicles = _vehicles select {!(_x isKindOf "CAManBase")};

// fire rounds
private _scriptHandles = _vehicles apply {
    sleep 1 + random 1;
    [_x, _pos, _rounds, _magazine, _precision] spawn vn_ms_fnc_waypoint_doArtilleryFire // return
};

// wait until all scripts are finished
waitUntil {
    _scriptHandles findIf {!scriptDone _x} == -1
};

#ifdef VN_DEBUG
(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)

Syntax

Syntax
[] call vn_ms_fnc_waypoint_artillery;
Return value
Nothing

Examples

Example 1
-