Custom entities with player model

Hi!
I try to make a custom entities, and I use a playermodel.
I don’t know how to fix this error :


function ENT:Initialize()
	self:SetModel("models/player/portal/male_07_medic.mdl")
	self:PhysicsInit(SOLID_VPHYSICS)
	self:SetMoveType(MOVETYPE_NONE)
	self:SetSolid(SOLID_BBOX)
	self:SetHullSizeNormal()
	self:SetUseType(SIMPLE_USE)
	self:DropToFloor()
	self:SetMaxYawSpeed(90)
end

function ENT:Think()
	local sequence = self:LookupSequence("idle_all_01")
	self:ResetSequence(sequence or 1);
end

Thanks!

I already try without the sequence nothing append

Are you sure it’s not a problem with the model? I know I asked you this before, but just try spawning or viewing the model in the Q menu to see if it still has the missing texture. I’m about 99% sure this error doesn’t have anything to do with the code you’ve got, I think it has something to do with the model

I try with other models (https://steamcommunity.com/sharedfiles/filedetails/?id=373936300)
The same

Do you have some sort of addon adding that thing to the playermodel? I can’t think of a reason why that’d happen if not… those other models look fine in the screenshots

make sure its an actual player model(view the models addon description, and ask the creator), if its just for ragdolls, then it wont work most likely, because of the bones/rigging.

PlayerModel work with player^^

then, you didnt initialize the entity physics right. (waking etc) heres the default wiki example of fully setting up the entity physics:



function ENT:Initialize()
	-- Sets what model to use
	self:SetModel( "models/props/cs_assault/money.mdl" )

	-- Sets what color to use
	self:SetColor( Color( 200, 255, 200 ) )

	-- Physics stuff
	self:SetMoveType( MOVETYPE_VPHYSICS )
	self:SetSolid( SOLID_VPHYSICS )

	-- Init physics only on server, so it doesn't mess up physgun beam
	if ( SERVER ) then self:PhysicsInit( SOLID_VPHYSICS ) end

	-- Make prop to fall on spawn
	local phys = self:GetPhysicsObject()
	if ( IsValid( phys ) ) then phys:Wake() end
end


Thanks, but don’t work :confused:

try placing prints everywhere, and see if the code is ran.

Is your problem the missing texture or the animation not working?

If it’s the former, then there’s likely nothing wrong with your code; it’s just a screw-up with your model path.

If the latter is the case, then try some stuff in this code, I made this for a little NPC for an unreleased addon I made awhile back:



function ENT:Initialize( )
 
	self:SetModel( DELIVERY.NPCMODEL )
	self:SetHullType( HULL_HUMAN )
	self:SetHullSizeNormal( )
	self:SetNPCState( NPC_STATE_SCRIPT )
	self:SetSolid(  SOLID_BBOX )
	self:CapabilitiesAdd( CAP_ANIMATEDFACE ) 
	self:SetUseType( SIMPLE_USE )
	self:DropToFloor()
 
end


Thanks, but don’t work

You’re using a player model on an entity

Yes, I know. Yet I’ve seen this playermodel work (other server)

I don’t think you do; the playermodel may work fine as a playermodel but it won’t work on an npc. The same will happen if you use the gman playermodel on an npc ( models/player/gman_high.mdl ) instead of the non playermodel version ( models/gman_high.mdl )