Help with ENT:Use function

I’m trying to create a SENT based NPC which opens a window from the function “OpenWholesaleMenu” however it’s just not working for me. I have little knowledge about LUA but slowy learning. Could anyone help me? :slight_smile:


AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )

function ENT:SpawnFunction( id, tr )

	local trace = util.GetPlayerTrace( id, id:GetAimVector() )
	local tr = util.TraceLine( trace )
	local NPC = ents.Create("npc_citizen")
	NPC:SetPos( tr.HitPos + tr.HitNormal * 30 )
	NPC:Spawn()
	NPC:Activate()
end

function ENT:Initialize()

end


function ENT:Use( activator, caller )

	caller:OpenWholesaleMenu()

end


Entity hooks do not work with HL2 entities, like NPCs.

Oh okay. Is it possible for me to set the model, the animation and make it stand properly?

[editline]06:11AM[/editline]

Oh okay. Is it possible for me to set the model, the animation and make it stand properly?

This will help: http://wiki.garrysmod.com/?title=Basic_Scripted_NPC

Thank you very much! Exactly what I was looking for.