Fix the issue that SFX variants are not global (#5335)

* 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

* add todo for 1.74

* inherit in CfgSFX from 1 class
This commit is contained in:
Joko 2017-07-08 16:52:25 +02:00 committed by PabstMirror
parent 5cf7569711
commit 2aa0072104
3 changed files with 23 additions and 10 deletions

View File

@ -1,13 +1,18 @@
class CfgSFX { class CfgSFX {
class GVAR(CookOff) { class GVAR(CookOff_low) {
name = QGVAR(cookoff); 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};
variant0[] = {PATHTOF(sounds\cookoff_low_pressure.ogg),6,1,400,0.1,0,0,0}; sounds[] = {"sound"};
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"};
titles[] = {}; titles[] = {};
empty[] = {"",0,0,0,0,0,0,0}; empty[] = {"",0,0,0,0,0,0,0};
}; };
class GVAR(CookOff_mid): GVAR(CookOff_low) {
name = QGVAR(cookoff_mid);
sound[] = {QPATHTOF(sounds\cookoff_mid_pressure.ogg),6,1,400,1,0,0,0};
};
class GVAR(CookOff_high): GVAR(CookOff_low) {
name = QGVAR(cookoff_high);
sound[] = {QPATHTOF(sounds\cookoff_high_pressure.ogg),6,1,400,1,0,0,0};
};
}; };

View File

@ -1,11 +1,18 @@
class CfgVehicles { class CfgVehicles {
class Sound; class Sound;
class GVAR(Sound): Sound { class GVAR(Sound_low): Sound {
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
_generalMacro = QGVAR(Sound); _generalMacro = QGVAR(Sound);
scope = 1; 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; class ThingX;

View File

@ -91,8 +91,9 @@ if (local _vehicle) then {
} forEach _positions; } forEach _positions;
if (isServer) then { 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: replace with script Command in 1.74
// TODO - Players in the vehicle hear no sound (even after exiting the vehicle) // 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; _effects pushBack _sound;
}; };