Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the issue that SFX variants are not global #5335

Merged
merged 3 commits into from
Jul 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions addons/cookoff/CfgSFX.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@

class CfgSFX {
class GVAR(CookOff) {
name = QGVAR(cookoff);
// 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"};
class GVAR(CookOff_low) {
name = QGVAR(cookoff_low);
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): 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};
};
};
11 changes: 9 additions & 2 deletions addons/cookoff/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion addons/cookoff/functions/fnc_cookOff.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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: replace with script Command in 1.74
// 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;
};
Expand Down