1. Post #761
    skullorz's Avatar
    May 2009
    936 Posts
    Do you get any lua error?
    Nope.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  2. Post #762
    Gold Member
    Splambob's Avatar
    January 2005
    1,222 Posts
    Does anyone know how to get the size of a ClientsideModel? Entity.OBBMaxs, Entity.OBBMins and Entity.WorldSpaceAABB all return a zero vector, which I'll guess is because clientside models don't have physics hulls but I don't know for sure

    Sample code;

    local mdl = ClientsideModel( "models/props_combine/breenbust.mdl", RENDER_GROUP_OPAQUE_ENTITY )
    
    local min, max = mdl:WorldSpaceAABB()
    print(min, max)	        -- 0.0000 0.0000 0.0000	0.0000 0.0000 0.0000
    print(mdl:OBBMaxs())	-- 0.0000 0.0000 0.0000
    print(mdl:OBBMins())	-- 0.0000 0.0000 0.0000
    Reply With Quote Edit / Delete Windows 7 Show Events

  3. Post #763
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    Does anyone know how to get the size of a ClientsideModel? Entity.OBBMaxs, Entity.OBBMins and Entity.WorldSpaceAABB all return a zero vector, which I'll guess is because clientside models don't have physics hulls but I don't know for sure

    Sample code;

    local mdl = ClientsideModel( "models/props_combine/breenbust.mdl", RENDER_GROUP_OPAQUE_ENTITY )
    
    local min, max = mdl:WorldSpaceAABB()
    print(min, max)	        -- 0.0000 0.0000 0.0000	0.0000 0.0000 0.0000
    print(mdl:OBBMaxs())	-- 0.0000 0.0000 0.0000
    print(mdl:OBBMins())	-- 0.0000 0.0000 0.0000
    You could try ent:GetRenderBounds(), I haven't tested it but it might work.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Lua King Lua King x 1 (list)

  4. Post #764
    Gold Member
    Splambob's Avatar
    January 2005
    1,222 Posts
    Genius, thanks for the help!
    Reply With Quote Edit / Delete Windows 7 Show Events

  5. Post #765
    Hearts
    Agent766's Avatar
    July 2007
    3,179 Posts
    is there a way to find which player uses a certain map button?
    Any ideas?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  6. Post #766
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Lua Helper Lua Helper x 1 (list)

  7. Post #767
    Hearts
    Agent766's Avatar
    July 2007
    3,179 Posts
    Reply With Quote Edit / Delete Windows 7 United States Show Events Friendly Friendly x 2Disagree Disagree x 1 (list)

  8. Post #768
    kp3
    Gold Member
    kp3's Avatar
    January 2008
    2,986 Posts
    How do I create bots? Simply typing "Bot" in the console does nothing for me. Does it need to be a dedicated server?

    Tried searching but forums doesn't like three letter words.
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events

  9. Post #769
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    How do I create bots? Simply typing "Bot" in the console does nothing for me. Does it need to be a dedicated server?

    Tried searching but forums doesn't like three letter words.
    Listen/dedicated server should work fine but it wont in singleplayer.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 1 (list)

  10. Post #770
    Gold Member
    Rayne Rimsek's Avatar
    February 2007
    322 Posts
    So.. Currently I've been working on modifying a Riot Shield, and I've been having a ton of problems with using SetParentAttachmentMaintainOffest.. It works fine, as long as I'm facing one direction.. I was trying to research it, and I believe it was something to do with the world position/angle's relativity to the local position/angle.

    Here is my code:

    Code:
    function SWEP:Deploy()
    	if SERVER then
    		if ValidEntity(self.ent) then return end //Makes it not able to spawn multiple entities.
    		self.Owner:SetRunSpeed(125)
    		self.Owner:SetWalkSpeed(125)
    		self:SetColor(255,255,255,0)
    		self.ent = ents.Create("prop_physics")
    			self.ent:SetModel("models/arleitiss/riotshield/shield.mdl")
    			self.ent:SetParent(self.Owner)
    			par = self.ent:GetParent()
    			hand = par:LookupBone("ValveBiped.Anim_Attachment_RH")
    			local pos, ang = par:GetBonePosition( hand )
    			self.ent:SetPos(pos + Vector (-12,-10,-22))
    			self.ent:SetAngles(ang + Angle(0,-180,0))
    			self.ent:Fire("SetParentAttachmentMaintainOffest", "anim_attachment_RH", 0.01)
    			self.ent:SetCollisionGroup( COLLISION_GROUP_WORLD ) // Lets it not collide to anything but world. Taken from Nocollide 
    			self.ent:Spawn()
    			self.ent:Activate()
    	end
    	return true
    end
    Here are the screenshot's of what happens:

    This is when it is selected while facing the correction direction, and how I want it to look.
    http://cloud.steampowered.com/ugc/93...F424DF2C513E1/

    This is what happens otherwise..
    http://cloud-2.steampowered.com/ugc/...C0C7BDC3CCBB5/

    I would prefer using SetParentAttachment but then I cant change the position/angle and it isn't attached in the correct position.

    Anyone know what I can do to fix it? Im quite new to lua scripting by the way..

    Thank you.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  11. Post #771
    CapsAdmin's Avatar
    August 2005
    3,974 Posts
    Does anyone know why I'm getting the player origin for some bones? It's just that on my public dedicated server all the bones work fine, but on my local dedicated server with a lot less addons, most of the bones return to ply:GetPos()

    my local dedicated server


    my public dedicated server


    So the bone "right finger 2" exists and all, it just returns to player origin in some maps (??) or in some servers (??) I'm just really confused about this.

    The same goes for other models as well. On my public dedicated server I can get the position and angles of jeep tires but on my local dedicated server they return to jeep origin.

    (Note that it's actually ValveBiped.RightFinger02 internally in the code, I'm just generating friendly names from the literal bone names)


    So.. Currently I've been working on modifying a Riot Shield, and I've been having a ton of problems with using SetParentAttachmentMaintainOffest.. It works fine, as long as I'm facing one direction.. I was trying to research it, and I believe it was something to do with the world position/angle's relativity to the local position/angle.

    Here is my code:

    Code:
    function SWEP:Deploy()
    	if SERVER then
    		if ValidEntity(self.ent) then return end //Makes it not able to spawn multiple entities.
    		self.Owner:SetRunSpeed(125)
    		self.Owner:SetWalkSpeed(125)
    		self:SetColor(255,255,255,0)
    		self.ent = ents.Create("prop_physics")
    			self.ent:SetModel("models/arleitiss/riotshield/shield.mdl")
    			self.ent:SetParent(self.Owner)
    			par = self.ent:GetParent()
    			hand = par:LookupBone("ValveBiped.Anim_Attachment_RH")
    			local pos, ang = par:GetBonePosition( hand )
    			self.ent:SetPos(pos + Vector (-12,-10,-22))
    			self.ent:SetAngles(ang + Angle(0,-180,0))
    			self.ent:Fire("SetParentAttachmentMaintainOffest", "anim_attachment_RH", 0.01)
    			self.ent:SetCollisionGroup( COLLISION_GROUP_WORLD ) // Lets it not collide to anything but world. Taken from Nocollide 
    			self.ent:Spawn()
    			self.ent:Activate()
    	end
    	return true
    end
    Here are the screenshot's of what happens:

    This is when it is selected while facing the correction direction, and how I want it to look.
    http://cloud.steampowered.com/ugc/93...F424DF2C513E1/

    This is what happens otherwise..
    http://cloud-2.steampowered.com/ugc/...C0C7BDC3CCBB5/

    I would prefer using SetParentAttachment but then I cant change the position/angle and it isn't attached in the correct position.

    Anyone know what I can do to fix it? Im quite new to lua scripting by the way..

    Thank you.
    You can't add your own offsets when using attachment without that happening. You're supposed to do that in the model itself since it assumes the model's attachment point is already corrected in the model itself.

    The only way I can think of is to do it clientside.

    If you want the shield to actually be physical you can try and use PhysObj.ComputeShadowControl or just simply phys:SetPos(pos) and phys:SetAngle(ang) in a think hook on the server while doing the same exact on client to make it look smooth. SetPos and SetAngle on the physics object might screw with collisions though.
    Reply With Quote Edit / Delete Windows 7 Norway Show Events

  12. Post #772
    Gold Member
    Rayne Rimsek's Avatar
    February 2007
    322 Posts
    I ended up finding a new method that works well.. Now my problem is that I wasn't quite paying attention, and didn't notice that my shield is made of glass. Madcows sweps shoot clean through it.

    Anyone know how to change the physical properties of a physics prop within a script?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  13. Post #773
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    I ended up finding a new method that works well.. Now my problem is that I wasn't quite paying attention, and didn't notice that my shield is made of glass. Madcows sweps shoot clean through it.

    Anyone know how to change the physical properties of a physics prop within a script?
    Take a look at the source for the physical properties tool included in GMod.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  14. Post #774
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    Would anyone who's decent with 3d math be willing to add me on Steam and help me out? The code is from a project and would take a pretty long time to turn into something that was understandable just in a forum post.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  15. Post #775
    wanksta11's Avatar
    April 2009
    1,804 Posts
    Could someone fix this?
    http://www.garrysmod.org/downloads/?a=view&id=101997
    I mean you just put the drugs in him and nothing happens.
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  16. Post #776

    February 2009
    467 Posts
    Hi I need help with something :o



    The texture glitches out when ever you look around and you can see all entities passed it.
    Thanks in advance.


    local w = 406
    local h = 220
    
    
    function ENT:DrawScreen()
    
    	surface.SetDrawColor( 255, 255, 255, 255 )
    	surface.DrawRect( 0, 0, w, h )
    	
    	local mat = Material( "models/props_wasteland/dirtwall001a" )
    	render.SetMaterial( mat )
    	render.DrawQuad(Vector(0, 0, 0), Vector(w, 0, 0),
    									Vector(w, h, 0),
    					Vector(0, h, 0))
    
    end
    
    
    /*---------------------------------------------------------
       Name: DrawPre
    ---------------------------------------------------------*/
    function ENT:Draw()
    
    	self:DrawModel()
    	 
    	local ang = self:GetAngles()
    	local pos = self:GetPos() - Vector( 0, 0, 15 ) + ang:Up()
     
    	--ang:RotateAroundAxis( ang:Forward(), 90 )
    	--ang:RotateAroundAxis( ang:Right(), 90 )
    	
    	-- This makes the screen show all the time
    	self:SetRenderBoundsWS(Vector(-1100, -1100, -1100) + self:GetPos(), Vector(1100, 1100, 1100) + self:GetPos())
     
    	cam.Start3D2D( pos, Angle( 0, ang.y, ang.r ), 0.55 )
    		self:DrawScreen()
    	cam.End3D2D()
    	
    end
    
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  17. Post #777
    LITTLE PREB FAGGOT
    ollie's Avatar
    January 2012
    899 Posts
    How can i make so only a specific player can open a door?
    Like in RP gamemodes.
    Reply With Quote Edit / Delete Windows 7 Finland Show Events

  18. Post #778
    pennerlord's Avatar
    February 2011
    503 Posts
    How can i make so only a specific player can open a door?
    Like in RP gamemodes.
    You could try to use the PlayerUse Hook and check if the player is in a table. Return true if he is (otherwise return false).
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Lua Helper Lua Helper x 1 (list)

  19. Post #779
    LITTLE PREB FAGGOT
    ollie's Avatar
    January 2012
    899 Posts
    You could try to use the PlayerUse Hook and check if the player is in a table. Return true if he is (otherwise return false).
    Oh i forgot that hook, thanks a lot!
    Reply With Quote Edit / Delete Windows 7 Finland Show Events

  20. Post #780
    wanksta11's Avatar
    April 2009
    1,804 Posts
    Everyone in my server is getting this error while using keypads that don't even work.
    FCVAR_SERVER_CAN_EXECUTE prevented server running command: +gm_special
    FCVAR_SERVER_CAN_EXECUTE prevented server running command: -gm_special
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  21. Post #781
    Spades_Neil's Avatar
    July 2010
    58 Posts
    Two things I want to do for a SWEP.

    1. I'd like a line of code that draws crosshairs if I'm using ironsights--or rather, holding down right-mouse-button. This is only for models that cannot use ironsights normally.
    2. I want a line of code that disables the ability to shoot while sprinting.

    I'm a total noob at LUA and I'm basically self-teaching myself how to build SWEPs. If anyone cares to lend me some advice, please contact me through PMs--because lord knows I'll never find my post again in this thread.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  22. Post #782
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    Is there an offline copy of the backup wiki?
    Reply With Quote Edit / Delete Linux United Kingdom Show Events

  23. Post #783
    CoolOppo's Avatar
    October 2011
    114 Posts
    I found an anti-prop kill/fly/surf script that would be really useful, only it has a few problems. Can somebody please fix these?

    A. You can physgun other people's props to make them phase and walk through them even with an add on like FPP installed. This is detrimental to basically any RP game mode.

    B. You can freeze props inside of people and they don't get pushed out of them. This should probably just be fixed by causing the prop to unfreeze if it is frozen inside of a person because it already pushes props out of people when somebody puts one inside of a person.

    C. You can still spawn props above people or move them on top of people, then drop them to kill them.

    I would really appreciate if somebody could fix this script up for me; if you want to take a look at it, here it is.
    Reply With Quote Edit / Delete United States Show Events

  24. Post #784
    pennerlord's Avatar
    February 2011
    503 Posts
    Is there an offline copy of the backup wiki?
    Found a zip file on Maurits' Webspace that says "GMod_Wiki". Maybe it's the old wiki.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Friendly Friendly x 1 (list)

  25. Post #785
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    Found a zip file on Maurits' Webspace that says "GMod_Wiki". Maybe it's the old wiki.
    It's certainly big enough. I deeply hope I'm not wasting 400MB of bandwidth for nothing.

    Edited:

    Looks like that is the old wiki, thanks!
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Friendly Friendly x 1 (list)

  26. Post #786
    Gold Member
    Splambob's Avatar
    January 2005
    1,222 Posts
    Hey guys, I'm working with Derma and some of the time when I screw up I get an unhelpful error within a Derma extension file. Example;
    Code:
    vgui.Create: Error when calling 'DCreateHoloMenu_Holopad':Init ([lua\includes\extensions\panel.lua:141] attempt to index local 'pnl' (a nil value))
    How may I get a multi-level stack trace like the one in GM13 beta, so I can see what part of my code is causing the failure in the Derma file? Thanks in anticipation.
    Reply With Quote Edit / Delete Windows 7 Show Events

  27. Post #787
    cromizoid's Avatar
    December 2009
    117 Posts
    I'm getting this error through my toybox SWEP "[!toybox_186932:942] attempt to call method 'Penetrate' (a nil value)" , (it's been blue). I haven't been able to reproduce this myself however. I pasted the code here because it is rather long: http://pastebin.com/4cjkHTSa
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  28. Post #788
    randomscript's Avatar
    May 2007
    127 Posts
    I can't remember, is there a way to credit an entity's owner with kills made with ent:Ignite()?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1 (list)

  29. Post #789
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    Anyone know of any documentation/guide on how to go about making custom animations? Is it possible to make an animation that applies to every player model, or would you have to edit it into each individual model & force clients to download the updated ones?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  30. Post #790
    Briglair Gaming
    Moka's Avatar
    May 2012
    35 Posts
    Anyone know how i can have the old gmod 10 screen on my gmod 12?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  31. Post #791
    quality poster
    Dennab
    August 2009
    12,242 Posts
    what is the most up to date method of sending data from server to client (and client to server as well i guess)? when i was into GLua it was umsgs but i remember garry added something like a "data" library that you're supposed to use instead. i'm trying to make a gamemode that will be up to date with Gmod13 but the wiki is apparently nonexistent (great idea btw) so i'm not sure whats up
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  32. Post #792
    MoronYard
    _nonSENSE's Avatar
    May 2010
    1,265 Posts
    what is the most up to date method of sending data from server to client (and client to server as well i guess)? when i was into GLua it was umsgs but i remember garry added something like a "data" library that you're supposed to use instead. i'm trying to make a gamemode that will be up to date with Gmod13 but the wiki is apparently nonexistent (great idea btw) so i'm not sure whats up
    GM13 introduces the net library. Articles here: http://wiki.garrysmod.com/page/net and http://maurits.tv/data/garrysmod/wik...index1b73.html
    Reply With Quote Edit / Delete Mac Germany Show Events

  33. Post #793
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    Hey guys, I'm working with Derma and some of the time when I screw up I get an unhelpful error within a Derma extension file. Example;
    Code:
    vgui.Create: Error when calling 'DCreateHoloMenu_Holopad':Init ([lua\includes\extensions\panel.lua:141] attempt to index local 'pnl' (a nil value))
    How may I get a multi-level stack trace like the one in GM13 beta, so I can see what part of my code is causing the failure in the Derma file? Thanks in anticipation.
    Debug.Trace

    I can't remember, is there a way to credit an entity's owner with kills made with ent:Ignite()?
    Pretty sure there isn't, you'll have to manually Entity.TakeDamageInfo them in a timer.

    Anyone know how i can have the old gmod 10 screen on my gmod 12?
    You'll have to explain more, that doesn't make sense.
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Friendly Friendly x 1 (list)

  34. Post #794
    Zephilinox's Avatar
    September 2010
    298 Posts
    Debug.Trace



    Pretty sure there isn't, you'll have to manually Entity.TakeDamageInfo them in a timer.



    You'll have to explain more, that doesn't make sense.
    maybe he means the background image of the loading screen, iirc wasn't it some guy in a blue suit with a cone near by?
    Reply With Quote Edit / Delete Windows 7 Portugal Show Events

  35. Post #795
    quality poster
    Dennab
    August 2009
    12,242 Posts
    awesome thanks

    also how are clientside entities created in gm13? i read that ents.create was removed in update 10 but never saw a solution. i'm trying to create a "ghost prop" sort of like a preview for players to be able to place objects on walls and stuff.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  36. Post #796
    pennerlord's Avatar
    February 2011
    503 Posts
    awesome thanks

    also how are clientside entities created in gm13? i read that ents.create was removed in update 10 but never saw a solution. i'm trying to create a "ghost prop" sort of like a preview for players to be able to place objects on walls and stuff.
    ents.CreateClientProp("model")
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Lua Helper Lua Helper x 2 (list)

  37. Post #797
    jrj996's Avatar
    July 2009
    1,656 Posts
    I might be wrong when saying this but I think textures like that need to be an "UnlitGeneric" for preventing that type of texture glitch. So you might want to make a blank vtf and vmt with that setting so that doesn't happen any longer.

    Also a question of my own I'm trying to create this endurance system where the player receives lower damage depending on their skill but every formula I try returns a number that just simply won't work. I'm probably horribly wrong with what I'm doing but then again I'm really bad with math...

    hook.Add("EntityTakeDamage","Attr Endure",function(vic,wep,atk,amt,dmg)
    	print(amt - vic:GetSkill("Endurance") * attributes["Endurance"].Scale)
    	dmg:ScaleDamage(amt - vic:GetSkill("Endurance") * attributes["Endurance"].Scale) -- Endurance's scale is 0.2.
    end)
    

    Any ideas?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  38. Post #798
    skullorz's Avatar
    May 2009
    936 Posts
    Any ideas?
    Stop using amt -, then divide the endurance scale by endurance skill, then multiply by 5. An endurance skill of 1, in that case, won't get you any bonus. An endurance scale of 2 though, will get you 0.5?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  39. Post #799
    jrj996's Avatar
    July 2009
    1,656 Posts
    Stop using amt -
    That just makes it so that the lower your skill the less damage you take...
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  40. Post #800
    skullorz's Avatar
    May 2009
    936 Posts
    That just makes it so that the lower your skill the less damage you take...
    I realized that and updated the post. My math won't be perfect, so someone could help out.

    Code:
    attributes["Endurance"].Scale/vic:GetSkill("Endurance")*5
    In my case it's basically dividing 1 by the endurance skill, which is bad.
    Reply With Quote Edit / Delete Windows 7 United States Show Events