• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=PortalGod;47382838]also, you're still sending a table?[/QUOTE] Yeah I'm getting rid of it one instance at a time. Oh, I used WriteVector instead of read... Woooww. That fixes everything
I need help with include/files again In the name of organization, I split up 1 file of 1500 lines of code into several files with less than 500 lines of code, but I'm having problems with variables. this file is called cl_limb_core.lua [code]include("cl_limb_suit.lua") include("cl_limb_disables.lua") include("cl_limb_networking.lua") include("cl_limb_draw.lua") include("cl_limb_movement.lua") local Activity local Bleeding local Blood local Clog local HeartRate local HeadHealth local TorsoHealth local LeftArmHealth local RightArmHealth local LeftLegHealth local RightLegHealth local FleshHealthTable[/code] Idk what I'm doing, but what I expected is that this file act as a relay for variables so it can all communicate with each other. What should I be doing?
the way I would do it is [code] limb = {} include("cl_limb_suit.lua") --able to reference the limb table include("cl_limb_disables.lua") --able to reference the limb table plus any modifications from suit.lua include("cl_limb_networking.lua") --etc include("cl_limb_draw.lua") include("cl_limb_movement.lua") --limb now has all the stuff from all the files [/code]
[QUOTE=PortalGod;47383010]the way I would do it is [code] limb = {} include("cl_limb_suit.lua") --able to reference the limb table include("cl_limb_disables.lua") --able to reference the limb table plus any modifications from suit.lua include("cl_limb_networking.lua") --etc include("cl_limb_draw.lua") include("cl_limb_movement.lua") --limb now has all the stuff from all the files [/code][/QUOTE] Agreed, however keep in mind that if say cl_limb_suit.lua uses things from the limb table that cl_limb_movement.lua adds, then cl_limb_suit.lua needs to be included [b]after[/b] cl_limb_movement.lua.
Is it possible to render something (E.g, the users avatar or some text) to a Material and then draw it on things later?
Yes, use a render target, then create a material from that. You can render anything you want to the render target.
How can I get my traces to go through (filter) worldspawn? I don't want them hitting the map. I tried this: [CODE]filter = game.GetWorld()[/CODE] Doesn't seem to work.
Set [URL="http://wiki.garrysmod.com/page/Structures/Trace"]trace.ignoreworld[/URL] to true
[QUOTE=Jvs;47385407]Set [URL="http://wiki.garrysmod.com/page/Structures/Trace"]trace.ignoreworld[/URL] to true[/QUOTE] Don't know how I missed that, thanks.
Does anyone know how to import the aimlayer animations of the player in Blender? I'm trying to see how the aimlayer/holdtype animations are setup for the SMG, and whenever I try importing them into Blender there doesn't seem to BE an animation. Each animation for each aimlayer direction, such as a_aimlayer_smg_mid_left.smd is only 5 KB. And as I said before, doesn't seem to contain any animation data. *That Blender can read* I know that the animations were edited around two years ago I believe, right around when the workshop was added. But I'm unsure how they even opened these for editing.
Hey, so I don't really get SQL. I was working on an achievement system and started setting up .txt file saving as an alternative (and because i wanted to put off doing the scary). This is what I wrote up so far, and it sort of works - like it'll only save the last achievement in the table instead of all of them. How would I get around this, and should i potentially just scrap txt file saving and use SetPData instead? [code] hook.Add("PlayerSpawn", "ACH_Disconnect_Save", function(ply) for k, v in pairs(Achievements.AchTable) do local Data_Tbl = {} Data_Tbl[k] = { v.IDName, v.CurrentInt } local tabletosave = util.TableToJSON(Data_Tbl) if Achievements.UseSQL then //dunno lol else file.Write("achievement_directory/"..ply:GetFileFriendlySteam()..".txt", tabletosave) end end end) [/code]
[QUOTE=NiandraLades;47385978]Hey, so I don't really get SQL. I was working on an achievement system and started setting up .txt file saving as an alternative (and because i wanted to put off doing the scary). This is what I wrote up so far, and it sort of works - like it'll only save the last achievement in the table instead of all of them. How would I get around this, and should i potentially just scrap txt file saving and use SetPData instead? [code] hook.Add("PlayerSpawn", "ACH_Disconnect_Save", function(ply) for k, v in pairs(Achievements.AchTable) do local Data_Tbl = {} Data_Tbl[k] = { v.IDName, v.CurrentInt } local tabletosave = util.TableToJSON(Data_Tbl) if Achievements.UseSQL then //dunno lol else file.Write("achievement_directory/"..ply:GetFileFriendlySteam()..".txt", tabletosave) end end end) [/code][/QUOTE] You've got local inside the loop; you're re-initializing the table every time, so that's the only table you're saving. (You're also saving for every achievement, egads) Try this: [lua] hook.Add("PlayerSpawn", "ACH_Disconnect_Save", function(ply) local Data_Tbl = {} for k, v in pairs(Achievements.AchTable) do Data_Tbl[k] = { v.IDName, v.CurrentInt } end local tabletosave = util.TableToJSON(Data_Tbl) if Achievements.UseSQL then //dunno lol else file.Write("achievement_directory/"..ply:GetFileFriendlySteam()..".txt", tabletosave) end end) [/lua]
How do I change the player's clothes color? Like in the context menu in sandbox.
[QUOTE=RedNinja;47386064]How do I change the player's clothes color? Like in the context menu in sandbox.[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SetPlayerColor]Player:SetPlayerColor[/url]
Don't use json if you're going to use a database, that's like like buying a car and pushing it to get around. Create a table (or tables) in your database and separate your data so it can be picked out precisely how you want it. If you're going to use a database, you might as well take advantage of its strengths.
What is the easiest way of finding ACT_ enums and corresponding animations for use with the Nextbot StartActivity function? I've been developing Nextbot NPCs for a while now and I've been having trouble finding certain attack / cast animations. Any ideas on how to do do this effiently? Are there any addons that list usable animations / sequences?
[QUOTE=_nonSENSE;47387912]What is the easiest way of finding ACT_ enums and corresponding animations for use with the Nextbot StartActivity function? I've been developing Nextbot NPCs for a while now and I've been having trouble finding certain attack / cast animations. Any ideas on how to do do this effiently? Are there any addons that list usable animations / sequences?[/QUOTE] I like doing PrintTable(ent:GetSequenceList()) and then testing nice sounding sequences. How does file.Find("xyz/", "LUA") work with gamemodes? Wiki says it searches from gamemodes, but it doesn't find for example gamemodes/mynicegamemode/gamemode/xyz/file.lua. Am I supposed to put the file.lua inside mynicegamemode/lua/xyz/ or what?
Is there anyway to make some text be aligned like to the left right or center using surface Would it be like? [QUOTE]surface.SetAlignment( "Right" )[/QUOTE]
[QUOTE=CreeperMoon2;47388702]Is there anyway to make some text be aligned like to the left right or center using surface Would it be like?[/QUOTE] Either use draw.SimpleText which allows this, or do it by manually calculating proper position.
I am coding a mysql module for gmod, unfortunately I can't get my linux server to use it, everytime I load it up it just gives me the useless "Couldn't load module" error message that doesn't tell me any reason. I got the libmysqlclient library in the correct place (the srcds directory) and even ldd tells me it can find all shared libraries: [IMG]http://puu.sh/gOjIs/bd3e1bf7c9.png[/IMG] What could be the cause of the loading error?
[QUOTE=syl0r;47389207]I am coding a mysql module for gmod, unfortunately I can't get my linux server to use it, everytime I load it up it just gives me the useless "Couldn't load module" error message that doesn't tell me any reason. I got the libmysqlclient library in the correct place (the srcds directory) and even ldd tells me it can find all shared libraries: [IMG]http://puu.sh/gOjIs/bd3e1bf7c9.png[/IMG] What could be the cause of the loading error?[/QUOTE] The same error will occur if the gmod13_open/gmod13_close procedures can't be found (maybe only the former).
[QUOTE=Willox;47389379]The same error will occur if the gmod13_open/gmod13_close procedures can't be found (maybe only the former).[/QUOTE] Apparently something was wrong in the srcds/bin directory, I have deleted it and redownloaded the files and now it works. I have no clue why that happened since mysqloo 8.1 loaded just fine without any problems.
Anyone know how to increase the quality of a renderview? This looks really low-res: [t]http://cloud-4.steamusercontent.com/ugc/530637206224014940/F3DDF648B3BB014625198AAF3E44B36928210F69/[/t] [code]function SWEP:DrawHUD() local tex_white = surface.GetTextureID( "vgui/white" ) local oldRT = render.GetRenderTarget( ) local rt = GetRenderTarget( "scopeRT", ScrW( ), ScrH( ) ) local rtMat = CreateMaterial( "scopeRTMat", "UnlitGeneric", { ["$basetexture"] = "scopeRT" render.SetRenderTarget( rt ) render.SetViewPort( 0, 0, ScrW( ), ScrH( ) ) render.Clear( 0, 0, 0, 255 ) local CamData = {} CamData.angles = LocalPlayer( ):EyeAngles( ) CamData.origin = LocalPlayer( ):EyePos( ) CamData.x = 0 CamData.y = 0 CamData.w = ScrH( ) / 3 CamData.h = ScrH( ) / 3 CamData.fov = 90 - 60 * math.Clamp( ( CurTime( ) - self.DATA.ModeSwitchTime ) * 6, 0, 1 ) CamData.drawhud = false CamData.drawviewmodel = false CamData.dopostprocess = false render.RenderView( CamData ) render.SetRenderTarget( oldRT ) render.SetViewPort( 0, 0, ScrW( ), ScrH( ) ) render.SetStencilEnable( true ) render.SetStencilReferenceValue( 1 ) render.SetStencilWriteMask( 1 ) render.SetStencilTestMask( 1 ) render.SetStencilPassOperation( STENCIL_REPLACE ) render.SetStencilFailOperation( STENCIL_KEEP ) render.SetStencilZFailOperation( STENCIL_KEEP ) render.SetStencilCompareFunction( STENCIL_NOTEQUAL ) surface.SetTexture( tex_white ) surface.SetDrawColor( 255, 255, 255, 255 * math.Clamp( ( CurTime( ) - self.DATA.ModeSwitchTime ) / 2, 0, 1 ) ) surface.DrawPoly( self.inner_vertices ) render.SetStencilCompareFunction( STENCIL_EQUAL ) surface.SetDrawColor( 255, 255, 255, 255 * math.Clamp( ( CurTime( ) - self.DATA.ModeSwitchTime ) / 2, 0, 1 ) ) surface.SetMaterial( rtMat ) surface.DrawTexturedRect( ScrW( ) / 2 - ScrH( ) / 2, 0, ScrH( ), ScrH( ) ) render.SetStencilCompareFunction( STENCIL_NOTEQUAL ) surface.SetDrawColor( Color( 255, 255, 255, 255 * math.Clamp( ( CurTime( ) - self.DATA.ModeSwitchTime ) / 2, 0, 1 ) ) ) surface.DrawPoly( self.inner_vertices ) render.ClearStencil() render.SetStencilEnable( false ) end end[/code]
wauterboi, try changing the resolution of the RT up to 1024x1024 from ScrW()/3, and then downsampling if need be.
[QUOTE=wauterboi;47391749]Anyone know how to increase the quality of a renderview? This looks really low-res: [t]http://cloud-4.steamusercontent.com/ugc/530637206224014940/F3DDF648B3BB014625198AAF3E44B36928210F69/[/t] *code*[/QUOTE] Have you tried the simple way of using a bigger render target texture and then scaling down the actual scope?
[QUOTE=Wyozi;47388534]I like doing PrintTable(ent:GetSequenceList()) and then testing nice sounding sequences. How does file.Find("xyz/", "LUA") work with gamemodes? Wiki says it searches from gamemodes, but it doesn't find for example gamemodes/mynicegamemode/gamemode/xyz/file.lua. Am I supposed to put the file.lua inside mynicegamemode/lua/xyz/ or what?[/QUOTE] file.Find starts at the base (or wherever you told it to start, e.g. "LUA", etc.) and uses a glob you give it to try and match files. file.Find( "xyz/" ) will never match anything, because it's looking for anything with no name inside the directory "xyz/". If you want to find all files, use "xyz/*". If you want to find all Lua files, use "xyz/*.lua". If you want to find all Lua files in "gamemodes/mynicegamemode/gamemode/xyz", use "mynicegamemode/gamemode/xyz/*.lua". (If you want to do it recursively, like matching "xyz" anywhere in your gamemode, the second argument returned from file.Find is all matching directories, so iterate over it and recursively search for the file)
Is there any reason why (if so, how do i fix it) that DModelPanels disappear when they hit negative pixels? I'm trying to draw playermodels running across the screen, and it's rather ugly when they *POP* into existance at pos 0, and work fine at ScrW/H()+ [vid]http://ph129.net/i/hpitvZ.mp4[/vid] [URL="https://github.com/garrynewman/garrysmod/blob/bdea6ff6c7c0af0fa468c44e645f05c632a02342/garrysmod/lua/vgui/dmodelpanel.lua#L129"]See Here[/URL] Furthest I've got is that somehow, cam.Start3D can't render at below 0 pixels? Am I wrong?
How can I stop the HL2 looping wav files? I use sound.Play
so yo, how do i stop the model in a DModelPanel from overlapping over panels? [img_thumb]http://puu.sh/gPwEm.jpghttp://puu.sh/gPwEm.jpg[/img_thumb] [code] self.model = self.playerinfo:Add( "DModelPanel" ) self.model:Dock( LEFT ) self.model:SetWide( self.playerinfo:GetWide( ) * 0.25 ) self.model:SetFOV(75) self.model.OnCursorEntered = function() end self.model:SetDisabled(true) self.model:SetCursor("none") self.model:SetModel( LocalPlayer( ):GetModel( ) ) self.model.LayoutEntity = function(panel, entity) if (!IsValid(nut.gui.menu)) then panel:Remove() return end local xRatio = gui.MouseX() / ( ScrW() * 0.25 ) local yRatio = gui.MouseY() / ScrH() entity:SetPoseParameter("head_pitch", yRatio*60 - 30) entity:SetPoseParameter("head_yaw", (xRatio - 0.75)*60) entity:SetAngles(MODEL_ANGLE) panel:RunAnimation() end [/code]
[QUOTE=a-cookie;47395360]so yo, how do i stop the model in a DModelPanel from overlapping over panels? [img_thumb]http://puu.sh/gPwEm.jpghttp://puu.sh/gPwEm.jpg[/img_thumb] [code] self.model = self.playerinfo:Add( "DModelPanel" ) self.model:Dock( LEFT ) self.model:SetWide( self.playerinfo:GetWide( ) * 0.25 ) self.model:SetFOV(75) self.model.OnCursorEntered = function() end self.model:SetDisabled(true) self.model:SetCursor("none") self.model:SetModel( LocalPlayer( ):GetModel( ) ) self.model.LayoutEntity = function(panel, entity) if (!IsValid(nut.gui.menu)) then panel:Remove() return end local xRatio = gui.MouseX() / ( ScrW() * 0.25 ) local yRatio = gui.MouseY() / ScrH() entity:SetPoseParameter("head_pitch", yRatio*60 - 30) entity:SetPoseParameter("head_yaw", (xRatio - 0.75)*60) entity:SetAngles(MODEL_ANGLE) panel:RunAnimation() end [/code][/QUOTE] Try SetDrawOnTop(true) on the panels you don't want it overlapping.
Sorry, you need to Log In to post a reply to this thread.