Jump to content

Epoch_Masterloop Error Zero divisor


He-Man

Recommended Posts

Hi, found a little Bug in the Epoch Masterloop:

 0:47:44 Error in expression <
EPOCH_chargeRate = ceil(_totalCapacity / (count _players));
EPOCH_nearPower = t>
 0:47:44   Error position: </ (count _players));
EPOCH_nearPower = t>
 0:47:44   Error Zero divisor
 0:47:44 File x\addons\a3_epoch_code\compile\setup\EPOCH_masterLoop.sqf, line 518

 

The lines shows:

_players = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], _energyRange];

EPOCH_chargeRate = ceil(_totalCapacity / (count _players));

 

Now, when I'm alone on a Server:

"_players = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], _energyRange];" will be 0

->  ceil(_totalCapacity / 0; -> Error

 

Better should be:

_players = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], _energyRange];

if (count _players == 0) then {EPOCH_chargeRate = ceil _totalCapacity;} else { EPOCH_chargeRate = ceil (_totalCapacity / (count _players));};

 

Link to comment
Share on other sites

Thanks! got a fix for this added in the next patch (0.3.5.0)

_players = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], _energyRange];
if (_players isEqualTo []) then {
	EPOCH_chargeRate = ceil _totalCapacity;
} else {
	EPOCH_chargeRate = ceil (_totalCapacity / (count _players));
};

 

Edited by vbawol
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...