• Lower playermodel and first person view
    5 replies, posted
Hello everybody, I have a question. I have noticed the Ugandan Knuckles playermodel is as big as a human in his reference model. https://files.facepunch.com/forum/upload/148021/639f8b0b-c78e-4846-99b8-d46dea803e6c/image.png However, in Gmod, the playermodel and the first person view are lower. https://files.facepunch.com/forum/upload/148021/84ad944d-16f3-4727-b745-72bf8f69fc83/image.png https://files.facepunch.com/forum/upload/148021/2106a88f-0a57-40cb-96c4-023c1f020b0a/image.png I know there are some commands in the lua file but I don't understand anything. Could you explain me how to do the same thing please ? I would like to make a porg model using this trick + proportion trick.
Well what a nice surprise, my own addon out here in the wild and I just randomly happen to cross it! This was a struggle to make and I'm planning on remaking the system in the future as I'm working on a gamemode that will depend on it, but I will explain how I made it. First thing first I had to override the SetModel function to make it so a custom hook would be called everytime (I am using a custom hook so every other PlayerModel using this system will call its own hook and check if it needs to set the size) and I used this: local mEnt = FindMetaTable("Entity") mEnt.NewSetModel = mEnt.NewSetModel || mEnt.SetModel function mEnt:SetModel(model) self.NewSetModel(self, model) if(self:IsPlayer()) then hook.Run("SPM_ModelChange", self) end end Now regardless of when the player is spawning, is setting his model, changing it or connecting to the server, the hook will always run at that moment. Some hooks like PlayerSetModel won't run most of the time. Now I just have stored some values around in a table that will be used for setting the scale, I have two functions: One to RESET the scale and one to CHANGE the scale to the one we want, this is what I use for my RESET scale: ply:SetModelScale(1) ply:ResetHull() ply:SetViewOffset(Vector(0, 0, 64)) ply:SetViewOffsetDucked(Vector(0, 0, 28)) And this is what I use for my CHANGE function: ply:SetModelScale(settings["scale"]) ply:SetHull(settings["hullminimum"], settings["hullmaximum"]) ply:SetHullDuck(settings["duckhullminimum"], settings["duckhullmaximum"]) ply:SetViewOffset(Vector(0, 0, settings["viewoffset"])) ply:SetViewOffsetDucked(Vector(0, 0, settings["duckviewoffset"])) And all of those are the values. Make sure to always run the SAME code both server and client side, or else you will get some laggy mess. Basically all you need to do is to set the model scale, set the hull and set the viewoffset. My model maker was the one that originally asked me to make something like this because the proportion trick sucked ass and always lead to problems + The hitbox and view position would always be wrong as opposed to how they should really be. That's why he made the model's skeleton as big as a human, so none of the proportion trick fuckery was going to affect it, I was the one that had to resize it. Now I'll just say that I butchered the code so much that I gave up with it and I refuse to work on it anymore as I am embarassed by how ugly it got and the disgusting work arounds I had to do to make it work. All just to wake up and see this stupid youtuber break it in a stupid gamemode that I had to find out why it broke it and realize that this script would probably break in any other game mode and there was nothing I could do. This is probably why "SPM" (Scripted Player Model) was never done before, because it sucks and there is no way to make sure your script runs 100% of the time the way you want with all the hundreds of thousands of other addons and gamemodes out there. One last thing: As far as I'm concerned there is no way to resize the death ragdoll without spending a month of your life and making the code huge and mess, I even offered 20 coins and no one could answer me, so I just delete them after they die.
Ooh, such amazing, thank you sooo much !! This is so helpful ! I'm going to try this with Minoru Mineta and porgs ! I saw you put another script to make the playermodel sit properly, but Knuckles is still under a specific seat, I don't remember which one. Is it with this script ? hook.Add("PlayerEnteredVehicle", settings["name"].."VehicleOffset", function(ply, veh) if(ply:InVehicle()) then if(ply:GetModel() == settings["model"]) then ply:SetPos(Vector(0, 0, settings["seatoffset"])) end end end) And how did you make to make it talk ? if(settings["bodygrouptalking"]) then if(SERVER) then util.AddNetworkString(settings["name"].."OpenMouth") util.AddNetworkString(settings["name"].."CloseMouth") net.Receive(settings["name"].."OpenMouth", function() local ply = net.ReadEntity() ply:SetNWBool("Is"..settings["name"].."Talking", true) end) net.Receive(settings["name"].."CloseMouth", function() local ply = net.ReadEntity() ply:SetNWBool("Is"..settings["name"].."Talking", false) end) end hook.Add("PlayerStartVoice", "StartOpenMouth"..settings["name"], function(ply) if(ply:GetModel() != settings["model"]) then return end net.Start(settings["name"].."OpenMouth") net.WriteEntity(ply) net.SendToServer() end) hook.Add("PlayerEndVoice", "StopOpenMouth"..settings["name"], function(ply) if(ply:GetModel() != settings["model"]) then return end net.Start(settings["name"].."CloseMouth") net.WriteEntity(ply) net.SendToServer() end) end And hook.Add("Tick", settings["name"].."ModelFixes", function() for k,v in pairs(player.GetAll()) do if(settings["bodygrouptalking"]) then if(v:GetNWBool("Is"..settings["name"].."Talking") == true) then v:SetBodygroup(settings["mouthbodygroup"], math.floor(CurTime()*settings["talkingspeed"]%settings["mouthframes"]) + settings["mouthstartingframe"]) else v:SetBodygroup(settings["mouthbodygroup"], settings["mouthstandingframe"]) end end end end) You can only answer if you get enough time to it, you already sufficiently helped me ! As far as I'm concerned there is no way to resize the death ragdoll without spending a month of your life and making the code huge and mess, I even offered 20 coins and no one could answer me, so I just delete them after they die. Haha, that's why there was no ragdoll after dying !
The talking part there is useless on this model, my partner wanted to make it so I could change certain bodygroups on the playermodel when the person is talking. We are doing this on the Sableye SPM when you are talking it "moves" his mouth but really it's just changing the bodygroups. So since the mouth here is not composed by bodygroups I have that part disabled and it's useless. The sitting part is there to offset it because it would just keep on "falling" through the seats and unfortunately there is no way to make it so it automatically detects the perfect height for every seat, so I just have that number there floating around and it usually works most of the time. I have this all set up so the guy making the playermodels can just do it himself by modifying the top values but he's still to lazy to do it so I got the short end of the stick and now my code looks awful.
Haha ok I see, now it looks more clear, thanks ! Does it mean we can make a playermodel talk with a textured mouth only ?
Yeah that's what I'm doing with the Sableye SPM on the workshop
Sorry, you need to Log In to post a reply to this thread.