diff --git a/addons/cookoff/XEH_postInit.sqf b/addons/cookoff/XEH_postInit.sqf index 36cebc1d17..750fb87c14 100644 --- a/addons/cookoff/XEH_postInit.sqf +++ b/addons/cookoff/XEH_postInit.sqf @@ -53,6 +53,8 @@ ) then { if (GVAR(ammoCookoffDuration) == 0) exitWith {}; ([_vehicle] call FUNC(getVehicleAmmo)) params ["_mags", "_total"]; - [_vehicle, _mags, _total] call FUNC(detonateAmmunition); + + private _delay = (random MAX_AMMO_DETONATION_START_DELAY) max MIN_AMMO_DETONATION_START_DELAY; + [FUNC(detonateAmmunition), [_vehicle, _mags, _total], _delay] call CBA_fnc_waitAndExecute; }; }, nil, ["Man","StaticWeapon"]] call CBA_fnc_addClassEventHandler; diff --git a/addons/cookoff/script_component.hpp b/addons/cookoff/script_component.hpp index ef4a6085dd..03b3e5c5f5 100644 --- a/addons/cookoff/script_component.hpp +++ b/addons/cookoff/script_component.hpp @@ -29,6 +29,9 @@ #define MAX_TIME_BETWEEN_AMMO_DET 25 #define MAX_COOKOFF_INTENSITY 10 +#define MIN_AMMO_DETONATION_START_DELAY 1 // Min time to wait before a vehicle's ammo starts to cookoff +#define MAX_AMMO_DETONATION_START_DELAY 6 // Max time to wait before a vehicle's ammo starts to cookoff + // Delay between flame effect for players in a cooking off vehicle #define FLAME_EFFECT_DELAY 0.4