• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=highvoltage;46658363]I'm making a tool that involves selecting a bunch of entities and I want them to have halos with the color based on a NetworkInt on them. What would be the best way to handle this? Looping through every entity, checking if GetNWInt doesn't return the fallback and applying the color based on the int? Like this: [/QUOTE] Use a managed list. OnAdd to the list, network the new entity index. OnRemove from the list, network the entity index. Then, have a table where the entity index is the key and the value is simply true, or whatever ( makes removing it easier ). Then on PreDrawHalos loop through the list and halo.Add( { list[ k ] } ), or, even better would be to use the key of a table as the value ( ie 2 lists ). local _entindex = net.ReadUInt( ... ); local _key = table.Insert( list1, Entity( _entindex ) ); list2[ _entindex ] = _key; That way removing from the managed list is easily done without looping, and the PreDrawHalos will only need to use the entity list: halo.Add( list1, ... ); [editline]7th December 2014[/editline] [QUOTE=MGCLegend;46658438]Entity take damage crashes game [CODE] function ENT:OnTakeDamage( dmginfo ) -- React physically when shot/getting blown self:TakePhysicsDamage( dmginfo ) self:TakeDamageInfo( dmginfo ) end[/CODE] self:TakeDamageInfo( dmginfo ) is what causes the crash...is this being used incorrectly? Trying to get the entity to take damage as a player would but it does not....[/QUOTE] You're most likely creating an infinite loop... OnTakeDamage, take damage... It would probably be best to use the OnTakeDamage function to modify the dmginfo and return it. [editline]7th December 2014[/editline] [QUOTE=highvoltage;46658441]I should add that this is for a developer tool that would only be used on singleplayer and not that often [editline]7th December 2014[/editline] There goes my automerge[/QUOTE] Well, networking wouldn't need to be used at all singleplayer only ( or multiplayer unless you want others to see it )
[QUOTE=MGCLegend;46658438]Entity take damage crashes game [CODE] function ENT:OnTakeDamage( dmginfo ) -- React physically when shot/getting blown self:TakePhysicsDamage( dmginfo ) self:TakeDamageInfo( dmginfo ) end[/CODE] self:TakeDamageInfo( dmginfo ) is what causes the crash...is this being used incorrectly? Trying to get the entity to take damage as a player would but it does not....[/QUOTE] That's an infinite loop dude
I forgot how to remove that row and push row at bottom to the top That panel is DPanel [img]http://i.imgur.com/og2Z4Kg.png[/img]
I'm working on improving my panel's animations instead of using SlideDown/SlideUp .. I created this code: [lua] if not CLIENT then return end function EaseInCubic(curtime, strt, nd, duration) if duration then curtime = curtime/duration end -- get completion fraction return strt+(curtime^3)*(nd-strt) end function EaseOutCubic(curtime, strt, nd, dur) if duration then curtime = curtime/duration end return nd-(nd*(((curtime-1)^3)+1)) end local PANEL = FindMetaTable("Panel") function PANEL:EaseInCubic(dur, minsize, maxsize) print("hi") -- prints local anim = self:NewAnimation(dur, 0, 1, function(animData, pnl) end) anim.Think = function(animData, pnl, progressFraction) local tall = EaseInCubic(progressFraction, minsize, maxsize) print(tall) -- doesn't print self:SetTall(tall) end anim.OnEnd = function(animData, pnl) self:SetVisible(true) self:SetTall(ScrH()) end end function PANEL:EaseOutCubic(dur, maxsize, minsize) local anim = self:NewAnimation(dur, 0, 1, function(animData, pnl) end) anim.Think = function(animData, pnl, progressFraction) local tall = EaseOutCubic(progressFraction, maxsize, minsize) self:SetSize(self:GetWide(), tall) end anim.OnEnd = function(animData, pnl) self:SetVisible(false) self:SetTall(maxsize) end end [/lua] I call it like this: [lua] main:EaseInCubic(MOTD.AnimTime, 0, ScrH()) [/lua] Note that when I use SlideDown instead of EaseInCubic it works. However, when I try to use the EaseInCubic code, the panel never animates/appears. I attempted to stick prints in the EaseInCubic function, which were printed, but prints in the think function were never printed. Any idea where I went wrong?
I'm making prop prediction of velocity and am trying to get the drag coefficient from a MAT_ enum... is there a way to do this in lua or in source engine at all? [editline]7th December 2014[/editline] Nice.. there is this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PhysObj/SetDragCoefficient]PhysObj:SetDragCoefficient[/url] but no GetDragCoefficient...
[QUOTE=MeepDarknessM;46661320]I'm making prop prediction of velocity and am trying to get the drag coefficient from a MAT_ enum... is there a way to do this in lua or in source engine at all? [editline]7th December 2014[/editline] Nice.. there is this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PhysObj/SetDragCoefficient]PhysObj:SetDragCoefficient[/url] but no GetDragCoefficient...[/QUOTE] No, because MAT_ enums are being used by lots of surface properties with lots of different properties.
[QUOTE=Robotboy655;46661450]No, because MAT_ enums are being used by lots of surface properties with lots of different properties.[/QUOTE] ok, how about from [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PhysObj/GetMaterial]PhysObj:GetMaterial[/url] [url=https://github.com/Facepunch/garrysmod-requests/issues/381]Here's my request[/url]
[QUOTE=MeepDarknessM;46661585]ok, how about from [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PhysObj/GetMaterial]PhysObj:GetMaterial[/url][/QUOTE] Well you could get $surfaceprop or $surfaceprop2 from that, then read scripts/surfaceproperties.txt, find that surfaceprop and see its values, but you also gotta take care of inheritance for both, the materials and surfaceprops file.
[QUOTE=Robotboy655;46661766]Well you could get $surfaceprop or $surfaceprop2 from that, then read scripts/surfaceproperties.txt, find that surfaceprop and see its values, but you also gotta take care of inheritance for both, the materials and surfaceprops file.[/QUOTE] thanks but for future reference that function returns $surfaceprop's value
[QUOTE=Robotboy655;46661450]No, because MAT_ enums are being used by lots of surface properties with lots of different properties.[/QUOTE] What does that have to do with getting the drag coefficient?
[QUOTE=thegrb93;46661817]What does that have to do with getting the drag coefficient?[/QUOTE] You can't get the drag coefficient from a MAT_ enum like he wanted to. It may be different for same MAT_ enums.
I want to make random spawns for entities(weapons) in the whole map.. I coded everything but now I need to check if some weapon didn't spawned outside of the map(in walls or something), can you tell me how I can check this?
[QUOTE=Dexter127;46663196]I want to make random spawns for entities(weapons) in the whole map.. I coded everything but now I need to check if some weapon didn't spawned outside of the map(in walls or something), can you tell me how I can check this?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/IsInWorld]Entity:IsInWorld[/url]
[QUOTE=man with hat;46663452][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/IsInWorld]Entity:IsInWorld[/url][/QUOTE] That works to make sure it's not outside of the world (in the void), but that does not ensure that something is not in a wall... I don't think? I believe that only returns true if the Origin of the objects is in the void.
[QUOTE=Robotboy655;46661830]You can't get the drag coefficient from a MAT_ enum like he wanted to. It may be different for same MAT_ enums.[/QUOTE] What I meant was, why is there no PhysObj:GetDragCoefficient?
[QUOTE=thegrb93;46664745]What I meant was, why is there no PhysObj:GetDragCoefficient?[/QUOTE] Also PhysObj:SetBuoyancyRatio() but no :GetBuoyancyRatio() ?
You could do a TraceHull on the weapon at the current location...
[QUOTE=wh1t3rabbit;46664881]Also PhysObj:SetBuoyancyRatio() but no :GetBuoyancyRatio() ?[/QUOTE] [QUOTE=thegrb93;46664745]What I meant was, why is there no PhysObj:GetDragCoefficient?[/QUOTE] Because Valve didn't bother to create those functions for VPhysics interface.
Anyone know if there is a way (With a binary module, i mean, in C++) to get the current command being typed in srcds server ? (Linux) And maybe change it ? (I don't know if it's Linux Kernel API related of SRCDS related) (I want to make a Autocompletition module)
I can see this code being used in sandbox: [lua]... Angle( 0, RealTime()*10, 0) )[/lua] Is there an undocumented "value % 360" on this Angle() function?
[QUOTE=Blasteh;46667064]I can see this code being used in sandbox: [lua]... Angle( 0, RealTime()*10, 0) )[/lua] Is there an undocumented "value % 360" on this Angle() function?[/QUOTE] math.NormalizeAngle but it is -180 to 180 and only does one number at a time. Here's what I use: [code]// // Handles repetitive smooth rotational calculations into 1 line - Josh 'Acecool' Moser // function math.rotate( _speed, _offset ) local _yaw = ( RealTime( ) * ( _speed || 180 ) + ( _offset || 0 ) ) % 360; _yaw = math.NormalizeAngle( _yaw ); return _yaw; end[/code] Speed is self explanatory, offset should be but ... it is there to add a random value so multiple objects aren't forced to be in "sync"
[QUOTE=Acecool;46667778]math.NormalizeAngle but it is -180 to 180 and only does one number at a time. Here's what I use: [code]// // Handles repetitive smooth rotational calculations into 1 line - Josh 'Acecool' Moser // function math.rotate( _speed, _offset ) local _yaw = ( RealTime( ) * ( _speed || 180 ) + ( _offset || 0 ) ) % 360; _yaw = math.NormalizeAngle( _yaw ); return _yaw; end[/code] Speed is self explanatory, offset should be but ... it is there to add a random value so multiple objects aren't forced to be in "sync"[/QUOTE] Wasn't exactly what I asked, but if you did that and it already does it for you, then the code for %360 and NormalizeAngle() essentially runs twice.. I think these hidden things should be documented in the wiki, along with acceptable values. Anywhere we can check the original functions to see what they do?
Actually, I'd need to subtract 180 for it to be "normalized", as far as I know it may mod and shift where-as I am already modding so I could just shift and avoid calling normalize angle.
[QUOTE=Blasteh;46667899]Wasn't exactly what I asked, but if you did that and it already does it for you, then the code for %360 and NormalizeAngle() essentially runs twice.. I think these hidden things should be documented in the wiki, along with acceptable values. Anywhere we can check the original functions to see what they do?[/QUOTE] pitch is clamped at 90/-90 normally and yaw is automatically fixed EDIT: WHEN NETWORKED - NOT IN ANGLE FUNCTION EDIT: ON PLAYERS lol willox reminded me this is only on players [editline]8th December 2014[/editline] Also due to Euler gimbal lock it might still happen apparently, Willox linked me to a video about Euler and gimbal lock to explain (for physgun rotation) i really shouldn't post when i first get up.. look at all the edits
[QUOTE=WalkingZombie;46663955]That works to make sure it's not outside of the world (in the void), but that does not ensure that something is not in a wall... I don't think? I believe that only returns true if the Origin of the objects is in the void.[/QUOTE] It returns [b]false[/b] when entity is IN WALLS and OUTSIDE THE WORLD (VOID) BIG THANKS GUYS!!
What are the .vmt parameters to make something have black cartoon lines outside of it?
Can someone explain to me what the fallback resources are for CS:S? I was going to make it so my pack doesn't require CS:S so I unmounted Counter-Strike and restarted gmod. Worldmodels, cmodels, and sounds worked. The only thing that wasn't there was the scope material which I can easily pack in. I just want to know if it was a fluke.
Can I cover a derma button with something so it can't be pressed? for example, if player is usergroup vip then it's clear, but if he's user then it gets blocked
[QUOTE=ROFLBURGER;46670172]Can someone explain to me what the fallback resources are for CS:S? I was going to make it so my pack doesn't require CS:S so I unmounted Counter-Strike and restarted gmod. Worldmodels, cmodels, and sounds worked. The only thing that wasn't there was the scope material which I can easily pack in. I just want to know if it was a fluke.[/QUOTE] GMod has the scope materials with another name, search gui and vgui folders.
How to given SetOwner to ply:CreateRagdoll( )? client side ragdoll info is 'hl2mp_ragdoll' but owner is [ NULL ENTITY ] ...
Sorry, you need to Log In to post a reply to this thread.