Difference between revisions of "VN ms fnc waypoint doArtilleryFire"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (1 revision imported)
m (Add mission parameter description)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
 
{{Function
 
{{Function
  
 
|v= 1.00
 
|v= 1.00
  
|a= Wyqer, veteran29
+
|author= Wyqer, veteran29
  
|e=
+
|a= global
 +
 
 +
|e= global
  
 
|g1= waypoint
 
|g1= waypoint
  
|d= <pre>/*
+
|d= Tells the artillery unit to do a (90°) cone-shaped artillery barrage.
    Author: Wyqer, veteran29
 
    Date: 2019-10-23
 
    Public: Yes
 
  
    Description:
+
|s= [vehicle, position, rounds, magazine, radius] call [[VN_ms_fnc_waypoint_doArtilleryFire]]
        Tells the unit to do cone shaped artillery barrage.
 
  
    Parameter(s):
+
|p1n= vehicle
        _vehicle
+
|p1t= object
        _pos
+
|p1d= the artillery vehicle
        _rounds
+
|p1v=
        _magazine
 
        _precision
 
  
    Returns:
+
|p2n= position
        Artillery fired [BOOL]
+
|p2t= array
*/
+
|p2d= strike position
 +
|p2v=
  
// more steps equals closer impact points
+
|p3n= rounds
#define OFFSET_STEPS    4
+
|p3t=
 +
|p3d=
 +
|p3v= 5 + random 3
  
if (!canSuspend) exitWith {
+
|p4n= magazine
    _this spawn (missionNamespace getVariable _fnc_scriptName);
+
|p4t=
};
+
|p4d= if not provided, the first found magazine is used
 +
|p4v= ""
  
params [
+
|p5n= radius
    "_vehicle",
+
|p5t= number
    "_pos",
+
|p5d= maximum cone length
    ["_rounds", 5 + random 3],
+
|p5v= 55
    ["_magazine", ""],
 
    ["_precision", 55]
 
];
 
 
 
// determine used ammunition
 
private _vehicleArtilleryAmmo = getArtilleryAmmo [_vehicle];
 
 
 
if (_magazine == "" && count _vehicleArtilleryAmmo > 0) then {
 
    _magazine = _vehicleArtilleryAmmo select 0;
 
};
 
 
 
if (!(_pos inRangeOfArtillery [[_vehicle], _magazine])) exitWith {
 
    #ifdef VN_DEBUG
 
        systemChat format ["[VN_Artillery] %1 can not fire.", _vehicle];
 
    #endif
 
    false
 
};
 
 
 
#ifdef VN_DEBUG
 
    // systemChat format ["[VN_Artillery] Veh:%1, Rnds:%3, Mag:%4, Trgt:%2", _vehicle, _pos, _rounds, _magazine];
 
 
 
    private _m = format ["vn_artillery_target%1", _vehicle];
 
    deleteMarker _m; createMarker [_m, _pos];
 
    _m setMarkerType "mil_dot";
 
    _m setMarkerText "target";
 
    _m setMarkerColor "ColorGREEN";
 
#endif
 
 
 
// get direction to target
 
private _dirTo = _vehicle getDir _pos;
 
private _posOffset = 0;
 
// offset initial positon closer to shooter
 
_pos = _pos getPos [-1 * _precision, _dirTo];
 
 
 
for "_i" from 1 to _rounds do {
 
 
 
    // offseting position like this and shooting single should result in cone like shape
 
    private _target = _pos getPos [_posOffset + random _precision, _dirTo + (45 - random 90)];
 
    // increase offset
 
</pre><small>''(Placeholder description extracted from the function header by '''LM_exportFunctionsToWiki.sqf''')''</small>
 
 
 
|s= [] call [[vn_ms_fnc_waypoint_doArtilleryFire]];
 
 
 
|p1n=
 
|p1t=
 
|p1d=
 
|p1v=
 
 
 
|p2n=
 
|p2t=
 
|p2d=
 
|p2v=
 
  
|r1t=
+
|r1t= boolean
|r1d=
+
|r1d= function's success
  
|x1= <code>-</code>
+
|x1= <code>[arty_1, getMarkerPos "strike", 10, nil, 100] call [[VN_ms_fnc_waypoint_doArtilleryFire]];</code>
 
}}
 
}}

Latest revision as of 22:31, 23 February 2021

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

Description

Tells the artillery unit to do a (90°) cone-shaped artillery barrage.

Syntax

Syntax
[vehicle, position, rounds, magazine, radius] call VN_ms_fnc_waypoint_doArtilleryFire
Parameters
vehicle: Object - the artillery vehicle
position: Array - strike position
rounds - (Optional, default 5 + random 3)
magazine - (Optional, default "") if not provided, the first found magazine is used
radius: Number - (Optional, default 55) maximum cone length
Return value
Boolean - function's success

Examples

Example 1
[arty_1, getMarkerPos "strike", 10, nil, 100] call VN_ms_fnc_waypoint_doArtilleryFire;