Jump to content
sowens

Error in script allPlayers - entities "HeadlessClient_F"

Recommended Posts

The following script is throwing a random error, sometimes.

 

    if ( (count (allPlayers - entities "HeadlessClient_F") >= (4 / GRLIB_csat_aggressivity) )) && ([] call F_opforCap < GRLIB_battlegroup_cap) && (combat_readiness >= 70) && (diag_fps > 15.0))  then {
        [] spawn spawn_battlegroup;
    };

 

It does not throw an error at game launch. I am not sure what I have wrong here. Any suggestions? I know I am missing something but I just not sure if its syntax or something else.

 

15:00:38 Error in expression <Players - entities "HeadlessClient_F") )>
15:00:38   Error position: <>
15:00:38   Error Missing )
15:00:38 Error in expression <Players - entities "HeadlessClient_F") )>
15:00:38   Error position: <>
15:00:38   Error Missing )

 

 

Share this post


Link to post
Share on other sites

When in doubt, spread it out:

 

private _playerCnt = ((count (allPlayers - entities "HeadlessClient_F")) >= (4 / GRLIB_csat_aggressivity));
private _cap = [] call F_opforCap < GRLIB_battlegroup_cap;
private _readiness = combat_readiness >= 70;
private _fps = diag_fps > 15.0;

if (_playerCnt && _cap && _readiness && _fps) then 
{
	[] spawn spawn_battlegroup;
};

You were missing a parenthesis in the ocean of parentheses that you were using. The above is just a bit cleaner.

Share this post


Link to post
Share on other sites

lol...I thought I accounted for them all. Thanks!

 

Share this post


Link to post
Share on other sites

Same generic error popping up. It still works, as it did before but that error is still there. Not sure why. Going to have to dig deeper. Thanks for the help though.

Share this post


Link to post
Share on other sites

Hm, try this instead:

 

private _playerCnt = count (allPlayers select { !(_x in (entities "HeadlessClient_F")) });
private _inThreshold = 4 / GRLIB_csat_aggressivity;

private _cap = [] call F_opforCap < GRLIB_battlegroup_cap;
private _readiness = combat_readiness >= 70;
private _fps = diag_fps > 15.0;

if (_inThreshold && _cap && _readiness && _fps) then 
{
	[] spawn spawn_battlegroup;
};

 OR:

 

private _playerCnt = count (allPlayers select { !(typeOf _x isEqualTo "HeadlessClient_F")) });
private _inThreshold = 4 / GRLIB_csat_aggressivity;

private _cap = [] call F_opforCap < GRLIB_battlegroup_cap;
private _readiness = combat_readiness >= 70;
private _fps = diag_fps > 15.0;

if (_inThreshold && _cap && _readiness && _fps) then 
{
	[] spawn spawn_battlegroup;
};

 

Share this post


Link to post
Share on other sites

Thanks bud, I will give it a go. Still learning but appreciate the examples.

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

×