VN_ms_fnc_dropOrdnance

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

/*
    File: fn_dropOrdnance.sqf
    Author: Wyqer, veteran29
    Date: 2020-07-17
    Last Update: 2020-11-27
    Public: Yes

    Description:
        Drop ordnance from vehicle position.

    Parameter(s):
        _vehicle   - Vehicle to drop ordnance from [OBJECT, defaults to objNull]
        _ordnances - Classes of ordnance to drop [ARRAY, defaults to ORDNANCES_RANDOM]
        _amount    - Amount of ordnances to drop (min 1) [NUMBER, defaults to 3]

    Returns:
        Ordnance drop script [BOOL]

    Example(s):
        [vehicle this] call vn_ms_fnc_dropOrdnance
*/
#define BASE_DROP_SPEED 250
#define DROP_DELAY_MIN 0.15
#define DROP_DELAY_MAX 0.8

_this spawn {
    params [
        ["_vehicle", objNull, [objNull]],
        ["_ordnances", ORDNANCES_ARRAY, [[]]],
        ["_amount", 2, [0]]
    ];

    private _ordnance = selectRandom _ordnances;

    sleep DROP_DELAY_MIN;

    for '_i' from 1 to (_amount max 1) do {
        private _bombPos = ASLToATL (_vehicle modelToWorldWorld [0,-10,-20]);
        private _b = _ordnance createVehicle _bombPos;

        #ifdef VN_DEBUG
            _s = "Sign_Arrow_F" createVehicle _bombPos;
            _s setPosATL _bombPos;
            systemChat str (DROP_DELAY_MIN max (BASE_DROP_SPEED / speed _vehicle) min DROP_DELAY_MAX);
        #endif

        _b setVectorDirAndUp [[0.001,0.001,-1], [0,-1,-1]];
        _b setVelocity [0,0,-40];

        // the faster the plane goes the smaller delay between bombs
        sleep (DROP_DELAY_MIN max (BASE_DROP_SPEED / speed _vehicle) min DROP_DELAY_MAX);
    };

    #ifdef VN_DEBUG
        {
            _x addCuratorEditableObjects [allMissionObjects "Sign_Arrow_F"];
        } forEach allCurators;
    #endif
};
(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)

Syntax

Syntax
[] call vn_ms_fnc_dropOrdnance;
Return value
Nothing

Examples

Example 1
-