• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
The way you have it now is correct - ent.gamedata will act as "Object" or "self", and args will be args. You can also network ent indexes as 8-bit ints,
Whats the best way to render a model on the screen? What hook? render.Model, seems broken to me.
Create a ClientsideModel
When I did that it renders to the gameworld, not the screen like a GUI element. Am I supposed to parent the model to the player or is there a less hacky method?
Draw the model manually with DrawModel in a 2D render context (HUDPaint for example)
Since IMaterial:SetShader no longer available, I have problem with texture glitching. I have an airboat wing texture and roundedbox with blinking red light. When the red light appears (controlled by alpha) texture has changes in lightning. What's the way to make it static?
I just ended up going full clientside, dw guys
SetPos doesnt seem to work for ClientsideRagdolls. Frustrating.
Try setting the position of its physics objects.
Just me or bots don't have their steamid64 networked? https://i.imgur.com/o6m8ZJB.jpg
Hey so I'm having this issue where I can't actually load the cl_init.lua with the shared.lua for my custom swep base at the same time. I have to start singleplayer, include cl_init in shared, and then place the cl_init in the lua folder. How do I fix this?
When i use function render.Model on a 2D Rendering hook, I can't change the Z position? Whats the big deal?
Dude, do you know what '2 dimensions' mean?
Obviously, I'm talking about the scale of the projection of the model? Your comment isn't helpful.
Oh. I was thinking the wrong thing too. I thought you meant the Z position as in the layer order. Sorry if this is exactly what you're doing, but if you set the the Z coordinate in the position vector when calling render.Model, does it do anything?
Sorry for being cold, I misunderstood the question, I thought you were asking about setting a 3d space position in a 2d space.
Yeah I am, I doesn't seem to do anything. Does anyone knows of a addon/gamemode which renders a model onto the screen HUD that I can go look at?
Most likely you will have to have initiate a 3D Rendering context with cam.Start3D and then render your models there. Thats how I render models as part of custom weapon selection icons
I am currently working on a HUD for my gamemode. I am making the players health not have a limit if they continue to increase it, and I would like to have the HUD keep up with the ever increasing health. I am trying to have it draw layers of health bars, similarly to a boss fight where once you'd remove one health bar of its health there is another underneath etc. I am trying to loop through the creation of them but I cannot find a way to make only the bar on top decrease on the loss of health, then have the next one start decreasing once the top bar is empty. In my mind I could get this to work with a table of draw.RoundedBox so I was wondering if anyone knew if this was possible or how I would go about doing this.
Not at a computer to test. Create your bars under the for loop, since it will create x amount of health bars based on the loop count anyways. Then under the "i == bar" statement, paint the very last bar based on current health - the size of health measured per bar. So if it's 100hp per bar, do Health() - i*100. I don't know if my math adds up, but I'll edit this post when I'm in front if my computer.
I am slightly intoxicated right now so I might not be thinking 100% clearly right now, but you might be on to something. The issue that im thinkin still might be a problem is that I cant get each health bar to change independently from one another, as they are all using the players health in the width formula, which is always going to be changing.
Works... I guess? It goes to the position and then bounces around like a kid who discovered sugar for the first time.
Set all their instantaneous velocities to 0 after changing with GetPhysicsObectNum objects.
I'm trying to override an ENT function but when I deal damage to the entity the function doesn't seem to get triggered? function OnPlayerSpawnObject(ply, model, ent) if (!ent) then return; end if (ent:GetClass() == "prop_physics") then ent.gamedata = Object_Prop:new(ply, ent); ent.OnTakeDamage = function(obj, dmginfo) local gamedata = obj.gamedata; if (gamedata && obj.gamedata.health) then gamedata:OnTakeDamage(dmginfo); end end end . . . .
Will try now, good idea You need to use a hook. I'd suggest GM/EntityTakeDamage or GM/OnEntityCreated. Instead of overwriting, use hook.Add. This will work with most GM and Sandbox functions.
I am using a hook underneath that function. This isn’t the problem I’m having.
Looking at it again; I don’t think prop_physics will respond to that. Why not use EntityTakeDamage?
That’s the route I’ll take. Thanks.
This should work, right? Asking because I’ll be away for a while for i=0,rag:GetPhysicsObjectCount() do local thisphys = rag:GetPhysicsObjectNum(i) if thisphys:IsValid() then thisphys:SetVelocityInstantaneous( Vector() ) end end
You need to do PhysicsObjectCount - 1, since Lua for-loops include the end point.
Sorry, you need to Log In to post a reply to this thread.