1. Post #201
    zzaacckk's Avatar
    June 2009
    2,095 Posts
    If you have to explain your variables like that it means you don't name them well. Try to use describing variable names for everything, even if it is pain to write ProximToBeamSrc every time you use it.
    Yea but writing out a variable 100 times if they are like isBeamDirected, isLookingAtBeam, getBlindedFromBeam.. can get really annoying.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 11Funny Funny x 1Late Late x 1Friendly Friendly x 1 (list)

  2. Post #202
    whitespace's Avatar
    November 2008
    869 Posts
    Yea but writing out a variable 100 times if they are like isBeamDirected, isLookingAtBeam, getBlindedFromBeam.. can get really annoying.
    Naming variables like that help you a lot in the long run since it makes your code easier to read.
    Reply With Quote Edit / Delete Windows XP Finland Show Events Agree Agree x 10Dumb Dumb x 1Friendly Friendly x 1 (list)

  3. Post #203
    likes men
    Python1320's Avatar
    May 2007
    1,730 Posts
    If you have to explain your variables like that it means you don't name them well. Try to use describing variable names for everything, even if it is pain to write ProximToBeamSrc every time you use it.
    Tidied that thing up a bit:

    local tab = {}
    
    tab[ "$pp_colour_addr" ] 		= 0
    tab[ "$pp_colour_addg" ] 		= 0
    tab[ "$pp_colour_addb" ] 		= 0
    tab[ "$pp_colour_brightness" ] 	= 0
    tab[ "$pp_colour_contrast" ] 	= 1
    tab[ "$pp_colour_colour" ] 		= 1
    tab[ "$pp_colour_mulr" ] 		= 0
    tab[ "$pp_colour_mulg" ] 		= 0
    tab[ "$pp_colour_mulb" ] 		= 0
    
    local function DrawFrac(f)
        if f==0 then return end
        tab[ "$pp_colour_brightness" ] 	= f
        tab[ "$pp_colour_contrast" ] 	= 1+f
    
        DrawColorModify( tab )
    
    end
    
    function CanSee_BeamSource(who,what)
    	local ObjWidth = 42 * 0.5 -- works well for the source too :v:
    	local fov = who:GetFOV() or 90
    	local Disp = what:GetPos() - who:EyePos()
    	local distance = Disp:Length()
    
    	local max = math.abs( math.cos( math.acos( distance / math.sqrt( distance * distance + ObjWidth * ObjWidth ) ) + fov * ( math.pi / 180 ) ) )
    	Disp:Normalize()
    	local val = Disp:Dot( who:EyeAngles():Forward() )
    	if val > max then
    		return val
    	end
    
    	return false
    
    end
    
    function CanSee_Beam(who,what,EyeAngles)
    	local ObjWidth =  42 * 0.5
    	local fov = 7
    	local Disp = what - who
    	local distance = Disp:Length()
    
    	local max = math.abs( math.cos( math.acos( distance / math.sqrt( distance * distance + ObjWidth * ObjWidth ) ) + fov * ( math.pi / 180 ) ) )
    	Disp:Normalize()
    	local val = Disp:Dot( EyeAngles:Forward() )
    
    	val=val>0 and val or -val
    	
    	max=max>0 and max or -max -- the beam is two ways
    	
    	return val-max
    
    end
    
    local function RenderScreenspaceEffects()
    	for _,e in pairs(ents.FindByClass("tower_beam")) do
    		
    		local fDistanceFar=e:GetPos():Distance(EyePos())
    		
    		local fDistanceNear=fDistanceFar
    		
    		-- Calculate the far fading fraction
    		fDistanceFar=fDistanceFar-4800 -- stop fading here units
    		fDistanceFar=fDistanceFar<0 and 0 or fDistanceFar 
    		fDistanceFar=fDistanceFar*(1/1000) -- falloff
    		
    		fDistanceFar=1-fDistanceFar
    		fDistanceFar=fDistanceFar<0 and 0 or fDistanceFar 
    		if fDistanceFar==0 then	continue end
    		
    		-- Calculate the near blinding fraction. 
    		fDistanceNear=-0.4+fDistanceNear/155 -- start blinding at 155 units and maximum blinding at 155*0.4
    		fDistanceNear=fDistanceNear>=1 and 1 or fDistanceNear <=0  and 0 or fDistanceNear
    		fDistanceNear=1-fDistanceNear
    
    		
    		local fPlyLookingAtLight=CanSee_BeamSource(LocalPlayer(),e)
    		
    		-- Can't get blinded by what you can't see. Used in all calculations.
    		if not fPlyLookingAtLight then continue end
    		
    		-- Grab beam's angle
    		local cang=e.cang
    		if not cang then continue end -- We need this angle.
    		
    		-- Calculate if player is in beam
    		fPlayerInBeam=CanSee_Beam(e:GetPos(),EyePos(),cang)
    		
    		local magic=55
    		
    		-- Blend it all together...
    		fPlayerInBeam=fPlayerInBeam*magic*fPlyLookingAtLight
    		
    			-- Make the beam's "beam" entity fade away
    			local blend=fPlayerInBeam
    			blend=blend<0 and 0 or blend
    			blend=blend+0.7
    			blend=(1-blend)
    			e.blend=(blend<0 and 0 or blend>1 and 1 or blend)*3
    			
    		-- ...and clamp
    		fPlayerInBeam=fPlayerInBeam*fDistanceFar
    		fPlayerInBeam=fPlayerInBeam>=1 and 1 or fPlayerInBeam <=0  and 0 or fPlayerInBeam
    		fPlayerInBeam=fPlayerInBeam+fDistanceNear*fPlyLookingAtLight
    		fPlayerInBeam=fPlayerInBeam>=1 and 1 or fPlayerInBeam <=0  and 0 or fPlayerInBeam
    		
    		-- Draw the final fraction blinding
    		DrawFrac(fPlayerInBeam) -- TODO: Take account daynight cycle 
    	end
    	
    	-- kill that shit
    	if RealTime()-tLastDraw>1 then
    		hook.Remove("RenderScreenspaceEffects","lighthouse")
    		started=false
    	end
    end
    
    StartHook=function()
    	if not started then
    		hook.Add("RenderScreenspaceEffects","lighthouse",RenderScreenspaceEffects)
    		started=true
    	else
    		tLastDraw=RealTime()
    	end
    end
    Looks even more horrible. The problem is in the coder, but the code works so screw it. I'll go do something more or less productive.
    Reply With Quote Edit / Delete Windows 7 Finland Show Events Agree Agree x 1Friendly Friendly x 1 (list)

  4. Post #204
    Wondering how feasible it would be to send Lua files in string tables - instead of using the dua file. Max size of a data entry is 16,384 bytes - but I could increase that.

    It'd have the advantage that when running a .dem file you'll have all the same client lua files as the person that recorded it.
    Reply With Quote Edit / Delete Windows 7 Show Events Disagree x 8Agree x 3Winner x 2Artistic x 1Dumb x 1Useful x 1Friendly x 1 (list)

  5. Post #205
    dylanb5123's Avatar
    January 2011
    212 Posts
    Wondering how feasible it would be to send Lua files in string tables - instead of using the dua file. Max size of a data entry is 16,384 bytes - but I could increase that.
    It'd have the advantage that when running a .dem file you'll have all the same client lua files as the person that recorded it.
    That would be majestic.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 3Agree Agree x 3Friendly Friendly x 1 (list)

  6. Post #206
    likes men
    Python1320's Avatar
    May 2007
    1,730 Posts
    Wondering how feasible it would be to send Lua files in string tables - instead of using the dua file. Max size of a data entry is 16,384 bytes - but I could increase that.

    It'd have the advantage that when running a .dem file you'll have all the same client lua files as the person that recorded it.
    Code:
    39b5e2ca05701dc8fbb0e3f1f3811944.dua  1.5M  8.5.2012
    3970c31124108ecf278ab13415b1be1b.dua  1.5M  12.5.2012
    27360bb82ea68ff9ae193943985f72ca.dua  1.5M  13.5.2012
    bc6c7e2416f7a99b23493f0c0c616c77.dua  1.5M  15.5.2012
    0236bbe6d832526d780ddfdd1acea280.dua  1.5M  17.5.2012
    15dcb9020508261cdc0947e7f349a658.dua  1.5M  17.5.2012
    45b60070bbc814d92794f1549e067b8a.dua  1.5M  17.5.2012
    506c15d7d36677414a9d35fc9716312e.dua  1.5M  17.5.2012
    I don't think downloading 1500 KiB every time I join a server just to have lua in demos working is worth the tradeoff but who knows. Can't you embed the dua cache in demos somehow and load that or just tell people to upload cache and demo and make the demos load the cache?
    Reply With Quote Edit / Delete Windows 7 Finland Show Events Agree Agree x 3Friendly Friendly x 1 (list)

  7. Post #207
    Yeah it would suck - but just don't join servers with so much Lua going going on.
    Reply With Quote Edit / Delete Windows 7 Show Events Funny x 9Dumb x 4Disagree x 2Winner x 1Optimistic x 1Friendly x 1 (list)

  8. Post #208
    likes men
    Python1320's Avatar
    May 2007
    1,730 Posts
    Yeah it would suck - but just don't join servers with so much Lua going going on.
    9MB of clientside lua (unpacked) is too much? :(
    Reply With Quote Edit / Delete Windows 7 Finland Show Events Agree Agree x 1Friendly Friendly x 1Disagree Disagree x 1 (list)

  9. Post #209
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    4,717 Posts
    Wondering how feasible it would be to send Lua files in string tables - instead of using the dua file. Max size of a data entry is 16,384 bytes - but I could increase that.

    It'd have the advantage that when running a .dem file you'll have all the same client lua files as the person that recorded it.
    I have private clientside scripts. If I were to record a demo with these scripts and publish it. Would people be able to extract the scripts from that demo?
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree Agree x 1Optimistic Optimistic x 1Friendly Friendly x 1 (list)

  10. Post #210
    Megolas's Avatar
    August 2011
    101 Posts
    you publish a webm file, not the demo itself, i guess...
    Reply With Quote Edit / Delete Windows 7 Israel Show Events Agree Agree x 2 (list)

  11. Post #211
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    4,717 Posts
    you publish a webm file, not the demo itself, i guess...
    Of course rendering it to an actual video file loses the scripts. But that's not what I'm asking. My question is:
    Are my installed private scripts in every demo that I record?
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Friendly Friendly x 1 (list)

  12. Post #212
    whitespace's Avatar
    November 2008
    869 Posts
    What private info would you have in your scripts that can't be shared? You could read passwords etc from a file that wouldn't be shared with the demo.

    If you're worrying about your amazing clientside scripts getting stolen then you're as dumb as Conna.
    Reply With Quote Edit / Delete Windows XP Finland Show Events Dumb Dumb x 11Friendly Friendly x 1 (list)

  13. Post #213
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    5,275 Posts
    Wondering how feasible it would be to send Lua files in string tables - instead of using the dua file. Max size of a data entry is 16,384 bytes - but I could increase that.

    It'd have the advantage that when running a .dem file you'll have all the same client lua files as the person that recorded it.
    I'd rather download a dua file
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 11Disagree Disagree x 1Friendly Friendly x 1 (list)

  14. Post #214
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    4,717 Posts
    If you're worrying about your amazing clientside scripts getting stolen then you're as dumb as Conna.
    What kind of bullshit is that?

    Look
    All I want to know is whether my clientside scripts are in the demo file and whether they can be extracted.

    As an answer to this question, I would expect a boolean answer, optionally with a god damn explanation.
    Have an example of an answer that answers my question:
    "Yes, because ..."

    Have another one to really make my point clear:
    "No, because ..."
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Friendly Friendly x 1 (list)

  15. Post #215
    Of course rendering it to an actual video file loses the scripts. But that's not what I'm asking. My question is:
    Are my installed private scripts in every demo that I record?
    Yes
    Reply With Quote Edit / Delete Windows 7 Show Events Informative Informative x 6Friendly Friendly x 3Dumb Dumb x 2 (list)

  16. Post #216
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    4,717 Posts
    Thank you.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Friendly Friendly x 6Disagree Disagree x 2 (list)

  17. Post #217
    my portfolio
    Matt-'s Avatar
    April 2012
    1,378 Posts
    Worse experience for 99% of users to benefit less than 1% who actually use demos. Y'know.. Whatever you want Garry.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 14Optimistic Optimistic x 2Dumb Dumb x 1Friendly Friendly x 1 (list)

  18. Post #218
    T3hGamerDK's Avatar
    January 2011
    2,551 Posts
    Having scripts saved in the demo would actually be pretty cool too. You could optionally check for scripts that aren't called for, and exclude those, decreasing the loading times and file size too.

    Worse experience for 99% of users to benefit less than 1% who actually use demos. Y'know.. Whatever you want Garry.
    How so?
    Reply With Quote Edit / Delete Windows Vista Denmark Show Events Disagree Disagree x 1Friendly Friendly x 1 (list)

  19. Post #219
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    4,717 Posts
    Having scripts saved in the demo would actually be pretty cool too. You could optionally check for scripts that aren't called for, and exclude those, decreasing the loading times and file size too.
    In general it would be. It's just in my specific case that I have to be careful with what I record. I support this way of handling demo's.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Disagree Disagree x 1Friendly Friendly x 1 (list)

  20. Post #220
    my portfolio
    Matt-'s Avatar
    April 2012
    1,378 Posts
    I don't think downloading 1500 KiB every time I join a server just to have lua in demos working is worth the tradeoff but who knows. Can't you embed the dua cache in demos somehow and load that or just tell people to upload cache and demo and make the demos load the cache?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Friendly Friendly x 1 (list)

  21. Post #221
    Gold Member
    Alex_grist's Avatar
    January 2007
    1,002 Posts
    Does anyone know what sets the gm:foldername in the server tags?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Friendly Friendly x 1 (list)

  22. Post #222
    Flora KEidran's Avatar
    May 2012
    63 Posts
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Winner Winner x 12Artistic Artistic x 4Dumb Dumb x 3Friendly Friendly x 1 (list)

  23. Post #223
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    4,717 Posts
    I remember helping you and your brother with making SWEPs back in 2009. It's funny to see how you still make SWEPs. You're one of the very few to still make this many SWEPs. I hope, though, that your code is somewhat neater than those ZSwords you made a while ago. It's easier for yourself to read if you indent properly.

    I can't complain, though, I've been on DarkRP since 2008.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Informative Informative x 1Funny Funny x 1Friendly Friendly x 1 (list)

  24. Post #224
    werewolf0020's Avatar
    October 2009
    4,279 Posts
    now i shall wonder how people make that nice view model moving bob in sweps for the eternity
    Reply With Quote Edit / Delete Windows 8 Venezuela Show Events Friendly Friendly x 1 (list)

  25. Post #225
    Kamshak's Avatar
    July 2008
    314 Posts
    in gm13 what do you use instead of info.txt?
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Friendly Friendly x 1 (list)

  26. Post #226
    triscuit6264's Avatar
    January 2009
    137 Posts
    in gm13 what do you use instead of info.txt?
    http://wiki.garrysmod.com/page/Gamemode_Creation
    Reply With Quote Edit / Delete Windows 7 United States Show Events Useful Useful x 1Friendly Friendly x 1 (list)

  27. Post #227
    I love you Danny <3
    Chessnut's Avatar
    August 2011
    2,690 Posts

    Got bored and recreated Simon!
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner Winner x 4Funny Funny x 1Friendly Friendly x 1Disagree Disagree x 1 (list)

  28. Post #228
    Donkie's Avatar
    July 2009
    1,034 Posts

    Got bored and recreated Simon!
    Cool!
    But shouldn't it do the same sequence again if you completed it, but add another onto it?
    Reply With Quote Edit / Delete Windows Vista Sweden Show Events Agree Agree x 17Disagree Disagree x 2Friendly Friendly x 1 (list)

  29. Post #229
    Flora KEidran's Avatar
    May 2012
    63 Posts
    I remember helping you and your brother with making SWEPs back in 2009. It's funny to see how you still make SWEPs. You're one of the very few to still make this many SWEPs. I hope, though, that your code is somewhat neater than those ZSwords you made a while ago. It's easier for yourself to read if you indent properly.

    I can't complain, though, I've been on DarkRP since 2008.
    "This Many Sweps", You make it sound like its all been done before, The media i have shown may be of weapons but i can safely say "Sweps" is something i rarely do now.

    Then again, I'm sure your just trying to keep at me for all these years you've wasted.

    Anyway, I'll stop derailing now.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Zing Zing x 2Dumb Dumb x 1Funny Funny x 1Friendly Friendly x 1 (list)

  30. Post #230

    May 2012
    2 Posts
    zombie escape looks epic.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 4Useful Useful x 1Dumb Dumb x 1Friendly Friendly x 1 (list)

  31. Post #231
    ash47's Avatar
    March 2010
    570 Posts
    Wouldn't you also need the server side files for the demos to work properly then?
    Reply With Quote Edit / Delete Windows 7 Australia Show Events Disagree Disagree x 1Agree Agree x 1Friendly Friendly x 1 (list)

  32. Post #232
    Gold Member
    Mr. Quiggles's Avatar
    July 2010
    179 Posts
    Raaaaiiiiiinnnnnn.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 1Friendly Friendly x 1 (list)

  33. Post #233
    I love you Danny <3
    Chessnut's Avatar
    August 2011
    2,690 Posts
    I think you need to avoid WeatherModv7.
    Reply With Quote Edit / Delete United States Show Events Informative Informative x 1Agree Agree x 1Friendly Friendly x 1 (list)

  34. Post #234
    Gold Member
    Mr. Quiggles's Avatar
    July 2010
    179 Posts
    I think you need to avoid WeatherModv7.
    The one time I try to be descriptive by giving just a picture and a word instead of my usual paragraphs of confusion, Snape, once again, says it's not the desired effect. I was aiming towards "I just got rain and actual day/night for my addon".

    Yes, I did use WeatherMod as a reference, but no, not a complete copy-pasta of it. No offense to the original coder, but... it's unorganized and my OCD is killing me.

    There's too much fat in there, like a table for when it's dark and raining, when it's raining, when it's storming, cloudy, etc. etc. There's a lot of unnecessary tables that are never called, but it did give me a good idea on which direction to head for it.

    tl;dr It's not WeatherMod.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Friendly Friendly x 1Informative Informative x 1 (list)

  35. Post #235
    My Blog
    Spencer Sharkey's Avatar
    July 2009
    1,902 Posts








    Yeah. There was lots of fun.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua King Lua King x 11Winner Winner x 2Friendly Friendly x 1 (list)

  36. Post #236
    We Are No Idiots
    Aide's Avatar
    March 2010
    3,230 Posts


    Working on effects for deathrun. Nothing special. Following are place holders until I make my own models. I do rather like the medic one though. Excuse the quality as my gpu fan died and I'm awaiting approval from XFX for RMA. Oh and these are placed with a stool so it is easy to place teleporters, cash collection caps, and health.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1Artistic Artistic x 1Friendly Friendly x 1 (list)

  37. Post #237
    Flora KEidran's Avatar
    May 2012
    63 Posts

    Ranged combat weeeeeeee
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Lua King x 11Artistic x 6Winner x 5Dumb x 1Friendly x 1 (list)

  38. Post #238
    Hentie's Avatar
    May 2010
    1,843 Posts
    Working on some costumes/new models for my gamemode.
    I made the leather jacket model, but since I also made the costume script, I thought you'd might like it as well.




    btw I'm getting help on modelling and you can check out my progress over at the models wip/pimpage thread, so that's not the final model.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Artistic Artistic x 6Friendly Friendly x 1 (list)

  39. Post #239
    Flora KEidran's Avatar
    May 2012
    63 Posts
    Working on some costumes/new models for my gamemode.
    I made the leather jacket model, but since I also made the costume script, I thought you'd might like it as well.

    /awesomeleatherjacketstuffhere

    btw I'm getting help on modelling and you can check out my progress over at the models wip/pimpage thread, so that's not the final model.
    That's Awesome, It's hard to tell, But is the jacket Ripped and Torn a little? Or is that just model clipping?

    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Lua King Lua King x 6Dumb Dumb x 4Winner Winner x 3Friendly Friendly x 1 (list)

  40. Post #240
    I love Lemon Punch
    Sakarias88's Avatar
    January 2006
    1,211 Posts
    Wanted to do a batman cape or something similar.
    So I tried to implement some cloth physics.
    It works surprisingly well and lags a lot less than I expected.


    You can set some parameters for it such as elasticity, air friction and gravity but they are kind of sensitive.
    One decimal too much and it will spazz all over the place.
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Winner Winner x 14Lua King Lua King x 13 (list)