Cook-off probability and cook-off tweaks (#5585)

* Added cookoff probability for vehicles. Tweaks to cookoff to stop total blocking of destruction in some cases.

* Changed var name to probability. Better method for getting config value.

* Fixed naming error

* Changed setting to be a global coefficient. Added some info to cookoff doc

* Reverted hitfuel check

* Reverted damage threshold for cook-off

* Tweaked probability calculation

* Update fnc_handleDamage.sqf
This commit is contained in:
Tim Beswick 2017-11-30 22:54:47 +00:00 committed by PabstMirror
parent 504d54461e
commit e85c752ca6
5 changed files with 43 additions and 5 deletions

View File

@ -28,4 +28,10 @@ class ACE_Settings {
value = 1;
typeName = "SCALAR";
};
class GVAR(probabilityCoef) {
displayName = CSTRING(probabilityCoef_name);
description = CSTRING(probabilityCoef_tooltip);
value = 1;
typeName = "SCALAR";
};
};

View File

@ -37,6 +37,7 @@ class CfgVehicles {
class Tank_F: Tank {
GVAR(ammoLocation) = "HitHull";
GVAR(cookoffSelections)[] = {"poklop_gunner","poklop_commander"};
GVAR(probability) = 0.5;
};
class MBT_02_base_F: Tank_F {
GVAR(ammoLocation) = "HitTurret";
@ -46,6 +47,7 @@ class CfgVehicles {
class Wheeled_APC_F: Car_F {
GVAR(ammoLocation) = "HitHull";
GVAR(cookoffSelections)[] = {"poklop_gunner","poklop_commander"};
GVAR(probability) = 0.8;
// big explosions for wheeled APCs (same as for tanks)
explosionEffect = "FuelExplosionBig";

View File

@ -66,12 +66,22 @@ if (_simulationType == "tank") exitWith {
// ammo was hit, high chance for cook-off
if (_hitpoint == _ammoLocationHitpoint) then {
if (_damage > 0.5 && {random 1 < 0.7}) then {
_vehicle call FUNC(cookOff);
if (_damage > 0.5) then {
// get cookoff probability for vehicle
private _probability = [_vehicle call CBA_fnc_getObjectConfig >> QGVAR(probability), "number", 0.7] call CBA_fnc_getConfigEntry;
// probability multiplied by coef for global probability control (higher coef = more probable cookoff)
if (GVAR(probabilityCoef) > 1) then {
_probability = 1 - (1 - _probability) / GVAR(probabilityCoef);
} else {
_probability = _probability * GVAR(probabilityCoef);
};
if (random 1 < _probability) then {
_vehicle call FUNC(cookOff);
};
};
} else {
if (_hitpoint in ["hithull", "hitturret", "#structural"] && {_newDamage > 0.6 + random 0.3}) then {
_vehicle call FUNC(cookOff);
if (_hitpoint in ["hithull", "hitturret", "#structural"] && {_newDamage > 0.8 + random 0.2}) then {
_vehicle setDamage 1;
};
};

View File

@ -115,6 +115,12 @@
<Chinese>設定彈藥殉爆效果會持續多久時間 [輸入0來關閉殉爆效果]</Chinese>
<Chinesesimp>设定弹药殉爆效果会持续多久时间 [输入0来关闭殉爆效果]</Chinesesimp>
<Korean>쿡오프 지속 시간의 배수 [0 이면 비활성]</Korean>
</Key>
</Key>
<Key ID="STR_ACE_CookOff_probabilityCoef_name">
<English>Cook-off probability coefficient</English>
</Key>
<Key ID="STR_ACE_CookOff_probabilityCoef_tooltip">
<English>Multiplier for cook-off probability. Higher value results in higher cook-off probability</English>
</Key>
</Package>
</Project>

View File

@ -27,3 +27,17 @@ Likewise, cook off can also be disabled for a specific vehicle:
```
VEHICLE setVariable ["ace_cookoff_enable", false, true];
```
## 2. Cook off probability
You can set the probability of cook off for individual vehicle types by changing the `ace_cookoff_probability` value in the vehicle's config:
```
class MyVehicle {
ace_cookoff_probability = 0.6;
};
```
Global cook off probability can also be adjusted with the `ace_cookoff_probabilityCoef` mission setting.
Higher values will make cook-off more probable, whilst lower values will make cook-off less probable.