From 9457fc9b9b39af8621c11c7c56f3b2a07aab9c28 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Thu, 6 Jul 2017 21:12:58 +0200 Subject: [PATCH 1/3] Fix the issue that SFX variants are not global what means that different players can get different pressure Cookoff sounds to prevent that i split up the sounds in 3 types and used a Weighted select to have the befor used values back --- addons/cookoff/CfgSFX.hpp | 26 ++++++++++++++++++------ addons/cookoff/CfgVehicles.hpp | 11 ++++++++-- addons/cookoff/functions/fnc_cookOff.sqf | 3 ++- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/addons/cookoff/CfgSFX.hpp b/addons/cookoff/CfgSFX.hpp index 1b2d5408afe..53df72eb975 100644 --- a/addons/cookoff/CfgSFX.hpp +++ b/addons/cookoff/CfgSFX.hpp @@ -1,12 +1,26 @@ class CfgSFX { - class GVAR(CookOff) { - name = QGVAR(cookoff); + class GVAR(CookOff_low) { + name = QGVAR(cookoff_low); // Index 4 is percentage chance to play, in theory high pressure is way more likely - variant0[] = {PATHTOF(sounds\cookoff_low_pressure.ogg),6,1,400,0.1,0,0,0}; - variant1[] = {PATHTOF(sounds\cookoff_mid_pressure.ogg),6,1,400,0.25,0,0,0}; - variant2[] = {PATHTOF(sounds\cookoff_high_pressure.ogg),6,1,400,0.65,0,0,0}; - sounds[] = {"variant0","variant1","variant2"}; + sound[] = {QPATHTOF(sounds\cookoff_low_pressure.ogg),6,1,400,1,0,0,0}; + sounds[] = {"sound"}; + titles[] = {}; + empty[] = {"",0,0,0,0,0,0,0}; + }; + class GVAR(CookOff_mid) { + name = QGVAR(cookoff_mid); + // Index 4 is percentage chance to play, in theory high pressure is way more likely + sound[] = {QPATHTOF(sounds\cookoff_mid_pressure.ogg),6,1,400,1,0,0,0}; + sounds[] = {"sound"}; + titles[] = {}; + empty[] = {"",0,0,0,0,0,0,0}; + }; + class GVAR(CookOff_high) { + name = QGVAR(cookoff_high); + // Index 4 is percentage chance to play, in theory high pressure is way more likely + sound[] = {QPATHTOF(sounds\cookoff_high_pressure.ogg),6,1,400,1,0,0,0}; + sounds[] = {"sound"}; titles[] = {}; empty[] = {"",0,0,0,0,0,0,0}; }; diff --git a/addons/cookoff/CfgVehicles.hpp b/addons/cookoff/CfgVehicles.hpp index 1155b9ba52c..7d82d97c12b 100644 --- a/addons/cookoff/CfgVehicles.hpp +++ b/addons/cookoff/CfgVehicles.hpp @@ -1,11 +1,18 @@ class CfgVehicles { class Sound; - class GVAR(Sound): Sound { + class GVAR(Sound_low): Sound { author = ECSTRING(common,ACETeam); _generalMacro = QGVAR(Sound); scope = 1; - sound = QGVAR(CookOff); + sound = QGVAR(CookOff_low); + }; + + class GVAR(Sound_mid): GVAR(Sound_low) { + sound = QGVAR(CookOff_mid); + }; + class GVAR(Sound_high): GVAR(Sound_low) { + sound = QGVAR(CookOff_high); }; class ThingX; diff --git a/addons/cookoff/functions/fnc_cookOff.sqf b/addons/cookoff/functions/fnc_cookOff.sqf index 99a901649f7..7dc061a76ce 100644 --- a/addons/cookoff/functions/fnc_cookOff.sqf +++ b/addons/cookoff/functions/fnc_cookOff.sqf @@ -91,8 +91,9 @@ if (local _vehicle) then { } forEach _positions; if (isServer) then { + private _soundName = [QGVAR(Sound_low), 0.1, QGVAR(Sound_mid), 0.25, QGVAR(Sound_high), 0.65] call BIS_fnc_selectRandomWeighted; // TODO - Players in the vehicle hear no sound (even after exiting the vehicle) - private _sound = createSoundSource [QGVAR(Sound), position _vehicle, [], 0]; + private _sound = createSoundSource [_soundName, position _vehicle, [], 0]; _effects pushBack _sound; }; From 493794514571508b352de7933a086a29271990ba Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Thu, 6 Jul 2017 21:33:47 +0200 Subject: [PATCH 2/3] add todo for 1.74 --- addons/cookoff/functions/fnc_cookOff.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/cookoff/functions/fnc_cookOff.sqf b/addons/cookoff/functions/fnc_cookOff.sqf index 7dc061a76ce..8154217e9dd 100644 --- a/addons/cookoff/functions/fnc_cookOff.sqf +++ b/addons/cookoff/functions/fnc_cookOff.sqf @@ -91,7 +91,7 @@ if (local _vehicle) then { } forEach _positions; if (isServer) then { - private _soundName = [QGVAR(Sound_low), 0.1, QGVAR(Sound_mid), 0.25, QGVAR(Sound_high), 0.65] call BIS_fnc_selectRandomWeighted; + private _soundName = [QGVAR(Sound_low), 0.1, QGVAR(Sound_mid), 0.25, QGVAR(Sound_high), 0.65] call BIS_fnc_selectRandomWeighted; // TODO: replace with script Command in 1.74 // TODO - Players in the vehicle hear no sound (even after exiting the vehicle) private _sound = createSoundSource [_soundName, position _vehicle, [], 0]; From 1157bd750f62915ad3f59e41a0510a401a492d85 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Thu, 6 Jul 2017 23:04:22 +0200 Subject: [PATCH 3/3] inherit in CfgSFX from 1 class --- addons/cookoff/CfgSFX.hpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/addons/cookoff/CfgSFX.hpp b/addons/cookoff/CfgSFX.hpp index 53df72eb975..0d670ead863 100644 --- a/addons/cookoff/CfgSFX.hpp +++ b/addons/cookoff/CfgSFX.hpp @@ -2,26 +2,17 @@ class CfgSFX { class GVAR(CookOff_low) { name = QGVAR(cookoff_low); - // Index 4 is percentage chance to play, in theory high pressure is way more likely sound[] = {QPATHTOF(sounds\cookoff_low_pressure.ogg),6,1,400,1,0,0,0}; sounds[] = {"sound"}; titles[] = {}; empty[] = {"",0,0,0,0,0,0,0}; }; - class GVAR(CookOff_mid) { + class GVAR(CookOff_mid): GVAR(CookOff_low) { name = QGVAR(cookoff_mid); - // Index 4 is percentage chance to play, in theory high pressure is way more likely sound[] = {QPATHTOF(sounds\cookoff_mid_pressure.ogg),6,1,400,1,0,0,0}; - sounds[] = {"sound"}; - titles[] = {}; - empty[] = {"",0,0,0,0,0,0,0}; }; - class GVAR(CookOff_high) { + class GVAR(CookOff_high): GVAR(CookOff_low) { name = QGVAR(cookoff_high); - // Index 4 is percentage chance to play, in theory high pressure is way more likely sound[] = {QPATHTOF(sounds\cookoff_high_pressure.ogg),6,1,400,1,0,0,0}; - sounds[] = {"sound"}; - titles[] = {}; - empty[] = {"",0,0,0,0,0,0,0}; }; };