Creating a fully clientside SENT

Hi, I posted this in “What do you need help with? V2” but no replies happened. I’m guessing that a few people do know how to do this though.

I’m trying to create a fully clientside entity using the SENT framework but it’s not working for me;

Console testing:


] lua_reloadents 
[cpp] Reloading Scripted Entities..
[cpp] Reloading Scripted Entities..
--- Missing Vgui material texturemissing
] MDLV_Test 
Can't find factory for entity: bub_cl_dynmodel
[@addons\holopad\lua\autorun\client\mdlview.lua:16] Tried to use a NULL entity!


Involved scripts:

addons\holopad\lua\autorun\client\mdlview.lua
[lua]
local function MDLV_Cmds(ply,command,args)

local cmd = string.upper(command)

if cmd == "MDLV_TEST" && CLIENT then
	local hurr = ents.Create("bub_cl_dynmodel")
	hurr:SetPos(LocalPlayer():GetPos() + Vector(0,0,30))
end

end

concommand.Add(“MDLV_Test”, MDLV_Cmds)
[/lua]

addons\holopad\lua\entities\bub_cl_dynmodel\cl_init.lua
[lua]
ENT.Type = “anim”
ENT.Base = “base_gmodentity”

ENT.RenderGroup = RENDERGROUP_BOTH

function ENT:Initialize( )

self:InitializeAsClientEntity( )
self:SetModel("models/error.mdl")

end

–ENT.Draw etc…
[/lua]

For ENT.Base, I’ve tried base_gmodentity, base_entity, base_anim.

What’s wrong?

I’m not sure whats wrong with your entity, but I can safelly say that you dont need to test for the command to be “MDLV_TEST” if your hook is already binded to that (The console command “MDLV_Test”, and ONLY that command, is going to call the function MDLV_Cmds).

My only guess is that the entity has to be declared in some way in the server, even if you are going to use it entirelly on the client.

There were other commands in that function that I removed to make my code more readable, I want to make it easy for people to help me :v:

Though all the same, I’d like to thank you for your reply.

Which line is 16?

Edit: Nvm, silly question, only one line uses entities

Try moving it server-side, and changing LocalPlayer() to ply
Though I’ve noticed when I make a command with underscores, it sometimes doesn’t work when created on the server, so you might need to rename it

Edit: Oh, fully clientside… Yeah, that probably won’t work, then :stuck_out_tongue:

I have my suspicions that the problem, thus solution lies in the values of ENT.Type and ENT.Base. Is there a complete list of valid values for these two fields?

My idea is that I may be using a base or type that doesn’t support exclusive clientside usage.

Does anyone have any examples of the usage of self:InitializeAsClientEntity()? I’m confident that I’m using it correctly but confidence is not equal to proof.