Control an unnamed light_environment with lua?

What I heard from my friends who uses Source SDK is that light_environment is hidden to lua if there is no targetname and inputs issued to it.

Is there a way to control it still (Setting a name to it before it hides, etc.)? Without editing the map that is.

Probably not…

**[Ents.FindByClass

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Ents.FindByClass)**

Like I said, it will be hidden without a targetname even to that command

gm_flatgrass has a light_environment, try running “PrintTable(ents.FindByClass(“light_environment”))”… It’ll return nothing.

SOLVED:


if string.lower(game.GetMap()) == "rp_evocity_v2d" then
	function CheckLightEnvs( ent )
		if ValidEntity(ent) and ent:GetClass() == 'light_environment' then
			ent:SetKeyValue("targetname", "lightenv")
			ServerLog("Found light environment " .. ent:EntIndex())
		end
	end
	hook.Add("OnEntityCreated", "CheckLightEnvs", CheckLightEnvs)
end

Used that script above to set a name…

EDIT:
Now my map is opposite of fullbright… The props around are still fullbright though.

the think is the hl2 light_enviroment is static, you cant just change its brightness

Somehow, it ain’t. There is a day/night addon that modifys the light a light_environment got, however, it requires map modification.

thats cool, any link?

Ent:Fire

and i did Ent:Changekeyvalue(“Brightness”, 0,0,0,0)

:frog: