• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=ForrestMarkX;48092109]The system this is in is the Hammer for Zombie Survival I want to say have the hammer be able to nail a prop that is behind a ragdoll to the ground[/QUOTE] Didn't realize you wanted to get what was behind it.
[QUOTE=101kl;48092131]Didn't realize you wanted to get what was behind it.[/QUOTE] Ahh sorry I should've been clearer
[QUOTE=ForrestMarkX;48090873]Is there any possible way to make TraceLine ignore ragdolls that are collide-able? Having a problem where using TraceLine gets a ragdoll and screws up a few checks currently could make it ignore any Entity that is prop_ragdoll but I'd also have to make it find what's behind the ragdoll Edit: Totally forgot about using filter but I'm unsure if this would work [code] local filter = function(ent) if ent:GetClass() == "prop_ragdoll" then return false else return owner:GetMeleeFilter() end end local tr = owner:TraceLine(64, MASK_SOLID, filter)[/code][/QUOTE] This would not work. I don't see a function on the wiki named 'TraceLine' that works with players, so I would recommend using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/TraceLine]util.TraceLine[/url]. The explanation for how to accomplish what you'd like is written there.
[QUOTE=Z0mb1n3;48092496]This would not work. I don't see a function on the wiki named 'TraceLine' that works with players, so I would recommend using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/TraceLine]util.TraceLine[/url]. The explanation for how to accomplish what you'd like is written there.[/QUOTE] Traceline for players is added by ZombieSurvival and basically calls util.TraceLine with a few edits and unfortunately I can not find a way to do this via a function since a table is required due to the way it was coded
[QUOTE=Busan1;48091113]How can I redesign [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dlistview.lua"]DListView[/URL] and it's [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dlistview_column.lua"]DListView_Column[/URL] in a good way? I tried to make my own panel, based on DListView_Column, then overwrite the DListView AddColumn function to add my own DListView_Column, and tried to use Paint in my DListView_Column panel, but it did absolutely nothing.[/QUOTE] I copied and pasted the panels in the new vgui elements, removed the derma paint hook and added my own. Here's the one I did for line: [lua] for k,v in pairs( self.Columns ) do if k % 2 == 1 then //if k == 0 then if not self:IsHovered() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 41, 44, 49 ) ) else draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 59 ) ) end if self:IsLineSelected() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 81, 84, 89 ) ) end //else // draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 255 ) ) //end else //if k == 0 then if not self:IsHovered() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 59 ) ) else draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 61, 64, 69 ) ) end if self:IsLineSelected() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 81, 84, 89 ) ) end //else // draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 255 ) ) //end end curWide = curWide + v:GetWide() end [/lua]
[QUOTE=meharryp;48092883]I copied and pasted the panels in the new vgui elements, removed the derma paint hook and added my own. Here's the one I did for line: [lua] for k,v in pairs( self.Columns ) do if k % 2 == 1 then //if k == 0 then if not self:IsHovered() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 41, 44, 49 ) ) else draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 59 ) ) end if self:IsLineSelected() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 81, 84, 89 ) ) end //else // draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 255 ) ) //end else //if k == 0 then if not self:IsHovered() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 59 ) ) else draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 61, 64, 69 ) ) end if self:IsLineSelected() then draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 81, 84, 89 ) ) end //else // draw.RoundedBox( 0, curWide + 2, 2, v:GetWide(), h - 3, Color( 51, 54, 255 ) ) //end end curWide = curWide + v:GetWide() end [/lua][/QUOTE] Thank you very muc :)
Trying to draw the player's name above his head, although from a different perspective. The problem is the font is waaay too blurry. Take a look for yourself: [URL="http://images.akamai.steamusercontent.com/ugc/447329487736627037/DD2A2E2BA3423B9969B0E4F708B45E1DD298ABF2/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside|1024:576&composite-to=*,*|1024:576&background-color=black"]http://images.akamai.steamusercontent.com/ugc/447329487736627037/DD2A2E2BA3423B9969B0E4F708B45E1DD298ABF2/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside|1024:576&composite-to=*,*|1024:576&background-color=black[/URL] [CODE] surface.CreateFont( "ff", { font = "Arial", size = 10, weight = 500, antialias = true } ) function GM:PreDrawTranslucentRenderables() cam.Start3D2D(ply:GetPos() + Vector(0,0,50), Angle(0,270,0), 1) surface.SetFont("ff") surface.SetTextColor(255,255,255,255) surface.SetTextPos(-15, -30) surface.DrawText(ply:GetName()) cam.End3D2D() end [/CODE] And since nothing worked well I just copied the font from the wiki, and I tried all methods for drawing text.
make the cam scale lower and the font scale higher
[QUOTE=PortalGod;48094612]make the cam scale lower and the font scale higher[/QUOTE] Thanks, I can't believe how dumb I am.
Any idea why my dmodelpanel stays empty no matter what model i put in? [lua] local smlpnl = vgui.Create( "DPanel",dPanel ) smlpnl:SetPos( ScrH()/2-390,ScrW()/2-450 ) smlpnl:SetSize( 300, 200 ) smlpnl:SetVisible( true ) smlpnl:MakePopup() function smlpnl:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 52, 73, 94 ) ) end local icon = vgui.Create( "DModelPanel", smlpnl ) icon:SetPos( ScrH()/2-200,ScrW()/2-400 ) icon:SetModel( "models/props_c17/oildrum001.mdl" ) icon:Dock(FILL) [/lua]
[QUOTE=RedNinja;48097311]Any idea why my dmodelpanel stays empty no matter what model i put in? [lua] local smlpnl = vgui.Create( "DPanel",dPanel ) smlpnl:SetPos( ScrH()/2-390,ScrW()/2-450 ) smlpnl:SetSize( 300, 200 ) smlpnl:SetVisible( true ) smlpnl:MakePopup() function smlpnl:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 52, 73, 94 ) ) end local icon = vgui.Create( "DModelPanel", smlpnl ) icon:SetPos( ScrH()/2-200,ScrW()/2-400 ) icon:SetModel( "models/props_c17/oildrum001.mdl" ) icon:Dock(FILL) [/lua][/QUOTE] Your paint function looks off, for one. It should be [code]smlpnl.Paint = function(panel, w, h) draw.RoundedBox( 0, 0, 0, w, h, Color( 52, 73, 94 ) ) end[/code] or at least that's how I do it and it works nicely.
[QUOTE=Z0mb1n3;48097386]Your paint function looks off, for one. It should be [code]smlpnl.Paint = function(panel, w, h) draw.RoundedBox( 0, 0, 0, w, h, Color( 52, 73, 94 ) ) end[/code] or at least that's how I do it and it works nicely.[/QUOTE] Both methods work, neither is more right or wrong. The problem is that he is overriding the paint function, the function that displays things, and therefore it will remain blank. You can solve this by saving the old paint function as a local, and calling that inside the new paint function after drawing the background, with self, w and h as the arguments. [lua] local old_p = smlpnl.Paint smlpnl.Paint = function(panel, w, h) draw.RoundedBox( 0, 0, 0, w, h, Color( 52, 73, 94 ) ) old_p( panel, w, h ) end [/lua]
[QUOTE=Z0mb1n3;48097386]Your paint function looks off, for one. It should be [code]smlpnl.Paint = function(panel, w, h) draw.RoundedBox( 0, 0, 0, w, h, Color( 52, 73, 94 ) ) end[/code] or at least that's how I do it and it works nicely.[/QUOTE] Sadly it didn't help. [editline]1st July 2015[/editline] [QUOTE=James xX;48097453]Both methods work, neither is more right or wrong. The problem is that he is overriding the paint function, the function that displays things, and therefore it will remain blank. You can solve this by saving the old paint function as a local, and calling that inside the new paint function after drawing the background, with self, w and h as the arguments. local old_p = smlpnl.Paintsmlpnl.Paint = function(panel, w, h) draw.RoundedBox( 0, 0, 0, w, h, Color( 52, 73, 94 ) ) old_p( panel, w, h )end [/QUOTE] Neither did this. [URL]http://prntscr.com/7nps0v[/URL] Now it's blank like the function isn't even called (The white rectangle in the bigger rectangle, they're suppose to be in the same color) I don't think it's a problem with the paint function as even without it, nothing displays.
[QUOTE=RedNinja;48097463]Sadly it didn't help. [editline]1st July 2015[/editline] Neither did this. [URL]http://prntscr.com/7nps0v[/URL] Now it's blank like the function isn't even called (The white rectangle in the bigger rectangle, they're suppose to be in the same color) I don't think it's a problem with the paint function as even without it, nothing displays.[/QUOTE] Are you setting the CamPos and Angle correctly?
[QUOTE=James xX;48097572]Are you setting the CamPos and Angle correctly?[/QUOTE] Haven't touched them. Shouldnt it atleast show a little of it?
The DModelPanel is icon, not smlpnl - that's just a DFrame You should definitely set the camera pos and angle - if the model is large enough, the default camera setup would be inside the model, looking at it from the inside, which will usually be nothing. You'll have to experiment to find the exact positions you want for your model, though.
[QUOTE=Kogitsune;48097764]The DModelPanel is icon, not smlpnl - that's just a DFrame You should definitely set the camera pos and angle - if the model is large enough, the default camera setup would be inside the model, looking at it from the inside, which will usually be nothing. You'll have to experiment to find the exact positions you want for your model, though.[/QUOTE] It doesn't make any sense, i've tried many different models that previously did not require some playing with the positions...
Do you know for a fact that your model would have something showing if the camera is at <0,0,0> and is pointing at <0,0,0>->Forward? If a model's center isn't the actual visual center of the model or has its origin set to a point that would put it out of view, or has all of its faces culled that are visible from that angle, you won't see anything.
[QUOTE=Kogitsune;48097852]Do you know for a fact that your model would have something showing if the camera is at <0,0,0> and is pointing at <0,0,0>->Forward? If a model's center isn't the actual visual center of the model or has its origin set to a point that would put it out of view, or has all of its faces culled that are visible from that angle, you won't see anything.[/QUOTE] I know for a fact that using LocalPlayer():GetModel() would show me a bit of the player.
What's the difference between: [CODE]if not something then[/CODE] and [CODE]if !something then[/CODE] I've had instances where the former would not do the same thing as the latter, especially with functions.
[QUOTE=MysticLlama;48098140]What's the difference between: [CODE]if not something then[/CODE] and [CODE]if !something then[/CODE] I've had instances where the former would not do the same thing as the latter, especially with functions.[/QUOTE] Then the error is on you, they are synonymous. Re-check the code where it doesn't work.
2 questions, can you TEXT_ALIGN_CENTER on surface.DrawText? why doesnt ply:Alive() work instantly? It errors once only on HUDPaint.
[QUOTE=Exploderguy;48099986]2 questions, can you TEXT_ALIGN_CENTER on surface.DrawText? why doesnt ply:Alive() work instantly? It errors once only on HUDPaint.[/QUOTE] If you're using LocalPlayer():Alive() in HUDPaint, then because HUDPaint is called EVERY frame(except in the menu obviously), there is one frame's time where InitPostEntity won't be run and therefore LocalPlayer() doesn't return anything(localplayer returns nil until initpostentity). I'd recommend doing something like [lua]client = client or LocalPlayer()[/lua] in your HUDPaint hook and then just do client:Alive() or something like that. Or you can do this: Set a variable in InitPostEntity, do this [lua]function GM:InitPostEntity() variablecalled = true end[/lua] then this [lua]function GM:HUDPaint() if !variablecalled then return end --code end[/lua] These are my thoughts. Sorry if I'm wrong.
I'm trying to create a mask entity which changes class and sets your model based on your current model. The problem is; half of it isn't working! There's no lua errors either. The character model I am positive my character is: 'models/player/suits/male_03_shirt_tie.mdl', which is in the table "highrollermodellist3". The model/printing portion isn't working ( Line 53 to Line 65 ), which leads me to believe that either my tables arn't set up right, or I'm being stupid with my IF statements. Thanks in advance. My formatting is horrible, I'm sorry. It's rather large, so I'll pastebin it: [url]http://pastebin.com/Q4Vbwdfr[/url]
Does everything else work?
Why do my dmodelpanels look like this after the recent gmod update? They used to show the model, but after the update they are like this. No code has changed. [T]http://i.gyazo.com/19aabaa5925d9f8f4063aac280c98565.png[/T]
Took a huge break from glua and figured im lacking knowledge in the table part of things. Anyone know of any decent tutorials for tables or preferably meta tables beside the lua 5.1 reference manual? Would appreciate it
[QUOTE=_Entity;48102741]Took a huge break from glua and figured im lacking knowledge in the table part of things. Anyone know of any decent tutorials for tables or preferably meta tables beside the lua 5.1 reference manual? Would appreciate it[/QUOTE] [URL="http://www.lua.org/pil/contents.html"]Programming in Lua[/URL] and the [URL="http://lua-users.org/wiki/MetamethodsTutorial"]Lua[/URL] [URL="http://lua-users.org/wiki/MetatableEvents"]Users Wiki[/URL] both have sections devoted to tables/metatables.
[QUOTE=Gamz365;48101557]Why do my dmodelpanels look like this after the recent gmod update? They used to show the model, but after the update they are like this. No code has changed. [T]http://i.gyazo.com/19aabaa5925d9f8f4063aac280c98565.png[/T][/QUOTE] That's because of overriding Paint function. Now you have to call it with width and height parameters. [code] function PANEL:Paint(w,h) self:OldPaint(w,h) end [/code]
[QUOTE=Carlton Dance;48101396]Does everything else work?[/QUOTE] Yes, just nothing in relation to the model checks. Prints will not print, not even the elseif print what.
Sorry, you need to Log In to post a reply to this thread.