Jump to content

Fix fn_surfacenoise when using JSRS


DNightmare

Recommended Posts

For everyone that allows JSRS on their Epoch-Server here's a little fix to stop the (client-side) RPT spamming / errors for SurfaceNoise.

 

Normally, the client checks the config for surfacenoiselevel:

// Sample Config Entry: ["\ca\sounds\Characters\Grass\grass_run_1",0.0199526,1,23]
_soundVal = parseNumber format["%1",((getArray (configFile >> "CfgVehicles" >> "CAManBase" >> "SoundEnvironExt" >> _soundType) select 0) select 3)];

Result is 23, as this is the 4th entry in this array.

 

 

But when using JSRS the returned array looks a bit different:


["run",["JSRS_Movement\grass\Run (1)",1,1,40]]

Select 3 would result in an error, because the outer array only has 2 entries. Apart from that, the JSRS values are higher than the ones in Epoch so it would be a disadvantage for all JSRS users (they would make louder noises -> attrack zombies more often).

 

To counter that, and stop the error-spamming (so you can debug other stuff easier with your client RPT), do the following:

 

- Overload your compiles.sqf from dayz_code.pbo

- Move the fn_surfacenoise.sqf from dayz_code into your mission.pbo, subfolder "fixes" and change your compiles.sqf:

world_surfaceNoise = compile preprocessFileLineNumbers "fixes\fn_surfaceNoise.sqf"; 

- Change the source of fn_surfacenoise.sqf to the following:

//Assess Terrain
private ["_unit","_pos","_type","_typeA","_soundType","_soundVal","_array"];
_unit = 	_this;
_pos = 		getPosATL _unit;
_type = 	surfaceType _pos;
_typeA = 	toArray _type;
_typeA 		set [0,"DEL"];
_typeA = 	_typeA - ["DEL"];
_type = 	toString _typeA;

_soundType = 	getText (configFile >> "CfgSurfaces" >> _type >> "soundEnviron");
if((typeName ((getArray (configFile >> "CfgVehicles" >> "CAManBase" >> "SoundEnvironExt" >> _soundType) select 0) select 1)) == "ARRAY") then{
	// JSRS present, setting static Val of 25
	_soundVal = 25;
} else {
	// No JSRS present, grabbing configvalue
	_soundVal =	parseNumber format["%1",((getArray (configFile >> "CfgVehicles" >> "CAManBase" >> "SoundEnvironExt" >> _soundType) select 0) select 3)];
	if (_soundVal == 0) then {
		_soundVal = 25;
	};
};
_array = [_soundType,_soundVal];
_array

This way, if JSRS is present, it won't try to load it's value (because it's to high) and just set it to plain 25.

On loud surfaces, that would be an advantage for JSRS users, so if I find the time, I will include a translation between JSRS <> Epoch, but for now. It finally stops the spamming :)

 

Cheers,

DNightmare

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...