• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
It's a 3D2D scale issue. Use a scale less than 1, like 0.10
is it possible to change how much damage the default armor absorbs? Searched around a bit before making this post and found a reddit post that mentioned that armor absorbs 80% of damage by default. As far as I'm aware, Armor will generally absorb 80% of damage, up until the point where you are depleted of it, at which point 100% of damage is committed to your Health. Hence, even if you have 100% Armor, your Health is still affected when you take damage. This is described in player.cpp where ARMOR_RATIO is 0.2 and ARMOR_BONUS, which only applies to multiplayer, is 1.0. Certain damage types ignore armor, such as falling, drowning, poison and radiation (the latter of which is a little ironic when you think about it).
Thank you. I feel dumb for not figuring that out lol. But there's one more issue I have: https://files.facepunch.com/forum/upload/107178/c00083f9-76f6-4e80-be0d-f31d52b04f94/d2_coast_030006.jpg https://files.facepunch.com/forum/upload/107178/78fcdcdd-f7ae-40b8-814f-7be3a8615e23/d2_coast_030012.jpg The number doesn't really stay in the same relative position. local cOne = wep:Clip1() local Attach = vm:GetAttachment( 1 ) local AttachPos = Attach.Pos+Attach.Ang:Right()*AmmoPosGoal[1]+Attach.Ang:Forward()*AmmoPosGoal[2]+Attach.Ang:Up()*AmmoPosGoal[3] local AttachAng = Attach.Ang AttachAng:RotateAroundAxis( Attach.Ang:Right(), 90 ) AttachAng:RotateAroundAxis( Attach.Ang:Up(), 3 ) Found out how to get Clip1, just couldn't call it in the 2D3D segment. Derp. AmmoPosGoal is a variable I created to fix the adjustment when aiming down sights, but during animations the number still moves around. Might there be a better way to attach it to the weapon? Maybe a better attachment to start with?
How would I go about acquiring my SENT's LOD? Or any other parameter that changes not only by the draw distance by also by draw zoom (for example when zooming into an entity using the camera tool, the LOD increases as it would if you were close to it)?
And another question: How can I make an NPC fear my SENT's class? It seems NPC/AddRelationship only applies to other NPCs
So as to my last question... do I just need to keep messing with the scale of the 3d2d to get it to stay attached to the model in the right spot? I feel like it's a viewmodel fov related issue.
I believe the LOD is just a number which is saved and typically it's set to -1. That said, I don't think the current render detail level can be retrieved like you're hoping to do. You're probably best off calculating it yourself based on the FOV and distance of the viewport. Zoom in on/walk towards an entity and write down the FOV/distances at which it changes.
AddRelationship works for all classes.
Is there some way to do a GetAimVector() or GetEyeTrace() on a nextbot entity? Or is there any other solution to what im trying to get below? local aimn= nextbot:GetAimVector():GetNormalized() local dirn = (nextbot:GetPos()-ply:GetPos()):GetNormalized() local dotty = aimn:Dot(dirn)
Any way I can restrict player from spawning bright lamps? It's like hook.Add ("COM_SPAWNEDENT", "com_entity_props", function (ent)  --PrintTable (ent:GetTable()) if ent:GetClass() == "gmod_light" then local br = ent:GetVar ("Brightness") if br > 3 then br = 1 end ent:SetVar ("Brightness", br) print(ent:GetVar ("Brightness")) end end) ...but it doesn't actually change it's brightness, although print(ent:GetVar ("Brightness")) returns 1. Maybe I should update the entity somehow, or the whole method will never work?
Use util.TraceLine() with nextbot:EyePos() and nextbot:EyeAngles():Forward()
As seen in the source for gmod_light (https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/entities/gmod_light.lua#L20), it's a dt var, not a normal variable on the entity table. Just use `ent:SetBrightness(number)`.
Somehow not sure about this: when I use Lerp() or LerpVector() in draw hooks, should I be using FrameTime()?
Small problem here, trying to change the color of a translucent texture for GUI. Won't work. Setting the color of the texture only seems to work when the texture isn't translucent. Someone know how to fix? Here is the .vtf just in case: [code] "UnlitGeneric" { "$basetexture" "testing_hud/test_texture" "$translucent" "1" "$vertexcolor" "1" } [/code]
A wild guess, but try adding $vertexalpha
You know you can use render.SetColorMaterial with render.SetBlend for what you are trying to do
Hey I'm trying to make a basic chatbox and I need some help. I've used this to create the box: local frame = vgui.Create( "DFrame" ) frame:SetPos( 25, 600) frame:SetSize( ScrW() * 600/1920, ScrH() * 250/1080 ) frame:MakePopup() local TextEntry = vgui.Create( "DTextEntry", frame ) TextEntry:SetPos( 10, 210 ) TextEntry:SetSize( 550, 25 ) TextEntry:SetText( "Placeholder Text" ) TextEntry.OnEnter = function( self )     chat.AddText( self:GetValue() )     frame:Remove() end local frame = vgui.Create( "DFrame" ) frame:SetSize( 550, 150 ) frame:SetPos(40, 640) frame:MakePopup() local richtext = vgui.Create( "RichText", frame ) richtext:Dock( LEFT ) richtext:InsertColorChange( 192, 192, 192, 255 ) richtext:AppendText( "This \nRichText \nis \n" ) richtext:InsertColorChange( 255, 255, 224, 255 ) richtext:AppendText( "AWESOME\n\n" ) richtext:InsertColorChange( 255, 64, 64, 255 ) richtext:AppendText( "#ServerBrowser_ESRBNotice" ) This is what it looks like ingame: https://files.facepunch.com/forum/upload/248549/edd024a4-c06a-4951-957f-232c45404456/chatbox attempt.png These are my questions, I'll try to keep them short: Is this what it should look like, coding and aesthetic wise? Does RichText just show past chatlogs like any other chatbox? When I enter my text, only the DFrame will be removed. How do I make the richtext go away aswell on entry of text? What else should I do here for a basic chatbox? Thanks.
Use richtext:Dock(FILL) instead of Dock(LEFT). Remove the second creation of the frame. Dock the textentry BOTTOM local frame = vgui.Create( "DFrame" ) frame:SetPos( 25, 600) frame:SetSize( ScrW() * 600/1920, ScrH() * 250/1080 ) frame:MakePopup() local TextEntry = vgui.Create( "DTextEntry", frame ) TextEntry:Dock(BOTTOM) --3 Dock the textentry BOTTOM TextEntry:SetTall(25) TextEntry:SetText( "Placeholder Text" ) TextEntry.OnEnter = function( self ) chat.AddText( self:GetValue() ) frame:Remove() end -- 2 Remove the second creation of the frame. local richtext = vgui.Create( "RichText", frame ) richtext:Dock( FILL ) --1 Use richtext:Dock(FILL) instead of Dock(LEFT). richtext:InsertColorChange( 192, 192, 192, 255 ) richtext:AppendText( "This \nRichText \nis \n" ) richtext:InsertColorChange( 255, 255, 224, 255 ) richtext:AppendText( "AWESOME\n\n" ) richtext:InsertColorChange( 255, 64, 64, 255 ) richtext:AppendText( "#ServerBrowser_ESRBNotice" )
Thanks a bunch man. How can I increase my "vocabulary" of the commands? Like I didn't even know SetTall existed. Do you literally just have to type "panel" in the Gmod wiki and search through what you want until you find it?
Years of practice, honestly. You could just skim the list every now and then but you won't truly know the full GMod API till you've worked with it for a long time.
So here's the SWEP I'm working on right now. The video hasn't finished uploading at the time that I made this post. https://youtu.be/OLltnSjXZc4 How can I fix the display on the gun flopping around every which way during animations? Here's the code for positioning this thing: local Attach = vm:GetAttachment( 1 ) local AttachPos = Attach.Pos+Attach.Ang:Right()*AmmoPosGoal[1]+Attach.Ang:Forward()*AmmoPosGoal[2]+Attach.Ang:Up()*AmmoPosGoal[3] local AttachAng = Attach.Ang AttachAng:RotateAroundAxis( Attach.Ang:Right(), 90 ) AttachAng:RotateAroundAxis( Attach.Ang:Up(), 3 ) cam.Start3D2D( AttachPos, AttachAng, .025 ) The display has changed ever since the video was recorded. When there's more red stuff on the display that's regarding an 'incendiary' mode I've added.
I am attempting to get a plane to fly to a point on the map and navigate to it realistically. By realistically what I mean is is bank when it turns and things of that nature. I am not amazing at physics so I was trying to reverse engineer one of the NPC's from neruo planes to figure out how it works there. They use the PhysicsSimulate function to handle all the movement in the AI. I stripped out all the needed code and slapped it in my entity modifying a few pieces so it would trace an entity and attempted to play around with it. After several days I have nothing. I have no idea whats going on but it just won't do anything at all. The plane just sits still no matter where you put it even mid air. All the variables in the simulate function are outputting like they do on the NPC but the plane stays stationary. I have never used the PhysicsSimulate function before and can't find much documentation on how to properly use it but I am calling the StartMotionController function in int and the movetype is set right. I would love some help figuring out why this isn't working or help with code for the kinda movement I am looking for. Anything is appreciated at this point. Here is my entitie's server side file https://pastebin.com/8ziJbj6m Here is the NPC's server side file https://pastebin.com/2DzTYLSV
my PC has been running for multiple consecutive days. I should probably restart it sometime soon. Why am I saying this? Cus I think it's relevant to my question: This: local osTime = os.time() local osDays = math.floor(osTime/86400) local osTimeND = (osTime-(osDays*86400)) -- print("Day: "..osTimeND) local osHour = math.floor(osTimeND/3600) local osTimeNH = (osTimeND-(osHour*3600)) local osMinute = math.floor(osTimeNH/60) local osSecs = (osTimeNH-(osMinute*60)) local osHourDub = osHour if osHourDub < 10 then osHourDub = "0"..osHour   end local osMinDub = osMinute if osMinDub < 10  then osMinDub  = "0"..osMinute end local osSecDub = osSecs if osSecDub  < 10 then osSecDub  = "0"..osSecs   end local HMReadout = (osHourDub..":"..osMinDub) local MSReadout = (osMinDub ..":"..osSecDub) -- print("HM: "..HMReadout) -- print("MS: "..MSReadout) print("osDays   = "..osDays) print("osHour   = "..osHour) print("osMinute = "..osMinute) print("osSecs   = "..osSecs) My hours are reading 0. HMReadout is 00:26 the last I checked, obviously minutes have passed since then. osSecs   = 43 osDays   = 17636 osHour   = 0 osMinute = 28 osSecs   = 43 osDays   = 17636 osHour   = 0 osMinute = 28 Why am I getting 0 for hours?
I'm sure people have asked before, but I noticed when testing a new model with TTT lua weapons that the iron-sights do not work for all the weapons. Im guessing its a local host thing but I need a solution so I can test and balance these sweps before release.
I have a thing that prints the amount of currency a player has. Everything works fine, except for when the command is run it outputs the text for each player on the server (for example, if there was 4 players on the server and the command is run, it will print "[name] has [amount] Shekelbergs." 4 times) Why does this happen? On the server:     function pm:Money_Get()         local current = tonumber(self:GetPData( "cash" ))         return current     end net.Receive("shekelberg_call", function() local ply = net.ReadEntity() local money = tonumber(ply:Money_Get()) net.Start("shekelberg_amount") net.WriteInt(money, 32) net.Send(ply) end) On the client: hook.Add("OnPlayerChat", "PrintShekelbergs", function(ply, text, team, isDead) if (string.lower(text) == string.lower("!shekelbergs")) then net.Start("shekelberg_call") net.WriteEntity(ply) net.SendToServer() end net.Receive("shekelberg_amount", function() local money = net.ReadInt(32) chat.AddText(ply, " has ", Color(0, 102, 255), money .. " Shekelbergs.") return true end) end)
Do they not work, or do they just not line up? If the problem is the latter then it's because the ironsights work using local variables on the SWEP's script. I've never bothered with TTT stuff myself, but I'm sure it's like this. Find those variables and just keep tweaking them until the ironsights line up, that's my advice.
This problem includes the base entities that ship with garrysmod for TTT. All of these weapons do use defined vectorspos/vectorang for where the ironsights end up, but nothing changes visually. The player movement is slowed and weapons become more accurate when rightclicking but the movement of the swep does not. Could a variable stored in the base shared weapon become obsolete?
Guys, i just forgot how to remove the "CLICK" Sound when shooting with a Weapon, can anybody help me ?
How to open/close vgui client side ? I made function based on PlayerSwitchWeapon but i dont know how to call vgui without net messages Thanks for reply, please dont be rude its my first script.
How does freeaim works when I hold C in sandbox? Are there any implementations described in default lua code, or it's handled inside C++ game code?
Sorry, you need to Log In to post a reply to this thread.