Completely stumped. Spawn custom NPC is invisible yet model manipulator can swap the correct model (has same path to mdl)

I’ve spent 6 hours and no longer have hair. My custom npc from a derma panel spawns correctly but is completely invisible. (I can even change the material and see a little E just sitting there.) I can shoot and kill it.

I CAN spawn it from the ingame spawn menu just fine, model and everything. (again, it is in my gamemode/content with correct paths, so it works just fine) But when it comes from my derma panel, invisible. I can even swap the model from the spawnmenu npc to the derma npc and IT WORKS. even though the function in my init.lua has the same model path for the npc. Why would it work for one and not the other?. Check it out for yourselves. If it is permitted I am offering a $5 tip for someone to help me with this (paid via google wallet). (mods if that’s wrong let me know and I will remove this line)

init.lua code


net.Receive("spawn_npc1", function(l, ply)
	local hit = ply:GetEyeTrace().HitPos
 print( "Attempting NPC Spawn" )                                         //note BOTH print commands return fine in console 
	local ent = ents.Create("npc_citizen")
	 print("Finished NPC Spawn, any luck?")

code from cl_init.lua :

	Button1	= vgui.Create( "DButton", MainPanel )
				Button1:SetSize(200, 100)
				Button1:SetText( "NPC Test Button" )
				Button1.DoClick = function ()


Where exactly is the model located? Post full path please.

Where exactly is the Lua located? Again, full path please.


pc\cdc_soldier_npc.MDL (don’t know why it is putting a space at the end there)

I am assuming gamemodename, Gamemodename and GAMEMODENAME are all the same and are not Sandbox?

I am also assuming that all the necessary model files ( .vtx, etc ) are present near the .mdl file.

do print(ent:GetModel()) after spawning the citizen with your menu and see if the model printed is correct.

Try moving the model files to the root models folder. ( /common/garrysmod/garrysmod/models/ )

Yes they are the same name. Not in sandbox. The model files (vtx) are there and the material files are in a separate folder but I think that’s what you were looking for.

I am trying the print function now…

Can you tell me where I should put that print function? in the model’s lua or my init?

[editline]24th July 2015[/editline]

EDIT : Console returned this: models/humans/group01/cdc_soldier_npc.mdl
I don’t see that anywhere standby

[editline]24th July 2015[/editline]

I tried copying models folder to root with no look. Why is the console telling me the path is different for the model that what I specified. I see a reference in my spawnlist but should my script override the path?

[editline]24th July 2015[/editline]

Okay it worked when I** literally CREATED the directory ** the Ent(Getmodel) returned. (models/humans/group01/) and put the mdl files there. (yet, not materials, but it still works) Why was this happening? What if people don’t have the model directory in their root folder? How do I make this work from this point on, I really want to understand why? Also, what is your email address so I can send you a tip? (I said I would in first post)