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
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
Genius, thanks for the help!
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.
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:
Here are the screenshot's of what happens: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
This is when it is selected while facing the correction direction, and how I want it to look.
This is what happens otherwise..
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..
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)
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.
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?
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.
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
How can i make so only a specific player can open a door?
Like in RP gamemodes.
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
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.
Is there an offline copy of the backup wiki?
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.
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;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.Code:vgui.Create: Error when calling 'DCreateHoloMenu_Holopad':Init ([lua\includes\extensions\panel.lua:141] attempt to index local 'pnl' (a nil value))
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
I can't remember, is there a way to credit an entity's owner with kills made with ent:Ignite()?
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?
Anyone know how i can have the old gmod 10 screen on my gmod 12?
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
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.
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)
In my case it's basically dividing 1 by the endurance skill, which is bad.Code:attributes["Endurance"].Scale/vic:GetSkill("Endurance")*5