Jump to content
Sign in to follow this  
madrussian

Temporary Fix for Faces of War Voice Issues

Recommended Posts

First off, hats off to FOW team for their awesome mod.

 

This is a temporary fix for those experiencing FOW mod overwriting voices of non-FOW units including IFA3 and vanilla units (which thankfully appears FOW team is working on).

 

Works well for me so far, restoring voices for all units (inc IFA3 and vanilla units)... should work for any units.  Also, seems that FOW currently also overwrites its own units’ voices sometimes, which are suppose to be mute.  This fixes that too.  Feel free to use this until FOW is able to provide a proper fix in their upcoming release.

 

Without further adieu, here’s my FOW voice remedy.  Works in SP and MP.  Tested and working for me on both HS and DS.  (Didn't test anything related to JIP.)  It's fairly easy to apply.  Instructions:

 

1. Create a file in main mission directory called “RestoreSpeakersFOW.sqf”, paste in the following and save:

Quote

MRU_TT_C_RestoreSpeakersFOW = {

    private ["_pair", "_unit", "_speaker"];

    params ["_speakerPairs"];

    //systemChat format ["_speakerPairs: %1", _speakerPairs];

    {
        _pair = _x;
        _unit = _pair select 0;
        _speaker = _pair select 1;
        _unit setSpeaker _speaker;
    } foreach _speakerPairs;

};

player setVariable ["MRU_TT_RestoreSpeakersClientReady", true, true];

if (isServer) then {
    MRU_Decompile = {
        private ["_compiledStr", "_decompiledStr"];

        params ["_code"];

        _compiledStr = str _code;
        _decompiledStr = _compiledStr select [1, (count _compiledStr) - 2];
        _decompiledStr

    };

    MRU_TT_RestoreSpeakersFOWCondition = {
        _voiceCfg = _x;
        _hit = false;
        _directoriesCfg = _voiceCfg >> "directories";
        if (isArray _directoriesCfg) then {
            _directories = getArray _directoriesCfg;
            _emptyCount = {_x == ""} count _directories;
            if ( _emptyCount == 0 ) then {
                _identityTypesCfgX = _voiceCfg >> "identityTypes";
                if (isArray _identityTypesCfgX) then {
                    _identityTypesX = getArray _identityTypesCfgX;
                    if (_language in _identityTypesX) then { _hit = true };
                };
            };
        };
        _hit
    };

    MRU_TT_RestoreSpeakersFOW = {
        // Call on the server!

        private ["_FOW_Cfg", "_conditionStr", "_speakerPairs", "_unit", "_identityTypesCfg", "_identityTypes", "_language", "_voiceCfgs", "_speakers", "_voiceCfg", "_hit", "_directoriesCfg", "_directories", "_emptyCount", "_identityTypesCfgX", "_identityTypesX"];

        params ["_units"];

        if (! (isServer)) exitWith { false };

        // Check FOW present
        _FOW_Cfg = configFile >> "CfgFactionClasses" >> "fow_heer";
        if (! (isClass _FOW_Cfg)) exitWith { false };

        //systemChat "Restoring Speakers...";

        _conditionStr = [MRU_TT_RestoreSpeakersFOWCondition] call MRU_Decompile;

        _speakerPairs = [];
        {
            _unit = _x;
            if ((speaker _unit) == "") then {
                _faction = toLower (getText (configFile >> "CfgVehicles" >> (typeOf _unit) >> "faction"));
                _speakers = [];
                if ((_faction find "fow_") == 0) then {
                    _speakers = ["fow_mute"];
                } else {
                    _identityTypesCfg = configFile >> "CfgVehicles" >> (typeOf _unit) >> "identityTypes";
                    if (isArray _identityTypesCfg) then {
                        _identityTypes = getArray _identityTypesCfg;
                        if ((count _identityTypes) > 0) then {
                            _language = _identityTypes select 0;
                            _voiceCfgs = _conditionStr configClasses (configFile >> "CfgVoice");
                            {
                                _speakers pushBack (configName _x);
                            } foreach _voiceCfgs;
                        };
                    };
                };
                if ((count _speakers) > 0) then {
                    _speakerPairs pushBack [_unit, selectRandom _speakers];
                };
            };
        } foreach _units;
        if ((count _speakerPairs) > 0) then {
            [_speakerPairs] remoteExec ["MRU_TT_C_RestoreSpeakersFOW", 0];
        };

        true
    };

    [] spawn {
        _players = call BIS_fnc_ListPlayers;
        waitUntil {
            (count _players) == ({ _x getVariable "MRU_TT_RestoreSpeakersClientReady" } count _players)
        };
        { _x setVariable ["MRU_TT_RestoreSpeakersClientReady", nil, true] } foreach _players;
        MRU_TT_RestoreSpeakersClientsReady = true;
    };
};

 

2. Then in “init.sqf”, paste in the following (make sure this runs on all machines):

Quote

call compile preprocessFile "RestoreSpeakersFOW.sqf";
if (isServer) then {
    waitUntil { ! (isNil "MRU_TT_RestoreSpeakersClientsReady") };
};

 

3. Finally, simply call this line on any set of units to restore their voices (run from server, it will broadcast necessary info to clients):

Quote

[_units] call MRU_TT_RestoreSpeakersFOW;

 

Wallah, that should get all those voices back in order!

 

Hope this helps someone for now.  If it works for you (or otherwise lol), I'd be curious to know.

 

Again, thanks to FOW team for amazing mod.  Can’t wait to see what’s next! :smile_o:

 

[EDIT: Updated code in step 2, to account for MRU_TT_RestoreSpeakersClientsReady being a server-only variable.]

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Hello.

 

First of all, thank you very much for your instructions. However, there are still a few things that I am not entirely sure about.

1. I have to edit the "fow_missions.pbo" right?

2. The "init.sqf" in "fow_missions.pbo" looks strangely small (#include "Sta * VuWFTF.sqf"), nothing more is in it.
Should I just paste the command from point 2 below?

3. I don't understand this step at all. Should I insert this order individually for single troops, as an order in the game?

4. When performing steps 1 and 2, the game crashes for me.

 

Greetings

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×