Jump to content
Malcain

SetAperture&SetApertureNew (Bright Nights)

Recommended Posts

Hello Arma community.
I am trying to get bright nights on my server via SetAperture or SetApertureNew commands.
But the only way I managed to get it working is by creating "while do" loop  at the beggining of init.sqf with setaperture inside it, which obviously stopped all other operations.
I tried different approaches, either by creating new sqf files with setaperture loops or by calling it client-side in init.sqf, but nothing worked for me so far.

Also, I know there is a setting in cfgworlds for aperture. But that's not what I need. I'd like to change apperture depending on the server starting ingame time, so that it checks if there is a night or not. This can only be done via scripting.

My end goal is to bring nights into the competitive multiplayer Arma games, and setting custom Aperture looks like a pretty nice solution(if it works) to gamma-abuzing and other nasty stuff.

  • Like 1

Share this post


Link to post
Share on other sites

in init.sqf:

 

[] spawn {
  while {true} do {

    waitUntil {sleep 2; sunOrMoon < 0.5};

    setApertureNew [2, 8, 14, .9];
   waitUntil {sleep 2; sunOrMoon >= 0.5};
   setAperture -1
  }

};
 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

in init.sqf:

 

[] spawn {
  while {true} do {

    waitUntil {sleep 2; sunOrMoon < 0.5};

    setApertureNew [2, 8, 14, .9];
   waitUntil {sleep 2; sunOrMoon >= 0.5};
   setAperture -1
  }

};
 

Thanks for the sunormoon part! That difinetely helps:)
Was just back to say I managed to get it working(smth was wrong server-side when I created the thread), but that sunormoon part difinetely helps with nasty colours during the day/night change phases.

Share this post


Link to post
Share on other sites
17 hours ago, Malcain said:

My end goal is to bring nights into the competitive multiplayer Arma games, and setting custom Aperture looks like a pretty nice solution(if it works) to gamma-abuzing and other nasty stuff.

 

Hello there Malcain !

 

Nice idea by the way !

Share this post


Link to post
Share on other sites

You can just ditch the while loop and do it all in one waitUntil block. Not tested:

waitUntil
{
	sleep 2;
	if (sunOrMoon < 0.5) then {setApertureNew [2, 8, 14, .9];} else {setAperture -1;};
	false;
};

This will loop the command however. I guess you could add some other check. I thought there was some time change EH but guess not as can't see it anywhere.

Share this post


Link to post
Share on other sites
On 15.09.2018 at 8:42 AM, HazJ said:

You can just ditch the while loop and do it all in one waitUntil block. Not tested:


waitUntil
{
	sleep 2;
	if (sunOrMoon < 0.5) then {setApertureNew [2, 8, 14, .9];} else {setAperture -1;};
	false;
};

This will loop the command however. I guess you could add some other check. I thought there was some time change EH but guess not as can't see it anywhere.


I tried a lot of different variations including the above, and mine via addPublicVariableEventHandler, but the tricky part is you need setaperture to be in an endless while do loop to be 100% sure JIP player gets the new value.
I don't know why other options don't give me consistent results.

The only solution that seems to work fine atm is:
if (hasInterface) then {
[] spawn {
 while {true} do {
waitUntil
{    sleep 20;
    if (sunOrMoon < 0.3) then {
setApertureNew [1.2, 1.3, 1.4, 0];
}
else {
setAperture -1;
};
    false;
};
}
};
};

I made sleep 20 to save perfomance, correct me if I am wrong on this.

Share this post


Link to post
Share on other sites

The fact that the stars&moon size increases along with setAperture value, with no way to disable that dependancy, is very annoying. Sometimes BIS provides cool things but often they also overlook details.
Workaround that by restricting overcast value to always be more than 50, which can still provide semi-clear sky but without stars looking like lamps on steroids.

Share this post


Link to post
Share on other sites

As I said, it wasn't tested. That will loop since last condition returns false.

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

×