ACE3/addons/parachute/functions/fnc_handleFailureChance.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

27 lines
601 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: JoramD
* Handles percentage chance parachute failure.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, vehicle player] call ace_parachute_fnc_handleFailureChance
*
* Public: No
*/
params ["_unit", "_vehicle"];
if !(_vehicle isKindOf "ParachuteBase") exitWith {};
if (random 1 < GVAR(failureChance)) then {
private _failureDelay = getNumber (configOf _vehicle >> QGVAR(failureDelay));
[FUNC(cutParachute), [_unit, _vehicle], _failureDelay] call CBA_fnc_waitAndExecute;
};