How to change fog settings

Goal is super simple, when calling a function witha given true or false, it will change the fog settings.

-- Fog Increase Event
function Events.Fog(enable)
	eventStates.fogIncrease = enable
	warn(enable) -- called once w true prints "true" once
	if enable then
		game.Lighting.FogEnd = 150
		game.Lighting.FogStart = 0
	else
		game.Lighting.FogEnd = 700
		game.Lighting.FogStart = 150
	end
end

I only call the function once and it sets the fog correctly for a second but then it goes to 1000 and 150. sorta resetting. why is this?

i just figured out fog is read parallel which is pretty weird. how else can i set fog then?

I assume you have deleted the Atmosphere object?

Fog does not work with Atmosphere as far as I know.

[spoiler]This just means that the value can be read but not written to in parallel; you can still read and write in serial.[/spoiler]

i have.

What is enable supposed to be in the function?

Read parallel has nothing to do with this, it just means that it is read only in parallel threads

its a boolean value. and the new fog settings are set and then immediately returns to the value 1000, 150

Is it possible that there is another script changing the value?

oh i cant read. yeah it is indeed read parallel not read only. I looked through all my scripts and found it. it was in a loop for the camera. my apologies

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.