• Fixing A Weather System [HELP]
    3 replies, posted
I'm using the map City 17, and I'm trying to get rain NOT to go through some of the roofs. [spoiler][quote= Original Code]local function IsOutside() local pos = LocalPlayer():EyePos() local trace = util.TraceLine( {start = pos, endpos = pos+Vector( 0, 0, 32768), mask=MASK_SOLID_BRUSHONLY + MASK_BLOCKLOS + MASK_SOLID + CONTENTS_MOVEABLE} ) Weather.Outside = (not trace.Hit) or trace.HitSky if Weather.Outside then Weather.Height = math.min( (trace.Hit and (trace.HitPos.z - trace.StartPos.z) or 800) - 20, 800 ) else Weather.Height = math.max( (trace.Hit and (trace.HitPos.z - trace.StartPos.z) or 800) + 100, 400 ) end return Weather.Outside end[/quote] Now, I modified it in everyway possible, but I can't seem to NOT make it go through some of the roofs. This is the code that checks if you are outside, so it will draw the rain outside. Can anyone help me on this? [quote= Code that Seems to Work with Other Systems] local trace = { }; trace.start = pos; trace.endpos = trace.start + Vector( 0, 0, 32768 ); trace.mask = MASK_BLOCKLOS; local tr = util.TraceLine( trace ); if( tr.HitSky ) then return true end return false; [/quote] That is code that seems to work with OTHER systems, but it gives me this error when I replace it: [quote][Clockwork] The 'Think' hook failed to run. lua/cl_weather.lua:16: bad argument #1 to '__add' (Vector expected, got nil) [Clockwork] The 'HUDPaint' hook failed to run. lua/cl_weather.lua:16: bad argument #1 to '__add' (Vector expected, got nil) [[/quote] The code is in cl_weather, but it's not working for some reason. Any help? I'm trying to solve this as we speak, since I'm new to LUA itself. (A programmer, but just new to LUA.) Line 16 is: trace.endpos = trace.start + Vector( 0, 0, 32768 ); [/spoiler] EDIT: I've fixed the error, my code now: [url=http://pastebin.com/HQU99x1w]http://pastebin.com/HQU99x1w[/url] But it still goes through the ceiling, help? EDIT EDIT: I know it has something to do with the weather height, but how can I make it not go indoors?
Have you considered looking into other open source weather systems for help? The code your using looks very similar to that of what MyHatStinks used in his westher system but his is a bit different to yours. I recommend having a look at it: [url]https://github.com/MyHatStinks/EnvironmentSystem/blob/master/lua/cl_weather.lua[/url]
I have been using his weather system, I've just been trying to fix it. I've downloaded and search the code of every single weather modification out there, but nothing seems to really work. It just goes through the ceiling.
[QUOTE=Kemerd;42870367]I have been using his weather system, I've just been trying to fix it. I've downloaded and search the code of every single weather modification out there, but nothing seems to really work. It just goes through the ceiling.[/QUOTE]His definitely works, there shouldn't really be much to fix. There must be some cause of your problem elsewhere instead of the code itself.
Sorry, you need to Log In to post a reply to this thread.