Some Hooks only run when Code is saved and auto-loaded again.
2 replies, posted
I try to use the SetupWorldFog and SetupSkyboxFog Hooks, but they only run when i save the code in the editor and gmod runs it again.
The 'reload' command does not change anything.
As a simplified version of my problem i created fogg.lua in addons\addon_name\lua\autorun\client
print("###StartOfCode###")
hook.Add("SetupWorldFog", "WFogRender", WFogRender )
hook.Add("SetupSkyboxFog", "SkyFogRender", SkyFogRender)
function SkyFogRender(scale)
print("SkyFogRender is being called")
render.FogColor(30,0,0)
render.FogStart(200)
render.FogEnd(2000)
render.FogMaxDensity(1)
render.FogMode(MATERIAL_FOG_LINEAR)
return true
end
function WFogRender()
print("WFogRender is being called")
render.FogColor(5,0,0)
render.FogStart(200)
render.FogEnd(2000)
render.FogMaxDensity(1)
render.FogMode(MATERIAL_FOG_LINEAR)
return true
end
print("###EndOfCode###")
I've tested it in Sandbox and terrortown.
Am i missing something? Do i have to call something first?
Why do the hooks get called once i save the file?
I would appreciate you help.
~ Tim
because the functions don't exist when you add the hooks. Define the functions before you add the hooks and make the functions local.
I feel very stupid right now.
Thank you for the quick response.
Im used to Java and C# taking care of me...
Sorry, you need to Log In to post a reply to this thread.