• What do you need help with? V3
    6,419 replies, posted
Slight problem when working on day/night system. How can I convert time from 0-10000 to sky color easily? I'm thinking if math.sin() might help me.. Edit: What? Is math.sin broken? It returns weird numbers, sin 360 deg is not 0 as it should be. [IMG]http://puu.sh/1kvM1[/IMG]
[QUOTE=ollie;38248856]Slight problem when working on day/night system. How can I convert time from 0-10000 to sky color easily? I'm thinking if math.sin() might help me.. Edit: What? Is math.sin broken? It returns weird numbers, sin 360 deg is not 0 as it should be. [IMG]http://puu.sh/1kvM1[/IMG][/QUOTE] Radians my friend
[QUOTE=Drakehawke;38249300]Radians my friend[/QUOTE] Did you see that i tried: [lua] lua_run print(math.sin(math.rad(360))) [/lua] and it returned -2.449212 blablabla, even though sin should be alway between -1 to 1? [IMG]http://puu.sh/1kwzX[/IMG] That can not be correct, right?
[QUOTE=ollie;38249505]Did you see that i tried: [lua] lua_run print(math.sin(math.rad(360))) [/lua] and it returned -2.449212 blablabla, even though sin should be alway between -1 to 1?[/QUOTE] It also says e-016
[QUOTE=my_hat_stinks;38249520]It also says e-016[/QUOTE] Ah damit, but it really should be exactly 0?
Yeah, there'll be some rounding errors, remember pi is an infinite decimal and that has to be limited somewhere so it can be stored in code.
[QUOTE=Drakehawke;38249543]Yeah, there'll be some rounding errors, remember pi is an infinite decimal and that has to be limited somewhere so it can be stored in code.[/QUOTE] I know but sin PI*2 is [B]always[/B] 0, it worked fine in GM12. Just got confused because i didn't see the exponent at the end. But back to the 'problem', converting time in decimals to sky color.
[QUOTE=ollie;38249639]I know but sin PI*2 is [B]always[/B] 0, it worked fine in GM12. Just got confused because i didn't see the exponent at the end. But back to the 'problem', converting time in decimals to sky color.[/QUOTE] yeah but if you round pi to something it will be slightly less than or slightly greater than pi, I imagine the difference from GMod 12 is due to LuaJIT, it's not a big deal, just round the result to 5 decimal places or something
[QUOTE=Drakehawke;38246984]I spent ages trying to find this yesterday [url]http://glua.me/bin/?path=/gamemodes/sandbox/gamemode/editor_player.lua[/url][/QUOTE] I suppose my question now is if anyone has gotten player colors to work on a dmodelpanel - I can't seem to get it to work even by using the exact code Garry does.
[QUOTE=jmazouri;38250094]I suppose my question now is if anyone has gotten player colors to work on a dmodelpanel - I can't seem to get it to work even by using the exact code Garry does.[/QUOTE] Don't think that's (easily) possible
[QUOTE=Drakehawke;38250126]Don't think that's (easily) possible[/QUOTE] Nevermind I'm dumb - I was getting models with LocalPlayer():GetModel() instead of the actual player models. Works fine with stuff in models/player/.
[QUOTE=jmazouri;38250227]Nevermind I'm dumb - I was getting models with LocalPlayer():GetModel() instead of the actual player models. Works fine with stuff in models/player/.[/QUOTE] LocalPlayer():GetModel should be the actual player model?
[QUOTE=Drakehawke;38250403]LocalPlayer():GetModel should be the actual player model?[/QUOTE] Works fine serverside, but it's really buggy clientside, it returns the npc version of the player model.
[QUOTE=Drakehawke;38250403]LocalPlayer():GetModel should be the actual player model?[/QUOTE] Nope, it returns weird values on the client
The debugoverlay library seems to be broken, I cant make it to work at all. ( On any platform ) I set developer to 1, and checked with 2 also. Or am I doing something wrong?
[CODE]function GAMEMODE:PlayerSpawn( ply ) ply:SetRenderMode( RENDERMODE_TRANSALPHA ) ply:SetColor(Color( 255, 255, 255, 0 )) ply:SetModel(Model("models/zombie/classic.mdl")) ply:SetSequence("slumprise_a") timer.Simple( 2, function() ply:SetSequence("Idle01") end ) end local dur = function(LocalPlayer) if LocalPlayer():KeyDown(IN_FORWARD) then LocalPlayer:SetSequence("walk") else LocalPlayer:SetSequence("walk") end end hook.Add("Think", "walkanim", dur)[/CODE] trying to use npc anims for player with setsequence O_e the first bit, just does not work! it defaults to using idle instead of using slumprise and then going to idle! and the second bit, absolutley SPAMS my console every FRAME with attempt to call local 'LocalPlayer'( a nil value ) HOW THE HELL IS LOCALPLAYER NIL :(
[QUOTE=RonanZer0;38250821]trying to use npc anims for player with setsequence O_e the first bit, just does not work! it defaults to using idle instead of using slumprise and then going to idle! and the second bit, absolutley SPAMS my console every FRAME with attempt to call local 'LocalPlayer'( a nil value ) HOW THE HELL IS LOCALPLAYER NIL :([/QUOTE] Are you running this code on the server or client side (or shared)?
Okay, lets clear up the code a little. A little identaiton there, a few parenthseses here and... See? Mutch better. [lua] local dur = function( LocalPlayer ) if ( LocalPlayer():KeyDown(IN_FORWARD) ) then LocalPlayer:SetSequence("walk") else LocalPlayer:SetSequence("walk") end end hook.Add("Think", "walkanim", dur) [/lua] You are having LocalPlayer as a function parameter. This means that if you try to call it, the passed parameter gets called instead of the global LocalPlayer function. Also, the Think hook has no arguments at all.
Another problem found, how can i change the brigness of the lighting in a map? I know light_environment does something but in my tests i couldn't get it to work.
[QUOTE=ollie;38251802]Another problem found, how can i change the brigness of the lighting in a map? I know light_environment does something but in my tests i couldn't get it to work.[/QUOTE] AFAIK you can only alter dynamic lighting, static lighting is generated when the map is compiled and saved in lightmaps within the BSP
[QUOTE=Drakehawke;38251836]AFAIK you can only alter dynamic lighting, static lighting is generated when the map is compiled and saved in lightmaps within the BSP[/QUOTE] So lets say for example gm_flatgrass, can i make it dark? e: i think i can edit a map and give it a light_environment, then just change the brightness with keyvalues.. will try that method
[QUOTE=ollie;38251900]So lets say for example gm_flatgrass, can i make it dark? e: i think i can edit a map and give it a light_environment, then just change the brightness with keyvalues.. will try that method[/QUOTE] The keyvalues from light_environment are used by vrad during the compile process, I don't think changing them does anything in-game. [editline]30th October 2012[/editline] As far as I know the only way to achieve it properly is to edit the map and replace all the static lights with dynamic ones (or even better named lights - they're still static but can be turned on/off, although this will nearly double the filesize of the map), but this isn't very nice on performance - think lighting an entire map with the light stool.
[QUOTE=Drakehawke;38252044]The keyvalues from light_environment are used by vrad during the compile process, I don't think changing them does anything in-game. [editline]30th October 2012[/editline] As far as I know the only way to achieve it properly is to edit the map and replace all the static lights with dynamic ones (or even better named lights - they're still static but can be turned on/off, although this will nearly double the filesize of the map), but this isn't very nice on performance - think lighting an entire map with the light stool.[/QUOTE] That doesn't sound very nice thing to do, eh. He managed to do it somehow: [url]http://www.youtube.com/watch?v=6gAx_CHGt6I[/url]
Can someone help me with my shipments? I put them where they are suppose to be. But when i get out the shipment and hit E and pickup the gun, it is in the left hand and does not shoot. I have CSS installed on my server.
[QUOTE=ollie;38252494]That doesn't sound very nice thing to do, eh. He managed to do it somehow: [url]http://www.youtube.com/watch?v=6gAx_CHGt6I[/url][/QUOTE] That's definitely dynamic, the shadows move, that isn't possible in Source with static lighting except on the CS:GO engine
You can run SetPattern on the light_environment to change the light levels roughly, but you cant modify the shadows cast by static props
What's the difference between DHTML and HTML classes in the GM13 changelog? [URL]http://wiki.garrysmod.com/page/Porting/GM12[/URL] How can we draw HTML panels in 3D? Is there an equivalent to GetHTMLMaterial?
[QUOTE=ollie;38251802]Another problem found, how can i change the brigness of the lighting in a map? I know light_environment does something but in my tests i couldn't get it to work.[/QUOTE] From my totally ignored bugreport: [lua]local light_environment; hook.Add("OnEntityCreated", "splaf", function(e) if (IsValid(e) and e:GetClass() == "light_environment") then e:SetKeyValue("targetname", "boink" .. e:EntIndex()); e:Fire("FadeToPattern", "b") light_environment = e end end) concommand.Add("lightpattern", function(_,_,args) light_environment:Fire("FadeToPattern", args[1]); end);[/lua] It tends to give you terrible results though. [thumb]http://i.imgur.com/Clqvv.jpg[/thumb] Incidentally, I'm still looking for a way to get brushes to re-adjust their lightlevels without flashing a dlight at them. Does anyone have some functional experience with this thing?
Is it possible for a server to override "html/js/creations/creationsapp.js" with the server's modified version? I want to limit players to only being able to download their own dupes but this means changing the clientside Javascript to remove it from the interface. Thanks.
You might have better luck through Lua [url]http://glua.me/bin/?path=/gamemodes/sandbox/gamemode/spawnmenu/CreationMenu/content[/url]
Sorry, you need to Log In to post a reply to this thread.