Difference between revisions of "VN ms fnc waypoint doArtilleryFire"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Text replacement - " {{Function" to "Category:TODO {{Function")
m (Add mission parameter description)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:TODO]]
 
 
{{Function
 
{{Function
  
Line 6: Line 5:
 
|author= Wyqer, veteran29
 
|author= Wyqer, veteran29
  
|a=
+
|a= global
  
|e=
+
|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
 
#define OFFSET_STEPS    4
 
 
 
if (!canSuspend) exitWith {
 
    _this spawn (missionNamespace getVariable _fnc_scriptName);
 
};
 
 
 
params [
 
    "_vehicle",
 
    "_pos",
 
    ["_rounds", 5 + random 3],
 
    ["_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 {
+
|p3n= rounds
    #ifdef VN_DEBUG
+
|p3t=
        systemChat format ["[VN_Artillery] %1 can not fire.", _vehicle];
+
|p3d=
    #endif
+
|p3v= 5 + random 3
    false
 
};
 
  
#ifdef VN_DEBUG
+
|p4n= magazine
    // systemChat format ["[VN_Artillery] Veh:%1, Rnds:%3, Mag:%4, Trgt:%2", _vehicle, _pos, _rounds, _magazine];
+
|p4t=
 +
|p4d= if not provided, the first found magazine is used
 +
|p4v= ""
  
    private _m = format ["vn_artillery_target%1", _vehicle];
+
|p5n= radius
    deleteMarker _m; createMarker [_m, _pos];
+
|p5t= number
    _m setMarkerType "mil_dot";
+
|p5d= maximum cone length
    _m setMarkerText "target";
+
|p5v= 55
    _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;