EpochModTeam / Epoch

Epoch Survival Game Mode for ARMA 3
http://epochmod.com/
Other
91 stars 82 forks source link

Radiation post-effects logic is a bit off #950

Closed morgoth0 closed 6 years ago

morgoth0 commented 6 years ago

[Edited to make more sense :)] The grainy post-effects for radiation hits kicks in at 2% rad level. The reason for this is the code in event2.sqf:

if (_playerRadiation > 1) then { _radiationVal = linearConversion [0,100,_playerRadiation,1,10,true]; [(ceil _radiationVal)/10, 2] call epoch_setRadiation; } else { [0, 2] call epoch_setRadiation; };

The issue is the linearConversion command. At 2% radiation the return value of that is 1.18 which in the next line is converted to 0.2. Note that without the _playerRadiation > 1 condition, grainy effects would start at 1% radiated...

An initial solution would be to first change the lines to the following:

if (_playerRadiation > 1) then { _radiationVal = linearConversion [0,100,_playerRadiation,0,10,true]; [(ceil _radiationVal)/10, 2] call epoch_setRadiation; } else { [0, 2] call epoch_setRadiation; };

This would mean that the _radiationVal is 0.2 and the value passed to epoch_setRadiation would be 0.1. This also means that the select statements 0.1 code block in Epoch_setRadiation.sqf would need to be changed from:

[(rmx_var_RadiationHandles select 0), _speed, [0.185533,1,1,1,0,true]] call epoch_postprocessAdjust; [(rmx_var_RadiationHandles select 1), _speed, [1,1,0,0,0,0,0,0,0,0,1,0,0,0,0]] call epoch_postprocessAdjust; [(rmx_var_RadiationHandles select 2), _speed, [0,0,0]] call epoch_postprocessAdjust;

to

rmx_var_RadiationHandles call epoch_postprocessDestroy; rmx_var_RadiationHandles = nil;

Then any radiation value below 10% would not cause the grainy effect.

Now, that with that fixed, I would also propose the addition of a new CfgEpochClient.hpp variable, lets call it RadiationEffectsThreshold with a default of 10. In masterloop's init.sqf we set a local variable _radiationEffectsThreshold to be that value, then in Event2.sqf we change the if condition to be:

if (_playerRadiation > _radiationEffectsThreshold) then {

This I think would be good because otherwise myself and some others I know are just editing Epoch_setRadiation.sqf every update because we're using a threshold of 30% for example.

Was not sure whether experimental was open for commits yet. If so, and people approve, I will make these changes and push them,

Cheers again, Grahame.

vbawol commented 6 years ago

I think you are right, I thought the grain happened too early as well. Experimental is open for commits and PR's and we will likely do hotfix for the game mode next Thursday provided it can wait that long and nothing major pops up.

morgoth0 commented 6 years ago

Okay. I will make those changes now. Testing on my Badlands server first.

morgoth0 commented 6 years ago

PS: Anyone know how I can get lines of code in separate lines when using the code tags? They just keep appearing as one line. Note I copy and paste code from NotePad++

morgoth0 commented 6 years ago

Closing. Pull request made and committed by @vbawol